* [PATCH next 0/3] RISC-V: resurrect nmon
@ 2021-07-08 8:30 Antony Pavlov
2021-07-08 8:30 ` [PATCH next 1/3] RISC-V: make it possible to run nmon from PBL C code Antony Pavlov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Antony Pavlov @ 2021-07-08 8:30 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
After migrating to PBL we can't use nmon assembler macro
in C code anymore. This series adds necessary wrapper
for invoking nmon from PBL C code.
Antony Pavlov (3):
RISC-V: make it possible to run nmon from PBL C code
RISC-V: boards: erizo: make it possible to use nmon
RISC-V: boards: beaglev: make it possible to use nmon
arch/riscv/Kconfig.socs | 1 +
arch/riscv/boards/beaglev/lowlevel.c | 2 ++
arch/riscv/boards/erizo/lowlevel.c | 2 ++
arch/riscv/boot/Makefile | 1 +
arch/riscv/boot/nmon_entry.S | 13 ++++++++
arch/riscv/include/asm/riscv_nmon.h | 49 ++++++++++++++++++----------
6 files changed, 51 insertions(+), 17 deletions(-)
create mode 100644 arch/riscv/boot/nmon_entry.S
--
2.32.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH next 1/3] RISC-V: make it possible to run nmon from PBL C code
2021-07-08 8:30 [PATCH next 0/3] RISC-V: resurrect nmon Antony Pavlov
@ 2021-07-08 8:30 ` Antony Pavlov
2021-07-08 8:30 ` [PATCH next 2/3] RISC-V: boards: erizo: make it possible to use nmon Antony Pavlov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2021-07-08 8:30 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
After migrating to PBL we can't use nmon assembler macro
in C code anymore. Some changes are introduced to invoke
nmon from PBL C code:
* use 'lla' macro instruction instead of 'la';
* don't touch the 'ra' register, use 'a2' instead;
* add wrapper C function for nmon.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/riscv/boot/Makefile | 1 +
arch/riscv/boot/nmon_entry.S | 13 ++++++++
arch/riscv/include/asm/riscv_nmon.h | 49 +++++++++++++++++++----------
3 files changed, 46 insertions(+), 17 deletions(-)
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
index 968a826d16..80f63a4a0a 100644
--- a/arch/riscv/boot/Makefile
+++ b/arch/riscv/boot/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += start.o
pbl-y += entry.o uncompress.o
+pbl-y += nmon_entry.o
pbl-$(CONFIG_BOARD_GENERIC_DT) += board-dt-2nd.o
diff --git a/arch/riscv/boot/nmon_entry.S b/arch/riscv/boot/nmon_entry.S
new file mode 100644
index 0000000000..ae017d2a1c
--- /dev/null
+++ b/arch/riscv/boot/nmon_entry.S
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/linkage.h>
+#include <asm/sections.h>
+
+#include "asm/debug_ll.h"
+#include "asm/riscv_nmon.h"
+
+.section .text_bare_init
+
+ENTRY(__barebox_nmon_entry)
+ riscv_nmon
+ ret
+ENDPROC(__barebox_nmon_entry)
diff --git a/arch/riscv/include/asm/riscv_nmon.h b/arch/riscv/include/asm/riscv_nmon.h
index caf213cdd8..8a44e216d7 100644
--- a/arch/riscv/include/asm/riscv_nmon.h
+++ b/arch/riscv/include/asm/riscv_nmon.h
@@ -16,13 +16,26 @@
#ifndef __ASM_RISCV_NMON_H
#define __ASM_RISCV_NMON_H
+#include <linux/kconfig.h>
+
#define CODE_ESC 0x1b
+#ifndef __ASSEMBLY__
+
+extern void __barebox_nmon_entry(void);
+
+static inline void barebox_nmon_entry(void)
+{
+ if (IS_ENABLED(CONFIG_NMON))
+ __barebox_nmon_entry();
+}
+
+#else
+
.macro nmon_outs msg
- la a1, \msg
-
- jal _nmon_outs
+ lla a1, \msg
+ jal a2, _nmon_outs
.endm
@@ -73,7 +86,7 @@ nmon_main:
li a0, 'q'
bne s0, a0, 3f
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
j nmon_exit
@@ -90,12 +103,12 @@ nmon_main:
j nmon_main_help
nmon_cmd_d:
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
li a0, ' '
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
- jal _nmon_gethexw
+ jal a2, _nmon_gethexw
nmon_outs msg_nl
@@ -105,28 +118,28 @@ nmon_cmd_d:
j nmon_main
nmon_cmd_w:
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
li a0, ' '
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
- jal _nmon_gethexw
+ jal a2, _nmon_gethexw
move s2, s0
li a0, ' '
- jal _nmon_outc_a0
- jal _nmon_gethexw
+ jal a2, _nmon_outc_a0
+ jal a2, _nmon_gethexw
sw s0, 0(s2)
j nmon_main
nmon_cmd_g:
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
li a0, ' '
- jal _nmon_outc_a0
+ jal a2, _nmon_outc_a0
- jal _nmon_gethexw
+ jal a2, _nmon_gethexw
move s2, s0
nmon_outs msg_nl
@@ -136,7 +149,7 @@ nmon_cmd_g:
_nmon_outc_a0:
debug_ll_outc_a0
- jr ra
+ jr a2
_nmon_outs:
@@ -202,7 +215,7 @@ _get_hex_digit:
move s0, t2
_nmon_jr_ra_exit:
- jr ra
+ jr a2
msg_prompt:
.asciz "\r\nnmon> "
@@ -231,4 +244,6 @@ nmon_exit:
.endm
+#endif /* __ASSEMBLY__ */
+
#endif /* __ASM_RISCV_NMON_H */
--
2.32.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH next 2/3] RISC-V: boards: erizo: make it possible to use nmon
2021-07-08 8:30 [PATCH next 0/3] RISC-V: resurrect nmon Antony Pavlov
2021-07-08 8:30 ` [PATCH next 1/3] RISC-V: make it possible to run nmon from PBL C code Antony Pavlov
@ 2021-07-08 8:30 ` Antony Pavlov
2021-07-08 8:30 ` [PATCH next 3/3] RISC-V: boards: beaglev: " Antony Pavlov
2021-07-09 20:58 ` [PATCH next 0/3] RISC-V: resurrect nmon Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2021-07-08 8:30 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/riscv/boards/erizo/lowlevel.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/riscv/boards/erizo/lowlevel.c b/arch/riscv/boards/erizo/lowlevel.c
index fc262ed61b..ab06634bdb 100644
--- a/arch/riscv/boards/erizo/lowlevel.c
+++ b/arch/riscv/boards/erizo/lowlevel.c
@@ -3,6 +3,7 @@
#include <common.h>
#include <asm/barebox-riscv.h>
#include <debug_ll.h>
+#include <asm/riscv_nmon.h>
ENTRY_FUNCTION(start_erizo_generic, a0, a1, a2)
{
@@ -10,6 +11,7 @@ ENTRY_FUNCTION(start_erizo_generic, a0, a1, a2)
void *fdt;
debug_ll_init();
+ barebox_nmon_entry();
putc_ll('>');
/* On POR, we are running from read-only memory here. */
--
2.32.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH next 3/3] RISC-V: boards: beaglev: make it possible to use nmon
2021-07-08 8:30 [PATCH next 0/3] RISC-V: resurrect nmon Antony Pavlov
2021-07-08 8:30 ` [PATCH next 1/3] RISC-V: make it possible to run nmon from PBL C code Antony Pavlov
2021-07-08 8:30 ` [PATCH next 2/3] RISC-V: boards: erizo: make it possible to use nmon Antony Pavlov
@ 2021-07-08 8:30 ` Antony Pavlov
2021-07-09 20:58 ` [PATCH next 0/3] RISC-V: resurrect nmon Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2021-07-08 8:30 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
arch/riscv/Kconfig.socs | 1 +
arch/riscv/boards/beaglev/lowlevel.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index de74f216a2..221ea133d4 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -52,6 +52,7 @@ config SOC_STARFIVE
select ARCH_HAS_RESET_CONTROLLER
select RISCV_S_MODE
select HAS_ASM_DEBUG_LL
+ select HAS_NMON
help
This enables support for SiFive SoC platform hardware.
diff --git a/arch/riscv/boards/beaglev/lowlevel.c b/arch/riscv/boards/beaglev/lowlevel.c
index cccb928bc8..db884dc762 100644
--- a/arch/riscv/boards/beaglev/lowlevel.c
+++ b/arch/riscv/boards/beaglev/lowlevel.c
@@ -3,6 +3,7 @@
#include <common.h>
#include <debug_ll.h>
#include <asm/barebox-riscv.h>
+#include <asm/riscv_nmon.h>
ENTRY_FUNCTION(start_beaglev_starlight, a0, a1, a2)
{
@@ -10,6 +11,7 @@ ENTRY_FUNCTION(start_beaglev_starlight, a0, a1, a2)
void *fdt;
debug_ll_init();
+ barebox_nmon_entry();
putc_ll('>');
fdt = __dtb_z_jh7100_beaglev_starlight_start + get_runtime_offset();
--
2.32.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH next 0/3] RISC-V: resurrect nmon
2021-07-08 8:30 [PATCH next 0/3] RISC-V: resurrect nmon Antony Pavlov
` (2 preceding siblings ...)
2021-07-08 8:30 ` [PATCH next 3/3] RISC-V: boards: beaglev: " Antony Pavlov
@ 2021-07-09 20:58 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2021-07-09 20:58 UTC (permalink / raw)
To: Antony Pavlov; +Cc: barebox, Ahmad Fatoum
On Thu, Jul 08, 2021 at 11:30:32AM +0300, Antony Pavlov wrote:
> After migrating to PBL we can't use nmon assembler macro
> in C code anymore. This series adds necessary wrapper
> for invoking nmon from PBL C code.
>
> Antony Pavlov (3):
> RISC-V: make it possible to run nmon from PBL C code
> RISC-V: boards: erizo: make it possible to use nmon
> RISC-V: boards: beaglev: make it possible to use nmon
Applied, thanks
Sascha
>
> arch/riscv/Kconfig.socs | 1 +
> arch/riscv/boards/beaglev/lowlevel.c | 2 ++
> arch/riscv/boards/erizo/lowlevel.c | 2 ++
> arch/riscv/boot/Makefile | 1 +
> arch/riscv/boot/nmon_entry.S | 13 ++++++++
> arch/riscv/include/asm/riscv_nmon.h | 49 ++++++++++++++++++----------
> 6 files changed, 51 insertions(+), 17 deletions(-)
> create mode 100644 arch/riscv/boot/nmon_entry.S
>
> --
> 2.32.0
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-09 21:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 8:30 [PATCH next 0/3] RISC-V: resurrect nmon Antony Pavlov
2021-07-08 8:30 ` [PATCH next 1/3] RISC-V: make it possible to run nmon from PBL C code Antony Pavlov
2021-07-08 8:30 ` [PATCH next 2/3] RISC-V: boards: erizo: make it possible to use nmon Antony Pavlov
2021-07-08 8:30 ` [PATCH next 3/3] RISC-V: boards: beaglev: " Antony Pavlov
2021-07-09 20:58 ` [PATCH next 0/3] RISC-V: resurrect nmon Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox