Skip to content

Commit 57cdb72

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Do not flush IRTE when only updating isRun and destination fields
According to the recent update in the AMD IOMMU spec [1], the IsRun and Destination fields of the Interrupt Remapping Table Entry (IRTE) are not cached by the IOMMU hardware. Therefore, do not issue the INVALIDATE_INTERRUPT_TABLE command when updating IRTE[IsRun] and IRTE[Destination] when IRTE[GuestMode]=1, which should help improve IOMMU AVIC/x2AVIC performance. References: [1] AMD IOMMU Spec Revision (Rev 3.08-PUB) (Link: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/specifications/48882_IOMMU.pdf) Cc: Joao Martins <joao.m.martins@oracle.com> Cc: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Tested-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Link: https://lore.kernel.org/r/20231017144236.8287-1-suravee.suthikulpanit@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 9abe6c5 commit 57cdb72

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

drivers/iommu/amd/iommu.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3111,8 +3111,8 @@ static int alloc_irq_index(struct amd_iommu *iommu, u16 devid, int count,
31113111
return index;
31123112
}
31133113

3114-
static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
3115-
struct irte_ga *irte)
3114+
static int __modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
3115+
struct irte_ga *irte)
31163116
{
31173117
struct irq_remap_table *table;
31183118
struct irte_ga *entry;
@@ -3139,6 +3139,18 @@ static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
31393139

31403140
raw_spin_unlock_irqrestore(&table->lock, flags);
31413141

3142+
return 0;
3143+
}
3144+
3145+
static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
3146+
struct irte_ga *irte)
3147+
{
3148+
bool ret;
3149+
3150+
ret = __modify_irte_ga(iommu, devid, index, irte);
3151+
if (ret)
3152+
return ret;
3153+
31423154
iommu_flush_irt_and_complete(iommu, devid);
31433155

31443156
return 0;
@@ -3822,8 +3834,8 @@ int amd_iommu_update_ga(int cpu, bool is_run, void *data)
38223834
}
38233835
entry->lo.fields_vapic.is_run = is_run;
38243836

3825-
return modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
3826-
ir_data->irq_2_irte.index, entry);
3837+
return __modify_irte_ga(ir_data->iommu, ir_data->irq_2_irte.devid,
3838+
ir_data->irq_2_irte.index, entry);
38273839
}
38283840
EXPORT_SYMBOL(amd_iommu_update_ga);
38293841
#endif

0 commit comments

Comments
 (0)