Skip to contentSkip to conversation

RISC-V: resurrect nmon

PATCH Applied Antony Pavlov 2 participants 5 messages Jul 8, 2021 – Jul 9, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover RISC-V: resurrect nmon

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
Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/3 RISC-V: make it possible to run nmon from PBL C code

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.

---
 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(-)
arch/riscv/boot/Makefile +1 -0
index 968a826d16..80f63a4a0a 100644
@@ -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
arch/riscv/boot/nmon_entry.S new file +13 -0
new file mode 100644
index 0000000000..ae017d2a1c
@@ -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)
arch/riscv/include/asm/riscv_nmon.h +32 -17

110 lines not on this page · raw message

Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/3 RISC-V: boards: erizo: make it possible to use nmon

In reply to Antony Pavlov
---
 arch/riscv/boards/erizo/lowlevel.c | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/boards/erizo/lowlevel.c +2 -0
index fc262ed61b..ab06634bdb 100644
@@ -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. */
Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/3 RISC-V: boards: beaglev: make it possible to use nmon

In reply to Antony Pavlov
---
 arch/riscv/Kconfig.socs              | 1 +
 arch/riscv/boards/beaglev/lowlevel.c | 2 ++
 2 files changed, 3 insertions(+)
arch/riscv/Kconfig.socs +1 -0
index de74f216a2..221ea133d4 100644
@@ -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.
 
arch/riscv/boards/beaglev/lowlevel.c +2 -0
index cccb928bc8..db884dc762 100644
@@ -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();
Signature · 7 lines
2.32.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#4 lore raw
In reply to Antony Pavlov
Quoted 8 lines · Antony Pavlov

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

Quoted 14 lines
 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
Signature · 1 line
2.32.0
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox