Re: [PATCH v1 7/8] x86/sev: Allow the guest to configure interrupt vectors for the hypervisor
From: Borislav Petkov
Date: Thu Sep 10 2026 - 23:27:40 EST
On Sat, Aug 29, 2026 at 03:39:45AM +0000, Melody Wang wrote:
> The SVSM APIC protocol supports 5 API calls. SVSM_APIC_CONFIGURE_VECTOR
> (shortened to SVSM_APIC_CONFIG_VECTOR for brevity), call 4, provides for
> the guest to configure an interrupt vector which the guest allows and
> the hypervisor can use to signal interrupts for it.
>
> Implement this call, and make the default interrupt setting permissive
> to allow all interrupts when detecting an SVSM and Alternate Injection
> is enabled.
>
> Signed-off-by: Melody Wang <huibo.wang@xxxxxxx>
> ---
> arch/x86/boot/compressed/sev.c | 12 +++++++++++-
> arch/x86/boot/compressed/sev.h | 7 +++++++
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
> index a8a175c90fa8..479b74c75b4b 100644
> --- a/arch/x86/boot/compressed/sev.c
> +++ b/arch/x86/boot/compressed/sev.c
> @@ -520,7 +520,10 @@ bool sev_prepare(void)
> return true;
> }
>
> - /* Register Alternate Injection */
> + /* When the guest is running at VMPL2 with Alternate Injection enabled,
> + * register Alternate Injection, and configure all of interrupts as
> + * permissive by default.
> + */
Kernel comments style format is:
/*
* A sentence ending with a full-stop.
* Another sentence. ...
* More sentences. ...
*/
> if (early_is_sevsnp_guest() && snp_vmpl) {
> struct svsm_call call = {};
> int ret;
> @@ -535,6 +538,13 @@ bool sev_prepare(void)
> ret = svsm_call_msr_protocol(&call);
> if (ret)
> sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_ALT_INJ_FAIL);
> +
> + call.rax = SVSM_APIC_CALL(SVSM_APIC_CONFIG_VECTOR);
> + call.rcx = SVSM_IRQ_ENABLE_ALL;
> +
> + ret = svsm_call_msr_protocol(&call);
> + if (svsm_call_msr_protocol(&call))
That looks like a typo here and Sashiko is correct:
|Does this code inadvertently execute svsm_call_msr_protocol() twice when
|booting an SEV-SNP guest at VMPL2 with Alternate Injection enabled?
IOW:
if (ret)
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette