linux/drivers/vfio
Alex Williamson 6fe1010d6d vfio/type1: DMA unmap chunking
When unmapping DMA entries we try to rely on the IOMMU API behavior
that allows the IOMMU to unmap a larger area than requested, up to
the size of the original mapping.  This works great when the IOMMU
supports superpages *and* they're in use.  Otherwise, each PAGE_SIZE
increment is unmapped separately, resulting in poor performance.

Instead we can use the IOVA-to-physical-address translation provided
by the IOMMU API and unmap using the largest contiguous physical
memory chunk available, which is also how vfio/type1 would have
mapped the region.  For a synthetic 1TB guest VM mapping and shutdown
test on Intel VT-d (2M IOMMU pagesize support), this achieves about
a 30% overall improvement mapping standard 4K pages, regardless of
IOMMU superpage enabling, and about a 40% improvement mapping 2M
hugetlbfs pages when IOMMU superpages are not available.  Hugetlbfs
with IOMMU superpages enabled is effectively unchanged.

Unfortunately the same algorithm does not work well on IOMMUs with
fine-grained superpages, like AMD-Vi, costing about 25% extra since
the IOMMU will automatically unmap any power-of-two contiguous
mapping we've provided it.  We add a routine and a domain flag to
detect this feature, leaving AMD-Vi unaffected by this unmap
optimization.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2015-02-06 10:58:56 -07:00
..
pci vfio-pci: Fix the check on pci device type in vfio_pci_probe() 2015-01-07 10:29:11 -07:00
Kconfig drivers/vfio: allow type-1 IOMMU instantiation on top of an ARM SMMU 2014-11-14 09:10:59 -07:00
Makefile drivers/vfio: Fix EEH build error 2014-08-08 10:36:20 -06:00
vfio.c driver core: dev_set_drvdata can no longer fail 2014-05-27 13:40:51 -07:00
vfio_iommu_spapr_tce.c drivers/vfio: EEH support for VFIO PCI device 2014-08-05 15:28:48 +10:00
vfio_iommu_type1.c vfio/type1: DMA unmap chunking 2015-02-06 10:58:56 -07:00
vfio_spapr_eeh.c drivers/vfio: Export vfio_spapr_iommu_eeh_ioctl() with GPL 2014-09-29 10:31:51 -06:00