On Fri, Feb 05, 2021 at 11:18:28AM +0000, Peter Maydell wrote: > On Fri, 5 Feb 2021 at 10:31, Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > > 1/ virtio-mmio must be sysbus-device, > > Yes. > > > 2/ we can not sysbus-map out of main memory so private container > > is incorrect, and Versal can not use "mr-ps-switch"? > > No. If you have a sysbus device, and you want to map it somewhere > other than into system-memory-map, you can do that: you use > sysbus_mmio_get_region() to get the MemoryRegion*, and then map > it into whatever container you need with memory_region_add_subregion(). >
Thanks, that matches how I thought things should work. I wonder if virtio_mmio_bus_get_dev_path() really should be peeking into Sysbus internals mmio[].addr? Sysbus mmio[].addr looks like a candidate for removal if we ever get rid of the default system_memory... I don't have any good suggestions how to fix this. I guess we could wrap memory_region_add_subregion() with a sysbus version of it that sets mmio[].addr but that seems like a step backwards to me. Perhaps there's a way fix this in virtio_mmio_bus_get_dev_path()? Best regards, Edgar