@@ -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 {
@@ -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);
+ }
}
}
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(+)