From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Melody Wang" <huibo.wang@amd.com>, x86@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
"Tom Lendacky" <thomas.lendacky@amd.com>
Subject: Re: [PATCH v4 5/7] x86/sev: Register the guest with the SVSM APIC protocol
Date: Thu, 15 Oct 2026 08:04:03 +0200 [thread overview]
Message-ID: <ea212c71-90c0-4474-860f-3b1b33f89932@app.fastmail.com> (raw)
In-Reply-To: <061fef95-1a27-42e8-86e8-23172ff2425c@amd.com>
On Thu, 15 Oct 2026, at 05:56, Melody Wang wrote:
> Hi Ard,
>
> On 10/14/26 2:43 AM, Ard Biesheuvel wrote:
>> I'm struggling to follow the logic here: doesn't this attempt to locate
>> the protocol on non-SEV/SNP systems as well?
>
> Alternate Injection is only working for SEV-SNP guest.
>
>> Wouldn't it be sufficient to do
>>
>> if (!snp_vmpl ||
>> !(sev_get_status() & MSR_AMD64_SNP_ALTERNATE_INJ))
>> return 0;
>>
>> and leave the early_is_sevsnp_guest() check alone?
>>
>
> The thing is, snp_vmpl hasn't been initialized here yet. We read here a
> 0. So I need early_is_sevsnp_guest() to initialize it to U8_MAX so that
> I know that there's an SVSM present.
>
> Then I can enable AltInj.
>
OK.
But there are three conditions where there is no point in checking
whether the protocol exists:
- early_is_sevsnp_guest() -> false
- snp_vmpl == 0
- (sev_get_status() & MSR_AMD64_SNP_ALTERNATE_INJ) == 0
So this should be
>> if (!early_is_sevsnp_guest() || !snp_vmpl ||
>> !(sev_get_status() & MSR_AMD64_SNP_ALTERNATE_INJ))
>> return 0;
then?
Btw please don't use bare '1' and '2' as error codes, especially
since you don't actually check the value - just use a bool instead.
next prev parent reply other threads:[~2026-10-15 6:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 17:50 [PATCH v4 0/7] Alternate Injection: Secure Interrupt Delivery for SEV-SNP Guests - Guest Support Melody Wang
2026-10-13 17:50 ` [PATCH v4 1/7] x86/sev: Add support for Alternate Injection Melody Wang
2026-10-13 17:50 ` [PATCH v4 2/7] x86/apic: Add an SVSM APIC driver Melody Wang
2026-10-13 17:50 ` [PATCH v4 3/7] x86/sev: Route unsupported APIC register accesses to the hypervisor APIC emulation Melody Wang
2026-10-13 17:50 ` [PATCH v4 4/7] x86/sev: Add a function to contain all SEV-specific setup operations Melody Wang
2026-10-13 17:50 ` [PATCH v4 5/7] x86/sev: Register the guest with the SVSM APIC protocol Melody Wang
2026-10-14 9:43 ` Ard Biesheuvel
2026-10-15 3:56 ` Melody Wang
2026-10-15 6:04 ` Ard Biesheuvel [this message]
2026-10-13 17:50 ` [PATCH v4 6/7] x86/sev: Allow the guest to configure interrupt vectors for the hypervisor Melody Wang
2026-10-13 17:50 ` [PATCH v4 7/7] x86/sev: Indicate that Alternate Injection is supported in the guest Melody Wang
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=ea212c71-90c0-4474-860f-3b1b33f89932@app.fastmail.com \
--to=ardb@kernel.org \
--cc=huibo.wang@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
--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
all inboxes | Powered by JetHome®