* [PATCH] iommu/amd: Explicitly disable GAPPI
@ 2026-12-02 12:55 Naveen N Rao (AMD)
0 siblings, 0 replies; only message in thread
From: Naveen N Rao (AMD) @ 2026-12-02 12:55 UTC (permalink / raw)
To: Joerg Roedel, Vasant Hegde, Suravee Suthikulpanit
Cc: iommu, Will Deacon, Robin Murphy, Sairaj Kodilkar,
Sean Christopherson, Paolo Bonzini, kvm
Since commit b03500f03ea0 ("KVM: SVM: Generate GA log IRQs only if the
associated vCPUs is blocking"), running a VM with AVIC enabled and a
passed-through (VFIO) device can result in unexpected host interrupts
with kernel log messages such as:
No irq handler for 99.39
Or worse, the host hangs, or panics with:
Kernel panic - not syncing: Unexpected external interrupt 0x80
AMD IOMMU supports GAPPI mode (Guest APIC Physical Processor Interrupt)
wherein device interrupts for vCPUs that are not running can result in
host interrupts. More specifically, if IRTE[IsRun]=0 and
IRTE[GALogIntr]=0, and if GAPPI mode is enabled, IOMMU sends a host
interrupt to IRTE[destination] with vector number derived from the low
byte of IRTE[GATag] (which KVM populates with the vCPU index).
Prior to the above commit, KVM never cleared IRTE[GALogIntr] and so
device interrupts for non-running vCPUs always resulted in a GALog
entry, with an optional GALog interrupt to the host. Since the above
commit, KVM clears IRTE[GALogIntr] if the vCPU is scheduled out without
blocking, which can trigger GAPPI interrupts if GAPPI mode is enabled.
GAPPI mode is controlled by GAPPIEn in the IOMMU Control register with a
reset value of 0 and Linux never sets it. So, GAPPI mode is not enabled
by default. However, enabling SEV-SNP in the BIOS sets GAPPIEn to 1
resulting in GAPPI mode being enabled on boot.
Fix this by disabling GAPPI mode in iommu_disable(). Disabling GAPPI
mode in kdump path is left for the series that enables GAPPI, since
GAPPI is never otherwise left enabled by Linux kernel today.
Fixes: b03500f03ea0 ("KVM: SVM: Generate GA log IRQs only if the associated vCPUs is blocking")
Cc: stable@vger.kernel.org
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
---
drivers/iommu/amd/amd_iommu_types.h | 1 +
drivers/iommu/amd/init.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
index f98770db0090..31bdcb6b3bbf 100644
--- a/drivers/iommu/amd/amd_iommu_types.h
+++ b/drivers/iommu/amd/amd_iommu_types.h
@@ -180,6 +180,7 @@
#define CONTROL_EPH_EN 45
#define CONTROL_XT_EN 50
#define CONTROL_INTCAPXT_EN 51
+#define CONTROL_GAPPI_EN 55
#define CONTROL_GCR3TRPMODE 58
#define CONTROL_IRTCACHEDIS 59
#define CONTROL_SNPAVIC_EN 61
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 58f63298493b..a31ad62b472b 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -481,6 +481,9 @@ static void iommu_disable(struct amd_iommu *iommu)
iommu_feature_disable(iommu, CONTROL_GALOG_EN);
iommu_feature_disable(iommu, CONTROL_GAINT_EN);
+ /* Disable IOMMU GAPPI */
+ iommu_feature_disable(iommu, CONTROL_GAPPI_EN);
+
/* Disable IOMMU PPR logging */
iommu_feature_disable(iommu, CONTROL_PPRLOG_EN);
iommu_feature_disable(iommu, CONTROL_PPRINT_EN);
base-commit: 10bcc637f7a657725dd8bbcc2b30d027acee6f2d
--
2.56.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 12:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 12:55 [PATCH] iommu/amd: Explicitly disable GAPPI Naveen N Rao (AMD)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox