[edk2-devel] [PATCH v5 2/4] OvmfPkg/VmgExitLib: Add support for hypercalls with SEV-ES.

Ashish Kalra via groups.io ashish.kalra=amd.com at groups.io
Thu Jul 8 14:08:17 UTC 2021


From: Ashish Kalra <ashish.kalra at amd.com>

Make the VC handler hypercall aware by adding support
to compare the hypercall number and add the additional
register values used by hypercall in the GHCB.

Also mark the SEC GHCB page (that is mapped as
unencrypted in ResetVector code) in the hypervisor
guest page status tracking.

Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Laszlo Ersek <lersek at redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
Signed-off-by: Ashish Kalra <ashish.kalra at amd.com>
---
 OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
index 41b0c8cc53..7f69bfab5f 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
+++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
@@ -1171,6 +1171,15 @@ VmmCallExit (
   Ghcb->SaveArea.Cpl = (UINT8) (Regs->Cs & 0x3);
   VmgSetOffsetValid (Ghcb, GhcbCpl);
 
+  if (Regs->Rax == KVM_HC_MAP_GPA_RANGE) {
+    Ghcb->SaveArea.Rbx = Regs->Rbx;
+    VmgSetOffsetValid (Ghcb, GhcbRbx);
+    Ghcb->SaveArea.Rcx = Regs->Rcx;
+    VmgSetOffsetValid (Ghcb, GhcbRcx);
+    Ghcb->SaveArea.Rdx = Regs->Rdx;
+    VmgSetOffsetValid (Ghcb, GhcbRdx);
+  }
+
   Status = VmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);
   if (Status != 0) {
     return Status;
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77595): https://edk2.groups.io/g/devel/message/77595
Mute This Topic: https://groups.io/mt/84068349/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list