Skip to content

Commit 3141153

Browse files
Ethsanwilldeacon
authored andcommitted
iommu/vt-d: Fix missing PASID in dev TLB flush with cache_tag_flush_all
The function cache_tag_flush_all() was originally implemented with incorrect device TLB invalidation logic that does not handle PASID, in commit c4d27ff ("iommu/vt-d: Add cache tag invalidation helpers") This causes regressions where full address space TLB invalidations occur with a PASID attached, such as during transparent hugepage unmapping in SVA configurations or when calling iommu_flush_iotlb_all(). In these cases, the device receives a TLB invalidation that lacks PASID. This incorrect logic was later extracted into cache_tag_flush_devtlb_all(), in commit 3297d04 ("iommu/vt-d: Refactor IOTLB and Dev-IOTLB flush for batching") The fix replaces the call to cache_tag_flush_devtlb_all() with cache_tag_flush_devtlb_psi(), which properly handles PASID. Fixes: 4f609db ("iommu/vt-d: Use cache helpers in arch_invalidate_secondary_tlbs") Fixes: 4e589a5 ("iommu/vt-d: Use cache_tag_flush_all() in flush_iotlb_all") Signed-off-by: Ethan Milon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 85cfaac commit 3141153

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

drivers/iommu/intel/cache.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -423,22 +423,6 @@ static void cache_tag_flush_devtlb_psi(struct dmar_domain *domain, struct cache_
423423
domain->qi_batch);
424424
}
425425

426-
static void cache_tag_flush_devtlb_all(struct dmar_domain *domain, struct cache_tag *tag)
427-
{
428-
struct intel_iommu *iommu = tag->iommu;
429-
struct device_domain_info *info;
430-
u16 sid;
431-
432-
info = dev_iommu_priv_get(tag->dev);
433-
sid = PCI_DEVID(info->bus, info->devfn);
434-
435-
qi_batch_add_dev_iotlb(iommu, sid, info->pfsid, info->ats_qdep, 0,
436-
MAX_AGAW_PFN_WIDTH, domain->qi_batch);
437-
if (info->dtlb_extra_inval)
438-
qi_batch_add_dev_iotlb(iommu, sid, info->pfsid, info->ats_qdep, 0,
439-
MAX_AGAW_PFN_WIDTH, domain->qi_batch);
440-
}
441-
442426
/*
443427
* Invalidates a range of IOVA from @start (inclusive) to @end (inclusive)
444428
* when the memory mappings in the target domain have been modified.
@@ -509,7 +493,7 @@ void cache_tag_flush_all(struct dmar_domain *domain)
509493
break;
510494
case CACHE_TAG_DEVTLB:
511495
case CACHE_TAG_NESTING_DEVTLB:
512-
cache_tag_flush_devtlb_all(domain, tag);
496+
cache_tag_flush_devtlb_psi(domain, tag, 0, MAX_AGAW_PFN_WIDTH);
513497
break;
514498
}
515499

0 commit comments

Comments
 (0)