Skip to content

Commit 0f5432a

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Omit devTLB invalidation requests when TES=0
The latest VT-d spec indicates that when remapping hardware is disabled (TES=0 in Global Status Register), upstream ATS Invalidation Completion requests are treated as UR (Unsupported Request). Consequently, the spec recommends in section 4.3 Handling of Device-TLB Invalidations that software refrain from submitting any Device-TLB invalidation requests when address remapping hardware is disabled. Verify address remapping hardware is enabled prior to submitting Device- TLB invalidation requests. Fixes: 792fb43 ("iommu/vt-d: Enable Intel IOMMU scalable mode by default") Signed-off-by: Lu Baolu <[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 e645c20 commit 0f5432a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/iommu/intel/dmar.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,15 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid,
15221522
{
15231523
struct qi_desc desc;
15241524

1525+
/*
1526+
* VT-d spec, section 4.3:
1527+
*
1528+
* Software is recommended to not submit any Device-TLB invalidation
1529+
* requests while address remapping hardware is disabled.
1530+
*/
1531+
if (!(iommu->gcmd & DMA_GCMD_TE))
1532+
return;
1533+
15251534
if (mask) {
15261535
addr |= (1ULL << (VTD_PAGE_SHIFT + mask - 1)) - 1;
15271536
desc.qw1 = QI_DEV_IOTLB_ADDR(addr) | QI_DEV_IOTLB_SIZE;
@@ -1587,6 +1596,15 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid,
15871596
unsigned long mask = 1UL << (VTD_PAGE_SHIFT + size_order - 1);
15881597
struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0};
15891598

1599+
/*
1600+
* VT-d spec, section 4.3:
1601+
*
1602+
* Software is recommended to not submit any Device-TLB invalidation
1603+
* requests while address remapping hardware is disabled.
1604+
*/
1605+
if (!(iommu->gcmd & DMA_GCMD_TE))
1606+
return;
1607+
15901608
desc.qw0 = QI_DEV_EIOTLB_PASID(pasid) | QI_DEV_EIOTLB_SID(sid) |
15911609
QI_DEV_EIOTLB_QDEP(qdep) | QI_DEIOTLB_TYPE |
15921610
QI_DEV_IOTLB_PFSID(pfsid);

0 commit comments

Comments
 (0)