[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 8/9] memory: Allow memory region to display its subregions ow
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 8/9] memory: Allow memory region to display its subregions own descriptions |
Date: |
Mon, 17 Aug 2020 18:18:52 +0200 |
If a MemoryRegion has subregion linked (but NOT mapped), these
subregions won't be displayed in the 'info mtree' HMP command.
Add the possibility to display such subregion descriptions.
It will result useful for the Interleaver memory device.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Any clever idea?
---
include/exec/memory.h | 6 ++++++
softmmu/memory.c | 22 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 307e527835..8bcacfc79e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -404,6 +404,12 @@ struct MemoryRegion {
const char *name;
unsigned ioeventfd_nb;
MemoryRegionIoeventfd *ioeventfds;
+ /*
+ * If a memory region has subregions linked, it can use this
+ * handler to return an array of string, each string holding
+ * the subregion description.
+ */
+ GStrv (*subregions_description)(const MemoryRegion *mr);
};
struct IOMMUMemoryRegion {
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 8139da1a58..f8e27edbe2 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -2967,6 +2967,28 @@ static void mtree_print_mr(const MemoryRegion *mr,
unsigned int level,
mtree_print_mr_owner(mr);
}
qemu_printf("\n");
+
+ if (mr->subregions_description) {
+ GStrv s = mr->subregions_description(mr);
+ for (int j = 0; s[j]; j++) {
+ for (i = 0; i < level; i++) {
+ qemu_printf(MTREE_INDENT);
+ }
+ qemu_printf(TARGET_FMT_plx "-" TARGET_FMT_plx
+ " (prio %d, %s%s): %s%s",
+ cur_start, cur_end,
+ mr->priority,
+ mr->nonvolatile ? "nv-" : "",
+ memory_region_type((MemoryRegion *)mr),
+ s[j],
+ mr->enabled ? "" : " [disabled]");
+ if (owner) {
+ mtree_print_mr_owner(mr);
+ }
+ qemu_printf("\n");
+ }
+ g_strfreev(s);
+ }
}
}
--
2.26.2
- [RFC PATCH 2/9] qtest: Add local qtest_mem_as() getter, (continued)
- [RFC PATCH 2/9] qtest: Add local qtest_mem_as() getter, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 3/9] qtest: Directly use global address_space_memory when no CPU available, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 4/9] hw/misc: Add interleaver device to make interleaved memory accesses, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 1/9] memory: Initialize MemoryRegionOps for RAM memory regions, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 5/9] hw/misc: Add MMIO test device, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 9/9] hw/misc/interleaver: Display subregions in 'info mtree', Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 6/9] hw/core/null-machine: Allow to use the MMIO 'test' device, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 7/9] tests/qtest: Add generic MMIO tests, Philippe Mathieu-Daudé, 2020/08/17
- [RFC PATCH 8/9] memory: Allow memory region to display its subregions own descriptions,
Philippe Mathieu-Daudé <=
- Re: [RFC PATCH 0/9] hw/misc: Add support for interleaved memory accesses, no-reply, 2020/08/17
- Re: [RFC PATCH 0/9] hw/misc: Add support for interleaved memory accesses, Philippe Mathieu-Daudé, 2020/08/22
- Re: [RFC PATCH 0/9] hw/misc: Add support for interleaved memory accesses, Philippe Mathieu-Daudé, 2020/08/22