Skip to content

Commit 923d401

Browse files
committed
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
2 parents 1880df2 + 25b1b75 commit 923d401

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

drivers/iommu/intel/cache.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ static bool cache_tage_match(struct cache_tag *tag, u16 domain_id,
4040
}
4141

4242
/* Assign a cache tag with specified type to domain. */
43-
static int cache_tag_assign(struct dmar_domain *domain, u16 did,
44-
struct device *dev, ioasid_t pasid,
45-
enum cache_tag_type type)
43+
int cache_tag_assign(struct dmar_domain *domain, u16 did, struct device *dev,
44+
ioasid_t pasid, enum cache_tag_type type)
4645
{
4746
struct device_domain_info *info = dev_iommu_priv_get(dev);
4847
struct intel_iommu *iommu = info->iommu;

drivers/iommu/intel/iommu.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3780,8 +3780,17 @@ static void intel_iommu_probe_finalize(struct device *dev)
37803780
!pci_enable_pasid(to_pci_dev(dev), info->pasid_supported & ~1))
37813781
info->pasid_enabled = 1;
37823782

3783-
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev))
3783+
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) {
37843784
iommu_enable_pci_ats(info);
3785+
/* Assign a DEVTLB cache tag to the default domain. */
3786+
if (info->ats_enabled && info->domain) {
3787+
u16 did = domain_id_iommu(info->domain, iommu);
3788+
3789+
if (cache_tag_assign(info->domain, did, dev,
3790+
IOMMU_NO_PASID, CACHE_TAG_DEVTLB))
3791+
iommu_disable_pci_ats(info);
3792+
}
3793+
}
37853794
iommu_enable_pci_pri(info);
37863795
}
37873796

drivers/iommu/intel/iommu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,8 @@ struct cache_tag {
12891289
unsigned int users;
12901290
};
12911291

1292+
int cache_tag_assign(struct dmar_domain *domain, u16 did, struct device *dev,
1293+
ioasid_t pasid, enum cache_tag_type type);
12921294
int cache_tag_assign_domain(struct dmar_domain *domain,
12931295
struct device *dev, ioasid_t pasid);
12941296
void cache_tag_unassign_domain(struct dmar_domain *domain,

drivers/iommu/rockchip-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,6 @@ static int rk_iommu_of_xlate(struct device *dev,
11571157
return -ENOMEM;
11581158

11591159
data->iommu = platform_get_drvdata(iommu_dev);
1160-
data->iommu->domain = &rk_identity_domain;
11611160
dev_iommu_priv_set(dev, data);
11621161

11631162
platform_device_put(iommu_dev);
@@ -1195,6 +1194,8 @@ static int rk_iommu_probe(struct platform_device *pdev)
11951194
if (!iommu)
11961195
return -ENOMEM;
11971196

1197+
iommu->domain = &rk_identity_domain;
1198+
11981199
platform_set_drvdata(pdev, iommu);
11991200
iommu->dev = dev;
12001201
iommu->num_mmu = 0;

0 commit comments

Comments
 (0)