iommu/amd: Interrupt handling improvements
Subsystems (2)
Vasant Hegde
maintainerv2 cover iommu/amd: Interrupt handling improvements
AMD IOMMU has three different logs/interrupts (Event, PPR and GA). Currently, the IOMMU driver consolidates interrupts for all three logs to a single interrupt. This could become a bottleneck when enable GA and PPR logs simultaneously. Hence separate these interrupt to prevent potential performance issue.
This series applies on top of PPR overflow support patchset [1].
[1] https://lore.kernel.org/linux-iommu/[email protected]/
Changes from v1 -> v2:
- Moved GA log interrupt under CONFIG_IRQ_REMAP
- Updated patch description
V1 : https://lore.kernel.org/linux-iommu/[email protected]/
Vasant Hegde (2):
iommu/amd: Refactor IOMMU interrupt handling logic for Event, PPR, and GA logs iommu/amd: Enable separate interrupt for PPR and GA log
drivers/iommu/amd/amd_iommu.h | 3 + drivers/iommu/amd/amd_iommu_types.h | 9 +++ drivers/iommu/amd/init.c | 50 +++++++++++---- drivers/iommu/amd/iommu.c | 95 ++++++++++++++++------------- 4 files changed, 101 insertions(+), 56 deletions(-)
Signature · 1 line
2.31.1
Vasant Hegde
maintainerPATCH v2 1/2 iommu/amd: Refactor IOMMU interrupt handling logic for Event, PPR, and GA logs
The AMD IOMMU has three log buffers (i.e. Event, PPR, and GA). The IOMMU driver processes these log entries when it receive an IOMMU interrupt. Then, it needs to clear the corresponding interrupt status bits. Also, when an overflow occurs, it needs to handle the log overflow by clearing the specific overflow status bit and restart the log.
Since, logic for handling these logs is the same, refactor the code into a helper function called amd_iommu_handle_irq(), which handles the steps described. Then, reuse it for all types of log.
--- drivers/iommu/amd/amd_iommu.h | 3 ++ drivers/iommu/amd/iommu.c | 95 +++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 44 deletions(-)
drivers/iommu/amd/amd_iommu.h +3 -0
@@ -12,6 +12,9 @@#include "amd_iommu_types.h" irqreturn_t amd_iommu_int_thread (int irq,void *data); +irqreturn_t amd_iommu_int_thread_evtlog (int irq,void *data); +irqreturn_t amd_iommu_int_thread_pprlog (int irq,void *data); +irqreturn_t amd_iommu_int_thread_galog (int irq,void *data);irqreturn_t amd_iommu_int_handler (int irq,void *data);void amd_iommu_apply_erratum_63 (struct amd_iommu *iommu,u16 devid);void amd_iommu_restart_event_logging (struct amd_iommu *iommu);
drivers/iommu/amd/iommu.c +51 -44
114 lines not on this page · raw message
Signature · 1 line
2.31.1
Vasant Hegde
maintainerPATCH v2 2/2 iommu/amd: Enable separate interrupt for PPR and GA log
In reply to Vasant HegdeAMD IOMMU has three log buffers (i.e. Event, PPR, and GA). These logs can be configured to generate different interrupts when an entry is inserted into a log buffer.
However, current implementation share single interrupt to handle all three logs. With increasing usages of the GA (for IOMMU AVIC) and PPR logs (for IOMMUv2 APIs and SVA), interrupt sharing could potentially become performance bottleneck.
Hence, separate IOMMU interrupt into use three separate vectors and irq threads with corresponding name, which will be displayed in the /proc/interrupts as "AMD-Vi<x>-[Evt/PPR/GA]", where "x" is an IOMMU id.
Note that this patch changes interrupt handling only in IOMMU x2apic mode (MMIO 0x18[IntCapXTEn]=1). In legacy mode it will continue to use single MSI interrupt.
--- drivers/iommu/amd/amd_iommu_types.h | 9 ++++++ drivers/iommu/amd/init.c | 50 ++++++++++++++++++++++------- 2 files changed, 47 insertions(+), 12 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +9 -0
@@ -705,12 +705,21 @@ struct amd_iommu {/* event buffer virtual address */ u8 *evt_buf; +/* Name for event log interrupt */ +unsigned char evt_irq_name[16 ]; +/* Base of the PPR log, if present */ u8 *ppr_log; +/* Name for PPR log interrupt */ +unsigned char ppr_irq_name[16 ]; +/* Base of the GA log, if present */ u8 *ga_log; +/* Name for GA log interrupt */ +unsigned char ga_irq_name[16 ]; +/* Tail of the GA log, if present */ u8 *ga_log_tail;
drivers/iommu/amd/init.c +38 -12
92 lines not on this page · raw message
Signature · 1 line
2.31.1