Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sairaj Kodilkar <sarunkod@amd.com>
To: <sashiko-reviews@lists.linux.dev>, <kvm@vger.kernel.org>
Cc: <sarunkod@amd.com>
Subject: Re: [PATCH v5 4/7] iommu/amd: Program guest-mode IRTEs for GAPPI wakeup when IRTE[IsRun] = 0
Date: Mon, 19 Oct 2026 12:01:12 +0530	[thread overview]
Message-ID: <543e1d66-9eb4-4dc4-a136-0723d7717c27@amd.com> (raw)
In-Reply-To: <sashiko-outbox-172378@kernel.org>



On 10/15/2026 12:33 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] iommu/amd: stale gappi_dis hardware flag in IRTE when is_running=true
> --
> 
> commit fed3ee87aa05f53cbc2ccd8dd9c45c2a8ad8bb44
> Author: Sairaj Kodilkar <sarunkod@amd.com>
> 
> iommu/amd: Program guest-mode IRTEs for GAPPI wakeup when IRTE[IsRun] = 0
> 
> This commit enables programming the IRTE for Guest APIC Physical Processor
> Interrupt (GAPPI) wakeup when a vCPU is not running. It allows suppressing
> these interrupts using the IRTE[GAPPIDis] bit when KVM does not request a
> wakeup interrupt.
> 
>> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
>> index c0eec32ee3cb6..7ceb6bf508f03 100644
>> --- a/drivers/iommu/amd/iommu.c
>> +++ b/drivers/iommu/amd/iommu.c
>> @@ -4004,8 +4004,18 @@ static void __amd_iommu_update_ga(struct irte_ga *entry, int apicid,
>>  		entry->lo.fields_vapic.is_run = true;
>>  		entry->lo.fields_vapic.ga_log_intr = false;
> 
> [Severity: Low]
> When a vCPU transitions to the running state, ga_log_intr is explicitly
> cleared here. Does gappi_dis also need to be cleared?
> 
> If a vCPU transitions to is_running=false with wakeup_intr=false, 
> gappi_dis can be set to 1 in the newly added else branch below. When the 
> vCPU transitions back to is_running=true, this code path is taken, but it 
> leaves the gappi_dis bit stale.
> 
> Could this cause unintended interrupt suppression or hardware state mismatches 
> if the IOMMU hardware evaluates the bit unexpectedly?
> 

The gappi_dis bit is evaluated only when is_run is false and is
otherwise ignored, hence it is safe to not assign gappi_dis=1 when vCPU
transitions to running state.

Thanks
Sairaj

>>  	} else {
>> -		entry->lo.fields_vapic.is_run = false;
>> -		entry->lo.fields_vapic.ga_log_intr = wakeup_intr;
>> +		if (amd_iommu_gappi) {
>> +			entry->lo.fields_vapic.gappi_dis = !wakeup_intr &&
>> +						check_feature2(FEATURE_GAPPIDISSUP);
>> +			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);
>> +		} else {
>> +			entry->lo.fields_vapic.is_run = false;
>> +			entry->lo.fields_vapic.ga_log_intr = wakeup_intr;
>> +		}
>>  	}
>>  }
> 


  reply	other threads:[~2026-10-19  6:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  6:45 [PATCH v5 0/7] Add support for AMD IOMMU GAPPI Sairaj Kodilkar
2026-10-15  6:45 ` [PATCH v5 1/7] iommu/amd: KVM: SVM: Rename cpu to apicid in IOMMU interface Sairaj Kodilkar
2026-10-15  6:45 ` [PATCH v5 2/7] iommu/amd: KVM: SVM: Rename ga_log_intr to wakeup_intr " Sairaj Kodilkar
2026-10-15  6:45 ` [PATCH v5 3/7] iommu/amd: KVM: SVM: Add explicit vCPU running state to " Sairaj Kodilkar
2026-10-15  6:45 ` [PATCH v5 4/7] iommu/amd: Program guest-mode IRTEs for GAPPI wakeup when IRTE[IsRun] = 0 Sairaj Kodilkar
2026-10-15  7:03   ` sashiko-bot
2026-10-19  6:31     ` Sairaj Kodilkar [this message]
2026-10-16  4:54   ` kernel test robot
2026-10-15  6:45 ` [PATCH v5 5/7] KVM: VMX: Factor out wakeup list handling code to KVM Sairaj Kodilkar
2026-10-15  7:00   ` sashiko-bot
2026-10-19  6:35     ` Sairaj Kodilkar
2026-10-15  6:45 ` [PATCH v5 6/7] KVM: SVM: Add support for AMD IOMMU Guest APIC Physical Processor Interrupt (GAPPI) Sairaj Kodilkar
2026-10-15  7:05   ` sashiko-bot
2026-10-19  7:44     ` Sairaj Kodilkar
2026-10-15  6:45 ` [PATCH v5 7/7] iommu/amd: Provide kernel command line option to enable GAPPI Sairaj Kodilkar
2026-10-15  7:08   ` sashiko-bot
2026-10-21  8:57     ` Sairaj Kodilkar
2026-10-22 12:35     ` Sairaj Kodilkar
2026-10-16  8:23   ` kernel test robot

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=543e1d66-9eb4-4dc4-a136-0723d7717c27@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox