[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 9/9] hw/misc/interleaver: Display subregions in 'info mtree'
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 9/9] hw/misc/interleaver: Display subregions in 'info mtree' |
Date: |
Mon, 17 Aug 2020 18:18:53 +0200 |
Implement the MemoryRegion::subregions_description() handler to
be able to display the inverleaved memory regions:
$ qemu-system-sh4 -M none -monitor stdio \
-device mmio-testdev,address=0x00000000 -monitor stdio
address-space: memory
0000000000000000-ffffffffffffffff (prio 0, i/o): system
0000000000000000-000000001fffffff (prio 0, i/o): testdev
0000000000000000-00000000000007ff (prio 0, ram): testdev-sram
0000000010000000-0000000017ffffff (prio 0, i/o): interleaver-container
0000000011608000-00000000116081ff (prio 0, i/o): interleaver-16x8
0000000011608000-00000000116081ff (prio 0, i/o): 8-bit access on
'sram-p0'
0000000011608000-00000000116081ff (prio 0, i/o): 8-bit access on
'sram-p1' (8-bit shifted)
0000000013208000-00000000132083ff (prio 0, i/o): interleaver-32x8
0000000013208000-00000000132083ff (prio 0, i/o): 8-bit access on
'sram-p0'
0000000013208000-00000000132083ff (prio 0, i/o): 8-bit access on
'sram-p1' (8-bit shifted)
0000000013208000-00000000132083ff (prio 0, i/o): 8-bit access on
'sram-p2' (16-bit shifted)
0000000013208000-00000000132083ff (prio 0, i/o): 8-bit access on
'sram-p3' (24-bit shifted)
0000000013216000-00000000132161ff (prio 0, i/o): interleaver-32x16
0000000013216000-00000000132161ff (prio 0, i/o): 16-bit access on
'sram-p0'
0000000013216000-00000000132161ff (prio 0, i/o): 16-bit access on
'sram-p1' (16-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): interleaver-64x8
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p0'
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p1' (8-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p2' (16-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p3' (24-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p4' (32-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p5' (40-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p6' (48-bit shifted)
0000000016408000-00000000164087ff (prio 0, i/o): 8-bit access on
'sram-p7' (56-bit shifted)
0000000016416000-00000000164163ff (prio 0, i/o): interleaver-64x16
0000000016416000-00000000164163ff (prio 0, i/o): 16-bit access on
'sram-p0'
0000000016416000-00000000164163ff (prio 0, i/o): 16-bit access on
'sram-p1' (16-bit shifted)
0000000016416000-00000000164163ff (prio 0, i/o): 16-bit access on
'sram-p2' (32-bit shifted)
0000000016416000-00000000164163ff (prio 0, i/o): 16-bit access on
'sram-p3' (48-bit shifted)
0000000016432000-00000000164321ff (prio 0, i/o): interleaver-64x32
0000000016432000-00000000164321ff (prio 0, i/o): 32-bit access on
'sram-p0'
0000000016432000-00000000164321ff (prio 0, i/o): 32-bit access on
'sram-p1' (32-bit shifted)
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/misc/interleaver.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/hw/misc/interleaver.c b/hw/misc/interleaver.c
index 46099e9e11..5cedcb3541 100644
--- a/hw/misc/interleaver.c
+++ b/hw/misc/interleaver.c
@@ -112,6 +112,34 @@ static MemTxResult interleaver_write(void *opaque,
return r;
}
+static GStrv interleaver_subregions_description(const MemoryRegion *mr)
+{
+ InterleaverDeviceState *s = container_of(mr, InterleaverDeviceState,
iomem);
+ InterleaverDeviceClass *idc = INTERLEAVER_DEVICE_GET_CLASS(s);
+ gchar **descs = g_new(gchar *, idc->mr_count + 1);
+ unsigned output_access_bits = idc->output_access_size << 3;
+ size_t i;
+
+ for (i = 0; i < idc->mr_count; i++) {
+ if (i) {
+ descs[i] = g_strdup_printf(" %u-bit access on '%s'"
+ " (%zu-bit shifted)",
+ output_access_bits,
+ s->mr[i] ? memory_region_name(s->mr[i])
+ : emtpy_mr_name,
+ i * output_access_bits);
+ } else {
+ descs[i] = g_strdup_printf(" %u-bit access on '%s'",
+ output_access_bits,
+ s->mr[i] ? memory_region_name(s->mr[i])
+ : emtpy_mr_name);
+ }
+ }
+ descs[i] = NULL;
+
+ return descs;
+}
+
static void interleaver_realize(DeviceState *dev, Error **errp)
{
InterleaverDeviceState *s = INTERLEAVER_DEVICE(dev);
@@ -139,6 +167,7 @@ static void interleaver_realize(DeviceState *dev, Error
**errp)
}
memory_region_init_io(&s->iomem, OBJECT(s), &idc->ops, s,
idc->name, s->size);
+ s->iomem.subregions_description = interleaver_subregions_description;
sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
}
--
2.26.2
- [RFC PATCH 0/9] hw/misc: Add support for interleaved memory accesses, Philippe Mathieu-Daudé, 2020/08/17
- [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é <=
- [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é, 2020/08/17
- 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