On 2017年03月03日 20:56, Paolo Bonzini wrote:
On 03/03/2017 10:06, Jason Wang wrote:Commit c611c76417f5 ("virtio: add MemoryListener to cache ring translations") registers a memory listener to dma_as. This may not work when IOMMU is enabled: dma_as(bus_master_as) were correctly initialized in pcibus_machine_done() after virtio_realize() where we try to register listener and initialize address space cache. Fixing this by: - delay the listener register to status set - reset dma_as before trying to initialize address spaces to make sure it works even IOMMU were created after virtio device Fixes: c611c76417f5 ("virtio: add MemoryListener to cache ring translations") Cc: Paolo Bonzini <[email protected]> Signed-off-by: Jason Wang <[email protected]>For virtio 0.9 it is valid to use the virtio device while the status is 0. You can add a function virtio_set_dma_as to generic virtio that does a MemoryListener unregister+register, then PCI can call it when the AddressSpace is ready. Paolo
Ok, will post a new version. Thanks
