This patch series introduces a general DMA infrastructure which allows the emulation of guest-visible IOMMUs. That is, it provides a framework by which an IOMMU device can be implemented, such that DMA from other device emulations will be translated according to the mappings provided by the IOMMU.
One example IOMMU implementation is included, for the para-virtualized TCE tables specified by PAPR and used in the pseries machine for both virtual IO and PCI devices. This series is an updated and cleaned-up version of patches posted by Eduard - Gabriel Munteanu some time ago. Those prompted some discussion at the time, but no resolution was reached. These patches are now pretty polished although I'd like to get some comment from people working with other IOMMUs to make sure the infrastructure is sufficient to cover those. Specifically, Eduard - Gabriel, if you have an updated version of your AMD IOMMU driver, it would be good to see if that can work with this infrastructure. The series also converts a number of existing device models to use the new DMA infrastructure, so they can be used with IOMMUs. Along with the pci_dma_*() wrapper functions which are already in, this means that with this series applied, essentially all PCI devices should work with an emulated IOMMU, as well as pseries VIO devices. Other types of devices would need some further conversion to work with the new framework, but that should be quite straightforward.