BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654
Currently, an SEV-SNP guest will terminate if it is not running at VMPL0. The requirement for running at VMPL0 is removed if an SVSM is present. Update the current VMPL0 check to additionally check for the presence of an SVSM is the guest is not running at VMPL0. Additionally, fix an error in SevSnpIsVmpl0() where the Status variable should be compared to 0 and not use the EFI_ERROR() function to determine if an error occurred during AsmRmpAdjust(). Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com> --- OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c index 86af2ba0356e..803c835680e0 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SecSnpSystemRamValidate.c @@ -12,6 +12,7 @@ #include <Library/BaseLib.h> #include <Library/DebugLib.h> #include <Library/MemEncryptSevLib.h> +#include <Library/CcExitLib.h> #include "SnpPageStateChange.h" @@ -45,7 +46,7 @@ SevSnpIsVmpl0 ( Rdx = 1; Status = AsmRmpAdjust ((UINT64)gVmpl0Data, 0, Rdx); - if (EFI_ERROR (Status)) { + if (Status != 0) { return FALSE; } @@ -74,10 +75,12 @@ MemEncryptSevSnpPreValidateSystemRam ( // // The page state change uses the PVALIDATE instruction. The instruction - // can be run on VMPL-0 only. If its not VMPL-0 guest then terminate - // the boot. + // can be run at VMPL-0 only. If its not a VMPL-0 guest, then an SVSM must + // be present to perform the operation on behalf of the guest. If the guest + // is not running at VMPL-0 and an SVSM is not present, then terminate the + // boot. // - if (!SevSnpIsVmpl0 ()) { + if (!SevSnpIsVmpl0 () && !CcExitSnpSvsmPresent ()) { SnpPageStateFailureTerminate (); } -- 2.42.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114642): https://edk2.groups.io/g/devel/message/114642 Mute This Topic: https://groups.io/mt/103986479/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-