hw/block/pflash_cfi02: Do not create aliases when not necessary
When no mapping is requested, it is pointless to create alias regions. Only create them when multiple mappings are requested to simplify the memory layout. The flatview is not changed. For example using 'qemu-system-sh4 -M r2d -S -monitor stdio', * before: (qemu) info mtree address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000000ffffff (prio 0, i/o): pflash 0000000000000000-0000000000ffffff (prio 0, romd): alias pflash-alias @r2d.flash 0000000000000000-0000000000ffffff 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram (qemu) info mtree -f FlatView #0 AS "memory", root: system AS "cpu-memory-0", root: system Root memory region: system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram * after: (qemu) info mtree address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram (qemu) info mtree -f FlatView #0 AS "memory", root: system AS "cpu-memory-0", root: system Root memory region: system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210325120921.858993-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
1d4ae5a34f
commit
27545c9df2
@ -917,8 +917,12 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp)
|
||||
pfl->sector_erase_map = bitmap_new(pfl->total_sectors);
|
||||
|
||||
pfl->rom_mode = true;
|
||||
pflash_setup_mappings(pfl);
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
|
||||
if (pfl->mappings > 1) {
|
||||
pflash_setup_mappings(pfl);
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
|
||||
} else {
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->orig_mem);
|
||||
}
|
||||
|
||||
timer_init_ns(&pfl->timer, QEMU_CLOCK_VIRTUAL, pflash_timer, pfl);
|
||||
pfl->status = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user