Skip to content

Commit 98aeb4e

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Do not Invalidate IRT when IRTE caching is disabled
With the Interrupt Remapping Table cache disabled, there is no need to issue invalidate IRT and wait for its completion. Therefore, add logic to bypass the operation. Reviewed-by: Jerry Snitselaar <[email protected]> Suggested-by: Joao Martins <[email protected]> Signed-off-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 6641903 commit 98aeb4e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,12 +1266,24 @@ static void amd_iommu_flush_irt_all(struct amd_iommu *iommu)
12661266
u32 devid;
12671267
u16 last_bdf = iommu->pci_seg->last_bdf;
12681268

1269+
if (iommu->irtcachedis_enabled)
1270+
return;
1271+
12691272
for (devid = 0; devid <= last_bdf; devid++)
12701273
iommu_flush_irt(iommu, devid);
12711274

12721275
iommu_completion_wait(iommu);
12731276
}
12741277

1278+
static void iommu_flush_irt_and_complete(struct amd_iommu *iommu, u16 devid)
1279+
{
1280+
if (iommu->irtcachedis_enabled)
1281+
return;
1282+
1283+
iommu_flush_irt(iommu, devid);
1284+
iommu_completion_wait(iommu);
1285+
}
1286+
12751287
void iommu_flush_all_caches(struct amd_iommu *iommu)
12761288
{
12771289
if (iommu_feature(iommu, FEATURE_IA)) {
@@ -3030,8 +3042,7 @@ static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
30303042

30313043
raw_spin_unlock_irqrestore(&table->lock, flags);
30323044

3033-
iommu_flush_irt(iommu, devid);
3034-
iommu_completion_wait(iommu);
3045+
iommu_flush_irt_and_complete(iommu, devid);
30353046

30363047
return 0;
30373048
}
@@ -3050,8 +3061,7 @@ static int modify_irte(struct amd_iommu *iommu,
30503061
table->table[index] = irte->val;
30513062
raw_spin_unlock_irqrestore(&table->lock, flags);
30523063

3053-
iommu_flush_irt(iommu, devid);
3054-
iommu_completion_wait(iommu);
3064+
iommu_flush_irt_and_complete(iommu, devid);
30553065

30563066
return 0;
30573067
}
@@ -3069,8 +3079,7 @@ static void free_irte(struct amd_iommu *iommu, u16 devid, int index)
30693079
iommu->irte_ops->clear_allocated(table, index);
30703080
raw_spin_unlock_irqrestore(&table->lock, flags);
30713081

3072-
iommu_flush_irt(iommu, devid);
3073-
iommu_completion_wait(iommu);
3082+
iommu_flush_irt_and_complete(iommu, devid);
30743083
}
30753084

30763085
static void irte_prepare(void *entry,

0 commit comments

Comments
 (0)