summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/VmgExitLib
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2020-08-12 15:21:38 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-08-17 02:46:39 +0000
commit3caf1e2e22e2d0272f8e8b599938b75ab60635de (patch)
tree1498537eec6f8d659cb30bec4900f3ef9359992b /OvmfPkg/Library/VmgExitLib
parent5894fb1fa2a4a977c9c8cec16f24d9e621a7e09b (diff)
downloadedk2-3caf1e2e22e2d0272f8e8b599938b75ab60635de.tar.gz
edk2-3caf1e2e22e2d0272f8e8b599938b75ab60635de.tar.bz2
edk2-3caf1e2e22e2d0272f8e8b599938b75ab60635de.zip
OvmfPkg/VmgExitLib: Add support for INVD NAE events
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 Under SEV-ES, a INVD intercept generates a #VC exception. VMGEXIT must be used to allow the hypervisor to handle this intercept. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/Library/VmgExitLib')
-rw-r--r--OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
index 0dd119fdec..ddaa19c7bc 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
+++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
@@ -1169,6 +1169,31 @@ IoioExit (
}
/**
+ Handle a INVD event.
+
+ Use the VMGEXIT instruction to handle a INVD event.
+
+ @param[in, out] Ghcb Pointer to the Guest-Hypervisor Communication
+ Block
+ @param[in, out] Regs x64 processor context
+ @param[in] InstructionData Instruction parsing context
+
+ @retval 0 Event handled successfully
+ @return New exception value to propagate
+
+**/
+STATIC
+UINT64
+InvdExit (
+ IN OUT GHCB *Ghcb,
+ IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs,
+ IN SEV_ES_INSTRUCTION_DATA *InstructionData
+ )
+{
+ return VmgExit (Ghcb, SVM_EXIT_INVD, 0, 0);
+}
+
+/**
Handle a CPUID event.
Use the VMGEXIT instruction to handle a CPUID event.
@@ -1360,6 +1385,10 @@ VmgExitHandleVc (
NaeExit = CpuidExit;
break;
+ case SVM_EXIT_INVD:
+ NaeExit = InvdExit;
+ break;
+
case SVM_EXIT_IOIO_PROT:
NaeExit = IoioExit;
break;