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 v2 6/8] x86/sev: Register the guest with the SVSM APIC protocol
Date: Tue, 15 Sep 2026 09:44:34 +0200 [thread overview]
Message-ID: <e624a245-e699-40d5-9948-aa77da5c44e1@app.fastmail.com> (raw)
In-Reply-To: <3f4e75ed-9a4b-448c-adb4-5e2e8bae8b11@amd.com>
On Tue, 15 Sep 2026, at 04:04, Melody Wang wrote:
> Hi Ard,
>
> On 9/14/26 1:06 PM, Ard Biesheuvel wrote:
>> On Mon, 14 Sep 2026, at 02:57, Melody Wang wrote:
>>> The SVSM APIC protocol supports 5 calls. SVSM_APIC_CONFIGURE_EMULATION
>>> (shortened to SVSM_APIC_CONFIG_EMULATION for brevity), call 1, provides
>>> the controls whether the guest can make use of the SVSM APIC protocol.
>>>
>>> Implement this call, and register Alternate Injection for the guest
>>> by default.
>>>
>>> Signed-off-by: Melody Wang <huibo.wang@amd.com>
>>> ---
>>> arch/x86/boot/compressed/sev.c | 17 +++++++++++++++++
>>> arch/x86/boot/compressed/sev.h | 6 ++++++
>>> 2 files changed, 23 insertions(+)
>>>
>>
>> Does this need to happen in the EFI stub and/or decompressor? We have swathes
>> of early SEV-SNP boot code in the kernel proper; could it be done there?
>
> Let me answer the question directly first:
>
> Alternate Injection is used by both the guest firmware and the guest
> kernel. Before we run the guest kernel, guest firmware - OVMF - is using
> Alternate Injection for interrupts, etc.
>
> So ExitBootServices() is a handoff boundary. When it is called, the
> firmware's use of Alternate Injection ends. It must deregister its use
> of Alternate Injection at this point since it can not assume anything
> about the guest kernel that follows.
>
> At this moment, if the guest kernel has not registered the use of
> Alternate Injection, latter is disabled and can not be re-enabled.
>
> So if the guest kernel wants Alternate Injection, it has to happen
> before ExitBootServices().
>
OK, so this means that this code will only be called from the EFI stub
running under EFI boot services, and never from the decompressor when
doing traditional boot.
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.
next prev parent reply other threads:[~2026-09-15 7:45 UTC|newest]
Thread overview: 13+ 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 [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=e624a245-e699-40d5-9948-aa77da5c44e1@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®