Re: [PATCH v7 10/22] x86/boot: Drop redundant RMPADJUST in SEV SVSM presence check

Borislav Petkov
2025-09-02T12:02:49Z

On Thu, Aug 28, 2025 at 12:22:13PM +0200, Ard Biesheuvel wrote:
> - /*
> - * Running at VMPL0 is not required if an SVSM is present and the hypervisor
> - * supports the required SVSM GHCB events.
> - */
> - if (ret &&
> - !(snp_vmpl && (hv_features & GHCB_HV_FT_SNP_MULTI_VMPL)))
> + if (snp_vmpl > 0 && !(hv_features & GHCB_HV_FT_SNP_MULTI_VMPL))

Yeah, it is unsigned:

diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
index 973ca206794a..808211b09424 100644
--- a/arch/x86/boot/compressed/sev.c
+++ b/arch/x86/boot/compressed/sev.c
@@ -415,7 +415,7 @@ void sev_enable(struct boot_params *bp)
* Running at VMPL0 is required unless an SVSM is present and
* the hypervisor supports the required SVSM GHCB events.
*/
- if (snp_vmpl > 0 && !(hv_features & GHCB_HV_FT_SNP_MULTI_VMPL))
+ if (snp_vmpl && !(hv_features & GHCB_HV_FT_SNP_MULTI_VMPL))
sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_NOT_VMPL0);
}

--
Regards/Gruss,
Boris.