IOMMU Fixes for Linux v6.16-rc4

Including:
 
 	- Rockchip driver: Fix infinite loop caused by probing race condition.
 
 	- Intel VT-d: Assign devtlb cache tag on ATS enablement
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAmhn4zQACgkQK/BELZcB
 GuN9kRAApShL18pW17yDWuOIbOoRL6Rqydjor/KoU4LZQH8Xwjj+i0qbkNCkr+l/
 S9k0bSa43doDP5SIVMSqJho5AAGjU7eRBL17rubWFgNUpEOWJSxt7DGOgjzNW3gM
 4XbfOGSHx4AiuOh2VHIrDr9koSgDt01pQjB4gNJvVKi4/21kiSCVcRDxM5GO6xVY
 0vbCKLh/y/D4ZV20xKqZZxqhyfmQk84wjHz5CGciaGb0M4bRXvNrRoIqPUvy4fOq
 RbTahPH+OsuUmaY7Lt9BGrEAUtezv2ETWhXCNG7ZNIzte9SEPwwUFkovyDd7IR2Q
 58dgnkE50e/MBzNC2tR7GlDkXUpwLQ6D44mjp322SLWy8iAxIdzOKPMOkKpQVrTE
 WPVN9dSllDTJSZgeJc+lMMPgv1hwxUywPRkzX5TYHzCxR/B/J4G+H04eNqc5nxN/
 +hB9kwwdDupnqmFeJHso1ztFbEVmQUrB3OSUnG3qfLArDi2Ov/AddCZKt6M01eBU
 uSjstr6Rnok/UR66nwKUvbWmXzdJZbb7VLiOA9vHEk3ECD3hxgP66WAv/HdzT6m0
 ZnJ1t9fmhN24yLwU5s1soqU/xHutOML7RdgoWlXX95nJt+5H93kN5yCpG2sXCELF
 Mf4uRP39JbKLAfyIYH3yEG0ULdNqoj+j0/WUmjXy+tG6u8U3hPU=
 =0gQG
 -----END PGP SIGNATURE-----

Merge tag 'iommu-fixes-v6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux

Pull iommu fixes from Joerg Roedel:

 - Rockchip: fix infinite loop caused by probing race condition

 - Intel VT-d: assign devtlb cache tag on ATS enablement

* tag 'iommu-fixes-v6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux:
  iommu/vt-d: Assign devtlb cache tag on ATS enablement
  iommu/rockchip: prevent iommus dead loop when two masters share one IOMMU
This commit is contained in:
Linus Torvalds 2025-07-04 09:43:08 -07:00
commit 923d401238
4 changed files with 16 additions and 5 deletions

View File

@ -40,9 +40,8 @@ static bool cache_tage_match(struct cache_tag *tag, u16 domain_id,
} }
/* Assign a cache tag with specified type to domain. */ /* Assign a cache tag with specified type to domain. */
static int cache_tag_assign(struct dmar_domain *domain, u16 did, int cache_tag_assign(struct dmar_domain *domain, u16 did, struct device *dev,
struct device *dev, ioasid_t pasid, ioasid_t pasid, enum cache_tag_type type)
enum cache_tag_type type)
{ {
struct device_domain_info *info = dev_iommu_priv_get(dev); struct device_domain_info *info = dev_iommu_priv_get(dev);
struct intel_iommu *iommu = info->iommu; struct intel_iommu *iommu = info->iommu;

View File

@ -3780,8 +3780,17 @@ static void intel_iommu_probe_finalize(struct device *dev)
!pci_enable_pasid(to_pci_dev(dev), info->pasid_supported & ~1)) !pci_enable_pasid(to_pci_dev(dev), info->pasid_supported & ~1))
info->pasid_enabled = 1; info->pasid_enabled = 1;
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
iommu_enable_pci_ats(info); iommu_enable_pci_ats(info);
/* Assign a DEVTLB cache tag to the default domain. */
if (info->ats_enabled && info->domain) {
u16 did = domain_id_iommu(info->domain, iommu);
if (cache_tag_assign(info->domain, did, dev,
IOMMU_NO_PASID, CACHE_TAG_DEVTLB))
iommu_disable_pci_ats(info);
}
}
iommu_enable_pci_pri(info); iommu_enable_pci_pri(info);
} }

View File

@ -1289,6 +1289,8 @@ struct cache_tag {
unsigned int users; unsigned int users;
}; };
int cache_tag_assign(struct dmar_domain *domain, u16 did, struct device *dev,
ioasid_t pasid, enum cache_tag_type type);
int cache_tag_assign_domain(struct dmar_domain *domain, int cache_tag_assign_domain(struct dmar_domain *domain,
struct device *dev, ioasid_t pasid); struct device *dev, ioasid_t pasid);
void cache_tag_unassign_domain(struct dmar_domain *domain, void cache_tag_unassign_domain(struct dmar_domain *domain,

View File

@ -1157,7 +1157,6 @@ static int rk_iommu_of_xlate(struct device *dev,
return -ENOMEM; return -ENOMEM;
data->iommu = platform_get_drvdata(iommu_dev); data->iommu = platform_get_drvdata(iommu_dev);
data->iommu->domain = &rk_identity_domain;
dev_iommu_priv_set(dev, data); dev_iommu_priv_set(dev, data);
platform_device_put(iommu_dev); platform_device_put(iommu_dev);
@ -1195,6 +1194,8 @@ static int rk_iommu_probe(struct platform_device *pdev)
if (!iommu) if (!iommu)
return -ENOMEM; return -ENOMEM;
iommu->domain = &rk_identity_domain;
platform_set_drvdata(pdev, iommu); platform_set_drvdata(pdev, iommu);
iommu->dev = dev; iommu->dev = dev;
iommu->num_mmu = 0; iommu->num_mmu = 0;