From: Sairaj Kodilkar <sarunkod@amd.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
"Joerg Roedel (AMD)" <joro@8bytes.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Robin Murphy" <robin.murphy@arm.com>,
Sairaj Kodilkar <sarunkod@amd.com>,
"Sean Christopherson" <seanjc@google.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Thomas Gleixner <tglx@kernel.org>,
"Vasant Hegde" <vasant.hegde@amd.com>,
Will Deacon <will@kernel.org>, <iommu@lists.linux.dev>,
<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<x86@kernel.org>
Subject: [RFC PATCH v2 0/5] Add support for AMD IOMMU GAPPI
Date: Wed, 8 Jul 2026 14:44:03 +0530 [thread overview]
Message-ID: <20260708091408.12106-1-sarunkod@amd.com> (raw)
Introduction
============
On newer generations of AMD processors, the IOMMU AVIC/x2AVIC feature can be
enabled using the Guest APIC Physical Processor Interrupt (GAPPI) mode, which is
an alternative for handling AVIC guest interrupts to non-running vCPUs
(i.e., IRTE[IsRun]=0).
With GAPPI enabled, the IOMMU delivers a posted interrupt to the physical CPU
described by the IRTE destination fields, with the wake-up vector in ga_tag.
See section 2.2.5.4, Guest APIC Physical Processor Interrupt, of the AMD I/O
Virtualization Technology (IOMMU) Specification [1] for more details on GAPPI.
Implementation Details
======================
GAPPI reuses the posted-interrupt wake-up path introduced for Intel VMX: the
IOMMU sets ga_tag to POSTED_INTR_WAKEUP_VECTOR, and SVM registers the handler
with kvm_set_posted_intr_wakeup_handler().
SVM maintains a per-CPU list of vCPUs that are scheduled out. When a CPU
receives a GAPPI interrupt from the IOMMU, the handler walks that list, finds
vCPUs with a pending IRR bit, and wakes them.
The IRTE destination is chosen as the last host CPU where the vCPU ran, to
reduce unnecessary VMEXITs from GAPPI deliveries.
The first patch refactors the SVM/IOMMU interface: apicid (formerly cpu)
denotes the running vCPU's host APIC ID or, when the vCPU is scheduled out,
the APIC ID of the pCPU that hosts it on its GAPPI wake-up list. Explicit
running and posted-interrupt flags replace the old ga_log_intr boolean, since
apicid no longer implies vCPU state on its own.
Advantages
==========
With GALOG, the IOMMU can generate only a single interrupt via MMIO offset
0x180h (XT IOMMU GA Log Interrupt Control Register) and appends vCPU
information to the GALOG buffer. The hypervisor must scan this list to wake
the vCPUs, which can introduce significant latency and even cause buffer
overflows at high interrupt rates.
GAPPI avoids this problem by distributing posted interrupts across multiple
CPUs.
[1] https://docs.amd.com/v/u/en-US/48882_3.11_IOMMU_PUB
-------
Changes since V1:
https://lore.kernel.org/all/20260626105906.14577-1-sarunkod@amd.com/
Patch4
- Disable interrupts while holding wakeup list lock inside [sashiko]
avic_add_vcpu_to_gappi_wakeup_list and avic_remove_vcpu_from_gappi_wakeup_list
- Unregister posted_intr_wakeup_handler during module unload [sashiko]
Patch 5
- Disable GAPPI feature during kexec and suspend path [sashiko]
-------
Sairaj Kodilkar (5):
iommu/amd: kvm/svm: Improve API between SVM and AMD IOMMU
iommu/amd: Configure IRTE to use the GAPPI for posted interrupts
kvm/svm: Introduce per-CPU lock and wakeup queue
kvm/svm: Update the per-CPU wakeup-list during vCPU load and unload
iommu/amd: Provide kernel command line option to enable GAPPI
next reply other threads:[~2026-07-08 9:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 9:14 Sairaj Kodilkar [this message]
2026-07-08 9:14 ` [RFC PATCH v2 1/5] iommu/amd: kvm/svm: Improve API between SVM and AMD IOMMU Sairaj Kodilkar
2026-07-08 13:36 ` Sean Christopherson
2026-07-09 6:39 ` Sairaj Kodilkar
2026-07-10 17:19 ` Sean Christopherson
2026-07-08 9:14 ` [RFC PATCH v2 2/5] iommu/amd: Configure IRTE to use the GAPPI for posted interrupts Sairaj Kodilkar
2026-07-08 9:14 ` [RFC PATCH v2 3/5] kvm/svm: Introduce per-CPU lock and wakeup queue Sairaj Kodilkar
2026-07-08 13:36 ` Sean Christopherson
2026-07-08 9:14 ` [RFC PATCH v2 4/5] kvm/svm: Update the per-CPU wakeup-list during vCPU load and unload Sairaj Kodilkar
2026-07-08 13:38 ` Sean Christopherson
2026-07-08 9:14 ` [RFC PATCH v2 5/5] iommu/amd: Provide kernel command line option to enable GAPPI Sairaj Kodilkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260708091408.12106-1-sarunkod@amd.com \
--to=sarunkod@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=robin.murphy@arm.com \
--cc=seanjc@google.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tglx@kernel.org \
--cc=vasant.hegde@amd.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox