Re: [PATCH v3 6/8] x86/sev: Register the guest with the SVSM APIC protocol

From: Melody Wang

Date: Wed Sep 23 2026 - 16:47:01 EST


Hi all,

On 9/20/26 11:16 AM, Melody Wang wrote:
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 49388524a61f..35b8641119b9 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -793,6 +793,9 @@ static bool sev_prepare(void)
unsupported);
return true;
}
+
+ svsm_register_alt_inj();
+

Sashiko said this:

"Does this code handle non-EFI direct kernel boots correctly?
When an SEV-SNP guest is booted directly and bypasses the EFI stub (such as
when using QEMU's -kernel with a setup_data CC blob), sev_prepare() is
skipped entirely.
This completely bypasses the svsm_register_alt_inj() call.
The main kernel checks for Alternate Injection support via
cc_platform_has(CC_ATTR_SNP_ALTERNATE_INJECTION). This check relies
strictly on the sev_status MSR hardware bit set by the SVSM and ignores
whether the guest successfully registered the APIC emulation.
Could this cause the APIC probe to issue SVSM APIC calls via
__svsm_apic_msr_rw() that are rejected by the SVSM, leading to an
unconditional crash via sev_es_terminate() early in the boot sequence?"

Alternate Injection does not work without OVMF support so no need to handle the non-EFI direct kernel boots.

Thanks,
Melody
return false;
}

--
Thanks,
Melody