Hi, Here's another spin on my patches working towards integrating vfio with guest visible iommu support. These are on top of Paolo Bonzini's iommu branch at: git://github.com/bonzini/qemu.git
This new spin starts with some extensions to the pci / memory API core, then some VFIO updates to use those to start breaking vfio's assumption of mapping system memory directly. It doesn't actually support guest IOMMUs with vfio yet, but it does support simpler non-identify DMA mappings between PCI space and main memory, such as RAM being mapped at a non-zero offset within PCI space (this is configurable on many embedded host bridges). This new spin no longer adds vfio specific hooks into the memory core, which turns out to be less messy than I anticipated, though it may yet get worse with actual guest IOMMU support, which I'm still working on. Aside: I realised there's another problem with assignment of DMA address spaces in the current DMAContext scheme which is still there with the iommu rework, but it's more or less orthogonal to the changes here, so I've left it for now. Specifically the way the iommu is determined from a callback in the PCIBus means that it won't be assigned for devices under a PCI-PCI bridge.