Skip to content

Commit eb5b201

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Avoid unnecessary global IRTE cache invalidation
Some VT-d hardware implementations invalidate all interrupt remapping hardware translation caches as part of SIRTP flow. The VT-d spec adds a ESIRTPS (Enhanced Set Interrupt Remap Table Pointer Support, section 11.4.2 in VT-d spec) capability bit to indicate this. The spec also states in 11.4.4 that hardware also performs global invalidation on all interrupt remapping caches as part of Interrupt Remapping Disable operation if ESIRTPS capability bit is set. This checks the ESIRTPS capability bit and skip software global cache invalidation if it's set. Signed-off-by: Jacob Pan <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Jerry Snitselaar <[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 b722cb3 commit eb5b201

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/iommu/intel/iommu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
/*
147147
* Decoding Capability Register
148148
*/
149+
#define cap_esirtps(c) (((c) >> 62) & 1)
149150
#define cap_fl5lp_support(c) (((c) >> 60) & 1)
150151
#define cap_pi_support(c) (((c) >> 59) & 1)
151152
#define cap_fl1gp_support(c) (((c) >> 56) & 1)

drivers/iommu/intel/irq_remapping.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ static void iommu_set_irq_remapping(struct intel_iommu *iommu, int mode)
494494
* Global invalidation of interrupt entry cache to make sure the
495495
* hardware uses the new irq remapping table.
496496
*/
497-
qi_global_iec(iommu);
497+
if (!cap_esirtps(iommu->cap))
498+
qi_global_iec(iommu);
498499
}
499500

500501
static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
@@ -680,7 +681,8 @@ static void iommu_disable_irq_remapping(struct intel_iommu *iommu)
680681
* global invalidation of interrupt entry cache before disabling
681682
* interrupt-remapping.
682683
*/
683-
qi_global_iec(iommu);
684+
if (!cap_esirtps(iommu->cap))
685+
qi_global_iec(iommu);
684686

685687
raw_spin_lock_irqsave(&iommu->register_lock, flags);
686688

0 commit comments

Comments
 (0)