On Sat, 28 May 2016 18:14:18 +0000 "Aviv B.D." <bd.a...@gmail.com> wrote:
> Hi, > As far as I tested the disabled code (call to memory_region_iommu_replay) > hangup > QEMU on startup if IOMMU is enabled (scaning 64 bit address space takes > more > than an hour on modern hardware) , at least on x86 hardware. So the code is > not 100% > correct for any context. Maybe it just should be disabled for x86 > architecture? > > By specification any such behavior of applying a domain to device should > include > cache invalidation if CM flag is present so I'm not thinking that my patch > break > this scenario. The functionality is completely necessary, imagine moving a device from an IOMMU API domain in the guest back to the passthrough domain, if there is no replay of the IOMMU context, the device cannot perform any DMA at all. The current replay mechanism is obviously not designed for iterating over every page of a 64bit address space, which is why I suggest a replay callback on MemoryRegionIOMMUOps so that VT-d can optimize the replay by walking the VT-d page tables and perhaps implementation of hardware passthrough mode and the ability to dynamically switch a device to address_space_memory. The current replay code is correct and functional in a context with a window based IOMMU where the IOMMU address space is much smaller. We cannot have correct operation without a mechanism to rebuild the host IOMMU context when a device is switched to a new domain. Please address it. Thanks, Alex