Re: [PATCH v4 5/7] x86/sev: Register the guest with the SVSM APIC protocol

From: Melody Wang

Date: Thu Oct 15 2026 - 23:45:36 EST


Hi Ard,

On 10/14/26 11:04 PM, Ard Biesheuvel wrote:

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?

Yes, pretty much. That form works.

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.

Yeah, sorry, that was a leftover from a previous version.

--
Thanks,
Melody