Skip to content

Commit 37f900e

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Prepare for set_dev_pasid callback
The domain_flush_pasid_iotlb() helper function is used to flush the IOTLB entries for a given PASID. Previously, this function assumed that RID2PASID was only used for the first-level DMA translation. However, with the introduction of the set_dev_pasid callback, this assumption is no longer valid. Add a check before using the RID2PASID for PASID invalidation. This check ensures that the domain has been attached to a physical device before using RID2PASID. Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Jacob Pan <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 1547862 commit 37f900e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,8 @@ static void domain_flush_pasid_iotlb(struct intel_iommu *iommu,
14751475
unsigned long flags;
14761476

14771477
spin_lock_irqsave(&domain->lock, flags);
1478-
qi_flush_piotlb(iommu, did, IOMMU_NO_PASID, addr, npages, ih);
1478+
if (!list_empty(&domain->devices))
1479+
qi_flush_piotlb(iommu, did, IOMMU_NO_PASID, addr, npages, ih);
14791480
spin_unlock_irqrestore(&domain->lock, flags);
14801481
}
14811482

0 commit comments

Comments
 (0)