From: Melody Wang <huibo.wang@amd.com>
To: Ard Biesheuvel <ardb@kernel.org>, x86@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [PATCH v2 6/8] x86/sev: Register the guest with the SVSM APIC protocol
Date: Wed, 16 Sep 2026 11:45:27 -0700 [thread overview]
Message-ID: <b0927c73-9171-40e2-9d1a-3dcb2da1c839@amd.com> (raw)
In-Reply-To: <e624a245-e699-40d5-9948-aa77da5c44e1@app.fastmail.com>
Hi Ard,
On 9/15/26 12:44 AM, Ard Biesheuvel wrote:
> So please add it to the EFI stub, and code it against the boot services
> (efi_err() for error messages, efi_exit() when aborting and returning to
> the firmware, etc). Implementing this in a hybrid manner seems entirely
> unnecessary.
I moved sev_prepare() into the EFI stub, and I wrote a wrapper for
registering Alternate Injection in the EFI stub but kept the code in
compressed, otherwise I have to export early_is_sevsnp_guest(),
boot_svsm_caa_pa, and svsm_call_msr_protocol() so that it builds.
How about this below:
This is in the stub:
static bool sev_prepare(void)
{
u64 unsupported;
unsupported = snp_get_unsupported_features(sev_get_status());
if (unsupported) {
efi_err("Unsupported SEV-SNP features detected: 0x%llx\n",
unsupported);
return true;
}
register_alternate_injection();
return false;
}
and the stub calls this function:
+void register_alternate_injection(void)
+{
+ if (early_is_sevsnp_guest() && snp_vmpl) {
+ struct svsm_call call = {};
+ int ret;
+
+ if (!(sev_get_status() & MSR_AMD64_SNP_ALTERNATE_INJ))
+ return;
+
+ call.caa = (struct svsm_ca *)boot_svsm_caa_pa;
+ call.rax = SVSM_APIC_CALL(SVSM_APIC_CONFIG_EMULATION);
+ call.rcx = SVSM_AI_REGISTER;
+
+ ret = svsm_call_msr_protocol(&call);
+ if (ret)
+ sev_es_terminate(SEV_TERM_SET_LINUX,
GHCB_TERM_ALT_INJ_FAIL);
+ }
+}
which is kept in sev.c to avoid cross-dependencies.
I can send it as patches too if it is easier to review this way.
--
Thanks,
Melody
next prev parent reply other threads:[~2026-09-16 18:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 0:57 [PATCH v2 0/8] Alternate Injection: Secure Interrupt Delivery for SEV-SNP Guests - Guest Support Melody Wang
2026-09-14 0:57 ` [PATCH v2 1/8] x86/sev: Make SVSM calls preemption-safe Melody Wang
2026-09-14 0:57 ` [PATCH v2 2/8] x86/sev: Add support for Alternate Injection Melody Wang
2026-09-14 0:57 ` [PATCH v2 3/8] x86/apic: Add an SVSM APIC driver Melody Wang
2026-09-14 0:57 ` [PATCH v2 4/8] x86/sev: Route unsupported APIC register accesses to the hypervisor APIC emulation Melody Wang
2026-09-14 0:57 ` [PATCH v2 5/8] x86/sev: Add a function to contain all SEV-specific setup operations Melody Wang
2026-09-14 20:04 ` Ard Biesheuvel
2026-09-14 0:57 ` [PATCH v2 6/8] x86/sev: Register the guest with the SVSM APIC protocol Melody Wang
2026-09-14 20:06 ` Ard Biesheuvel
2026-09-15 2:04 ` Melody Wang
2026-09-15 7:44 ` Ard Biesheuvel
2026-09-16 18:45 ` Melody Wang [this message]
2026-09-14 0:57 ` [PATCH v2 7/8] x86/sev: Allow the guest to configure interrupt vectors for the hypervisor Melody Wang
2026-09-14 0:57 ` [PATCH v2 8/8] 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=b0927c73-9171-40e2-9d1a-3dcb2da1c839@amd.com \
--to=huibo.wang@amd.com \
--cc=ardb@kernel.org \
--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®