From: Sairaj Kodilkar <sarunkod@amd.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <sarunkod@amd.com>, <kvm@vger.kernel.org>
Subject: Re: [RFC PATCH 2/5] iommu/amd: Configure IRTE to use the GAPPI for posted interrupts
Date: Tue, 30 Jun 2026 11:20:42 +0530 [thread overview]
Message-ID: <ff1cf59b-65d7-4c85-a813-a81945f3a8a3@amd.com> (raw)
In-Reply-To: <20260626112941.EC3D51F000E9@smtp.kernel.org>
On 6/26/2026 4:59 PM, sashiko-bot@kernel.org wrote:
> [You don't often get email from sashiko-bot@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] `amd_iommu_update_ga` dynamically modifies the `gappi_dis` field in the IRTE without issuing an IOMMU invalidation, which may result in permanently lost wakeups.
> --
>
> commit f265b23208b1df21d27bc13bee3b5f94ce45d71c
> Author: Sairaj Kodilkar <sarunkod@amd.com>
>
> iommu/amd: Configure IRTE to use the GAPPI for posted interrupts
>
> This commit updates the AMD IOMMU driver to support Guest APIC Posted
> Interrupts (GAPPI). It configures the Interrupt Remapping Table Entry (IRTE)
> for wakeups using the reserved POSTED_INTR_WAKEUP_VECTOR when the guest
> is not running.
>
>> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
>> --- a/drivers/iommu/amd/iommu.c
>> +++ b/drivers/iommu/amd/iommu.c
> [ ... ]
>> @@ -3969,9 +3969,18 @@ static void __amd_iommu_update_ga(struct irte_ga *entry, int apicid, int flags)
>> entry->lo.fields_vapic.is_run = true;
>> entry->lo.fields_vapic.ga_log_intr = false;
>> } else {
>> - entry->lo.fields_vapic.is_run = false;
>> - entry->lo.fields_vapic.ga_log_intr = !!(flags &
>> - AMD_IOMMU_FLAG_POSTED_INTR);
>> + bool posted_intr = !!(flags & AMD_IOMMU_FLAG_POSTED_INTR);
>> + if (amd_iommu_gappi) {
>> + entry->lo.fields_vapic.gappi_dis = !posted_intr &&
>> + check_feature2(FEATURE_GAPPIDISSUP);
> [Severity: Medium]
> Does this code need to issue an IOMMU cache invalidation after modifying
> gappi_dis?
>
> Since __amd_iommu_update_ga() is a fast-path update function, it appears
> there is no subsequent IOMMU cache flush when gappi_dis changes. If KVM
> schedules out a vCPU (setting gappi_dis = 1) and then the vCPU blocks
> (setting gappi_dis = 0), hardware that caches the gappi_dis bit might not
> observe the transition back to 0.
>
> Could this caching behavior lead to permanently dropped wakeup interrupts
> and indefinite vCPU hangs?
The gappi_dis bit is not cached. See the IOMMU spec [1] section
2.2.5.2 Interrupt Virtualization Tables with Guest Virtual APIC Enabled
"
When virtual interrupts are enabled by setting MMIO Offset 0018h[GAEn]
and IRTE[GuestMode=1],
the fields IRTE[IsRun], IRTE[Destination], IRTE[GALogIntr],
IRTE[GAPPIDis], and, if present,
IRTE[GATag] are not cached by the IOMMU. Modifications to these fields
do not require an
invalidation of the Interrupt Remapping Table.
"
Hence we do not need to flush the IRTE after modifying gappi_dis bit.
[1] https://docs.amd.com/v/u/en-US/48882_3.11_IOMMU_PUB
Thanks
Sairaj
>> + entry->lo.fields_vapic.is_run = false;
>> + entry->lo.fields_vapic.destination =
>> + APICID_TO_IRTE_DEST_LO(apicid);
>> + entry->hi.fields.destination = APICID_TO_IRTE_DEST_HI(apicid);
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260626105906.14577-1-sarunkod@amd.com?part=2
next prev parent reply other threads:[~2026-06-30 5:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 10:59 [RFC PATCH 0/5] Add support for AMD IOMMU GAPPI Sairaj Kodilkar
2026-06-26 10:59 ` [RFC PATCH 1/5] iommu/amd: kvm/svm: Improve API between SVM and AMD IOMMU Sairaj Kodilkar
2026-06-26 10:59 ` [RFC PATCH 2/5] iommu/amd: Configure IRTE to use the GAPPI for posted interrupts Sairaj Kodilkar
2026-06-26 11:29 ` sashiko-bot
2026-06-30 5:50 ` Sairaj Kodilkar [this message]
2026-06-26 10:59 ` [RFC PATCH 3/5] kvm/svm: Introduce per-CPU lock and wakeup queue Sairaj Kodilkar
2026-06-26 10:59 ` [RFC PATCH 4/5] kvm/svm: Update the per-CPU wakeup-list during vCPU load and unload Sairaj Kodilkar
2026-06-26 11:25 ` sashiko-bot
2026-07-01 8:18 ` Sairaj Kodilkar
2026-06-26 10:59 ` [RFC PATCH 5/5] iommu/amd: Provide kernel command line option to enable GAPPI Sairaj Kodilkar
2026-06-26 11:25 ` sashiko-bot
2026-07-01 9:25 ` 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=ff1cf59b-65d7-4c85-a813-a81945f3a8a3@amd.com \
--to=sarunkod@amd.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.