amd-iommu: add flush iommu_ops
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 17 Dec 2018 09:22:56 +0000 (09:22 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 3 Jan 2019 10:36:06 +0000 (10:36 +0000)
commitcbe21fd047c54d255023c67b602459f0bec7c2a8
tree486e40cbf112b97f944f27a7dbb4b6628f38c30e
parentd68de0d6cb3e09fa9c53417713a7fc697d4fe36f
amd-iommu: add flush iommu_ops

The iommu_ops structure contains two methods for flushing: 'iotlb_flush' and
'iotlb_flush_all'. This patch adds implementations of these for AMD IOMMUs.

The iotlb_flush method takes a base DFN and a (4k) page count, but the
flush needs to be done by page order (i.e. 0, 9 or 18). Because a flush
operation is fairly expensive to perform, the code calculates the minimum
order single flush that will cover the specified page range rather than
performing multiple flushes.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Brian Woods <brian.woods@amd.com>
xen/drivers/passthrough/amd/iommu_map.c
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/iommu.c
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h