iommu/vt-d: Add missing iotlb flush for parent domain
authorYi Liu <yi.l.liu@intel.com>
Mon, 19 Feb 2024 11:15:54 +0000 (19:15 +0800)
committerJoerg Roedel <jroedel@suse.de>
Wed, 21 Feb 2024 09:28:44 +0000 (10:28 +0100)
commit821985301124c0a5e7ca15fc69a9a531e9442d70
treeb394660d9f488dfd1f0eb81285650252aeda257b
parent0455d317f533e4427ddaa805563ff48711f05810
iommu/vt-d: Add missing iotlb flush for parent domain

If a domain is used as the parent in nested translation its mappings might
be cached using DID of the nested domain. But the existing code ignores
this fact to only invalidate the iotlb entries tagged by the domain's own
DID.

Loop the s1_domains list, if any, to invalidate all iotlb entries related
to the target s2 address range. According to VT-d spec there is no need for
software to explicitly flush the affected s1 cache. It's implicitly done by
HW when s2 cache is invalidated.

Fixes: b41e38e22539 ("iommu/vt-d: Add nested domain allocation")
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20240208082307.15759-4-yi.l.liu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c