summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/ResetVector/Ia32
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2021-01-07 12:48:14 -0600
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-01-07 19:34:39 +0000
commitbd0c1c8e225b1274fc7e3f154811af40619e3f04 (patch)
treea83cc103896ecc1d115f7b0be845b1452e5c16a6 /OvmfPkg/ResetVector/Ia32
parent7cb96c47a94ea310b151c36380ea8266d21aa12a (diff)
downloadedk2-bd0c1c8e225b1274fc7e3f154811af40619e3f04.tar.gz
edk2-bd0c1c8e225b1274fc7e3f154811af40619e3f04.tar.bz2
edk2-bd0c1c8e225b1274fc7e3f154811af40619e3f04.zip
OvmfPkg/ResetVector: Perform a simple SEV-ES sanity check
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3108 If a hypervisor incorrectly reports through CPUID that SEV-ES is not active, ensure that a #VC exception was not taken. If it is found that a #VC was taken, then the code enters a HLT loop. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Message-Id: <afa2030b95b852313b13982df82d472187e59b92.1610045305.git.thomas.lendacky@amd.com>
Diffstat (limited to 'OvmfPkg/ResetVector/Ia32')
-rw-r--r--OvmfPkg/ResetVector/Ia32/PageTables64.asm16
1 files changed, 16 insertions, 0 deletions
diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
index ccc95ad471..a1771dfdec 100644
--- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
+++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
@@ -154,6 +154,22 @@ SevEncBitLowHlt:
jmp SevEncBitLowHlt
NoSev:
+ ;
+ ; Perform an SEV-ES sanity check by seeing if a #VC exception occurred.
+ ;
+ cmp byte[SEV_ES_WORK_AREA], 0
+ jz NoSevPass
+
+ ;
+ ; A #VC was received, yet CPUID indicates no SEV-ES support, something
+ ; isn't right.
+ ;
+NoSevEsVcHlt:
+ cli
+ hlt
+ jmp NoSevEsVcHlt
+
+NoSevPass:
xor eax, eax
SevExit: