]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu/vt-d: Make iotlb_sync_map a static property of dmar_domain
authorLu Baolu <baolu.lu@linux.intel.com>
Mon, 21 Jul 2025 05:16:57 +0000 (13:16 +0800)
committerWill Deacon <will@kernel.org>
Mon, 21 Jul 2025 13:25:46 +0000 (14:25 +0100)
commitcee686775f9cd4eae31f3c1f7ec24b2048082667
tree1f8eb55514ab538c7346459a7741a43266580e45
parente934464e098ebfc212c72d3022f1d31b88929768
iommu/vt-d: Make iotlb_sync_map a static property of dmar_domain

Commit 12724ce3fe1a ("iommu/vt-d: Optimize iotlb_sync_map for
non-caching/non-RWBF modes") dynamically set iotlb_sync_map. This causes
synchronization issues due to lack of locking on map and attach paths,
racing iommufd userspace operations.

Invalidation changes must precede device attachment to ensure all flushes
complete before hardware walks page tables, preventing coherence issues.

Make domain->iotlb_sync_map static, set once during domain allocation. If
an IOMMU requires iotlb_sync_map but the domain lacks it, attach is
rejected. This won't reduce domain sharing: RWBF and shadowing page table
caching are legacy uses with legacy hardware. Mixed configs (some IOMMUs
in caching mode, others not) are unlikely in real-world scenarios.

Fixes: 12724ce3fe1a ("iommu/vt-d: Optimize iotlb_sync_map for non-caching/non-RWBF modes")
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20250721051657.1695788-1-baolu.lu@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/intel/iommu.c