amd-iommu: remove page merging code
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 13 Dec 2018 11:01:50 +0000 (12:01 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 13 Dec 2018 11:01:50 +0000 (12:01 +0100)
commit5c08550ff4f3804df471b12c29ae170de981fc13
tree0bba52fa58a3fc7829e354e0877963ba065bbb0a
parent00c96d77422a4b84247bec5dadf434363d312cac
amd-iommu: remove page merging code

The page merging logic makes use of bits 1-8 and bit 63 of a PTE, which
used to be specified as 'ignored'. However, bits 5 and 6 are now specified
as 'accessed' and 'dirty' bits and their use only remains safe as long as
the DTE 'Host Access Dirty' bits remain unused by Xen, or by hardware
before the domain starts running. (XSA-275 disabled the operation of the
code after domain creation completes).

With the page merging logic present in its current form there are no spare
ignored bits in the PTE at all, but PV-IOMMU support will require at least
one spare bit to track which PTEs are added by hypercall.

This patch removes the code, freeing up the remaining PTE ignored bits
for other use, including PV-IOMMU support, as well as significantly
simplifying and shortening the source by ~170 lines. There may be some
marginal performance cost (but none has been observed in manual testing
with a passed-through NVIDIA GPU) since higher order mappings will now be
ruled out until a mapping order parameter is passed to iommu_ops. That will
be dealt with by a subsequent patch though.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Brian Woods <brian.woods@amd.com>
xen/drivers/passthrough/amd/iommu_map.c
xen/include/asm-x86/iommu.h