Skip to contentSkip to conversation

riscv: hmp: Add a command to show virtual memory mappings

PATCH In review Bin Meng 2 participants 5 messages Aug 14, 2019 – Sep 3, 2019 RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v4 1/1 riscv: hmp: Add a command to show virtual memory mappings

This adds 'info mem' command for RISC-V, to show virtual memory mappings that aids debugging.

Rather than showing every valid PTE, the command compacts the output by merging all contiguous physical address mappings into one block and only shows the merged block mapping details.

---

Changes in v4:
- restore to v2, that does not print all harts's PTE, since we should switch to a cpu context via the 'cpu' command

Changes in v3:
- print PTEs for all harts instead of just current hart

Changes in v2:
- promote ppn to hwaddr when doing page table address calculation

 hmp-commands-info.hx       |   2 +-
 target/riscv/Makefile.objs |   4 +
 target/riscv/monitor.c     | 229 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 target/riscv/monitor.c
hmp-commands-info.hx +1 -1
index c59444c..257ee7d 100644
@@ -249,7 +249,7 @@ STEXI
 Show virtual to physical memory mappings.
 ETEXI
 
-#if defined(TARGET_I386)
+#if defined(TARGET_I386) || defined(TARGET_RISCV)
     {
         .name       = "mem",
         .args_type  = "",
target/riscv/Makefile.objs +4 -0
index b1c79bc..a8ceccd 100644
@@ -1,5 +1,9 @@
 obj-y += translate.o op_helper.o cpu_helper.o cpu.o csr.o fpu_helper.o gdbstub.o pmp.o
 
+ifeq ($(CONFIG_SOFTMMU),y)
+obj-y += monitor.o
+endif
+
 DECODETREE = $(SRC_PATH)/scripts/decodetree.py
 
 decode32-y = $(SRC_PATH)/target/riscv/insn32.decode
target/riscv/monitor.c new file +229 -0

229 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#1 lore raw
Quoted 21 lines · Bin Meng

This adds 'info mem' command for RISC-V, to show virtual memory mappings that aids debugging.

Rather than showing every valid PTE, the command compacts the output by merging all contiguous physical address mappings into one block and only shows the merged block mapping details.

---

Changes in v4:
- restore to v2, that does not print all harts's PTE, since we should switch to a cpu context via the 'cpu' command

Changes in v3:
- print PTEs for all harts instead of just current hart

Quoted 9 lines

Changes in v2:
- promote ppn to hwaddr when doing page table address calculation

 hmp-commands-info.hx       |   2 +-
 target/riscv/Makefile.objs |   4 +
 target/riscv/monitor.c     | 229 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 target/riscv/monitor.c

Ping?

What's the status of this patch?

Regards,
Bin

#2 lore raw
Quoted 32 lines · On Sun, 18 Aug 2019 22:59:54 PDT (-0700), [email protected] wrote:
Quoted 21 lines · Bin Meng

This adds 'info mem' command for RISC-V, to show virtual memory mappings that aids debugging.

Rather than showing every valid PTE, the command compacts the output by merging all contiguous physical address mappings into one block and only shows the merged block mapping details.

---

Changes in v4:
- restore to v2, that does not print all harts's PTE, since we should switch to a cpu context via the 'cpu' command

Changes in v3:
- print PTEs for all harts instead of just current hart

Quoted 9 lines

Changes in v2:
- promote ppn to hwaddr when doing page table address calculation

 hmp-commands-info.hx       |   2 +-
 target/riscv/Makefile.objs |   4 +
 target/riscv/monitor.c     | 229 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 target/riscv/monitor.c
Quoted 3 lines

Ping?

What's the status of this patch?

This is in my patch queue (for-master on github). I'm still a bit backed up on email, but when I get caught back up I'll send a PR.

author
#3 lore raw

Hi Palmer,

Quoted 34 lines · Palmer Dabbelt
Quoted 32 lines · On Sun, 18 Aug 2019 22:59:54 PDT (-0700), [email protected] wrote:
Quoted 30 lines · Bin Meng

This adds 'info mem' command for RISC-V, to show virtual memory mappings that aids debugging.

Rather than showing every valid PTE, the command compacts the output by merging all contiguous physical address mappings into one block and only shows the merged block mapping details.

---

Changes in v4:
- restore to v2, that does not print all harts's PTE, since we should switch to a cpu context via the 'cpu' command

Changes in v3:
- print PTEs for all harts instead of just current hart

Changes in v2:
- promote ppn to hwaddr when doing page table address calculation

 hmp-commands-info.hx       |   2 +-
 target/riscv/Makefile.objs |   4 +
 target/riscv/monitor.c     | 229 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 target/riscv/monitor.c
Quoted 6 lines
Quoted 3 lines

Ping?

What's the status of this patch?

This is in my patch queue (for-master on github). I'm still a bit backed up on email, but when I get caught back up I'll send a PR.

I double checked your git repo, and found you applied an older version of this patch.

Please drop that, and apply this v4 one.
http://patchwork.ozlabs.org/patch/1147104/

Regards,
Bin

#4 lore raw
Quoted 41 lines · On Tue, 27 Aug 2019 18:31:18 PDT (-0700), [email protected] wrote:

Hi Palmer,

Quoted 38 lines · Palmer Dabbelt
Quoted 35 lines · On Sun, 18 Aug 2019 22:59:54 PDT (-0700), [email protected] wrote:
Quoted 21 lines · Bin Meng

This adds 'info mem' command for RISC-V, to show virtual memory mappings that aids debugging.

Rather than showing every valid PTE, the command compacts the output by merging all contiguous physical address mappings into one block and only shows the merged block mapping details.

---

Changes in v4:
- restore to v2, that does not print all harts's PTE, since we should switch to a cpu context via the 'cpu' command

Changes in v3:
- print PTEs for all harts instead of just current hart

Quoted 9 lines

Changes in v2:
- promote ppn to hwaddr when doing page table address calculation

 hmp-commands-info.hx       |   2 +-
 target/riscv/Makefile.objs |   4 +
 target/riscv/monitor.c     | 229 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 target/riscv/monitor.c

Ping?

What's the status of this patch?

Quoted 8 lines
Quoted 2 lines

This is in my patch queue (for-master on github). I'm still a bit backed up on email, but when I get caught back up I'll send a PR.

I double checked your git repo, and found you applied an older version of this patch.

Please drop that, and apply this v4 one.
http://patchwork.ozlabs.org/patch/1147104/

Sorry about that, it should be fixed now.