iommu/vt-d: Split intel_iommu_enforce_cache_coherency()
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 14 Jul 2025 04:50:25 +0000 (12:50 +0800)
committerWill Deacon <will@kernel.org>
Mon, 14 Jul 2025 10:18:04 +0000 (11:18 +0100)
commit0fa6f0893466c9fc0a149d215cfcee760e41cb00
tree5042b7ab7465650c936e6b618f9a1cf27fad8a28
parentb33125296b5047115469b8a3b74c0fdbf4976548
iommu/vt-d: Split intel_iommu_enforce_cache_coherency()

First Stage and Second Stage have very different ways to deny
no-snoop. The first stage uses the PGSNP bit which is global per-PASID so
enabling requires loading new PASID entries for all the attached devices.

Second stage uses a bit per PTE, so enabling just requires telling future
maps to set the bit.

Since we now have two domain ops we can have two functions that can
directly code their required actions instead of a bunch of logic dancing
around use_first_level.

Combine domain_set_force_snooping() into the new functions since they are
the only caller.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/6-v3-dbbe6f7e7ae3+124ffe-vtd_prep_jgg@nvidia.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20250714045028.958850-9-baolu.lu@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/intel/iommu.c