]> xenbits.xensource.com Git - xen.git/commit
iommu/vtd: fix address translation for leaf entries
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 19 Jun 2023 13:46:03 +0000 (15:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 19 Jun 2023 13:46:03 +0000 (15:46 +0200)
commit82b28deb25f37e8422b14493a2efa2852638206d
treedb88b1bd0b97726ed0e66b061068d9fd81b5d27a
parentea613d2367ac9dca3875997034e8f4aff74ab635
iommu/vtd: fix address translation for leaf entries

Fix two issues related to leaf address lookups in VT-d:

* When translating an address that falls inside of a superpage in the
  IOMMU page tables the fetching of the PTE value wasn't masking of the
  contiguous related data, which caused the returned data to be
  corrupt as it would contain bits that the caller would interpret as
  part of the address.

* When the requested leaf address wasn't mapped by a superpage the
  returned value wouldn't have any of the low 12 bits set, thus missing
  the permission bits expected by the caller.

Take the opportunity to also adjust the function comment to note that
when returning the full PTE the bits above PADDR_BITS are removed.

Fixes: c71e55501a61 ('VT-d: have callers specify the target level for page table walks')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/vtd/iommu.c