From: Ashish Kalra <ashish.ka...@amd.com>

Make the #VC handler aware of the page encryption state
change hypercall by adding support to check KVM_HC_MAP_GPA_RANGE
hypercall and add the additional register values used by
hypercall in the GHCB.

Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Ard Biesheuvel <ard.biesheu...@arm.com>
Signed-off-by: Ashish Kalra <ashish.ka...@amd.com>
---
 OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c 
b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
index a4393dffbd..ee213ae2cb 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
+++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
@@ -1211,6 +1211,19 @@ VmmCallExit (
   Ghcb->SaveArea.Cpl = (UINT8)(Regs->Cs & 0x3);

   VmgSetOffsetValid (Ghcb, GhcbCpl);

 

+  if (Regs->Rax == KVM_HC_MAP_GPA_RANGE) {

+    //

+    // KVM_HC_MAP_GPA_RANGE hypercall requires these

+    // extra registers.

+    //

+    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.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88439): https://edk2.groups.io/g/devel/message/88439
Mute This Topic: https://groups.io/mt/90271234/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to