public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min M Xu <min.m.xu@intel.com>, Eric Dong <eric.dong@intel.com>,
	Ray Ni <ray.ni@intel.com>, Brijesh Singh <brijesh.singh@amd.com>,
	Erdem Aktas <erdemaktas@google.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	James Bottomley <jejb@linux.ibm.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: [PATCH V4 2/3] OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
Date: Tue,  8 Nov 2022 09:14:39 +0800	[thread overview]
Message-ID: <20221108011440.1750-3-min.m.xu@intel.com> (raw)
In-Reply-To: <20221108011440.1750-1-min.m.xu@intel.com>

From: Min M Xu <min.m.xu@intel.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123

APIs which are defined in CcExitLib.h are added with the CcExit prefix.
This is to make the APIs' name more meaningful.

This change impacts OvmfPkg/UefiCpuPkg.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 .../X64/SnpPageStateChangeInternal.c          |   8 +-
 OvmfPkg/Library/CcExitLib/CcExitLib.c         |  18 +--
 OvmfPkg/Library/CcExitLib/CcExitVcHandler.c   | 124 +++++++++---------
 OvmfPkg/Library/CcExitLib/CcExitVeHandler.c   |   2 +-
 .../Library/CcExitLib/PeiDxeCcExitVcHandler.c |   2 +-
 .../Library/CcExitLib/SecCcExitVcHandler.c    |   2 +-
 OvmfPkg/PlatformPei/AmdSev.c                  |   8 +-
 .../QemuFlashDxe.c                            |   8 +-
 UefiCpuPkg/Include/Library/CcExitLib.h        |  16 +--
 .../Library/CcExitLibNull/CcExitLibNull.c     |  16 +--
 .../PeiDxeSmmCpuException.c                   |   4 +-
 .../SecPeiCpuException.c                      |   4 +-
 UefiCpuPkg/Library/MpInitLib/AmdSev.c         |   8 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |   6 +-
 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c     |   8 +-
 15 files changed, 117 insertions(+), 117 deletions(-)

diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index 73698a7b9d8c..4d684964d838 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -193,9 +193,9 @@ PageStateChangeVmgExit (
   //
   while (Info->Header.CurrentEntry <= Info->Header.EndEntry) {
     Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-    VmgSetOffsetValid (Ghcb, GhcbSwScratch);
+    CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
 
-    Status = VmgExit (Ghcb, SVM_EXIT_SNP_PAGE_STATE_CHANGE, 0, 0);
+    Status = CcExitVmgExit (Ghcb, SVM_EXIT_SNP_PAGE_STATE_CHANGE, 0, 0);
 
     //
     // The Page State Change VMGEXIT can pass the failure through the
@@ -251,7 +251,7 @@ InternalSetPageState (
     //
     // Initialize the GHCB
     //
-    VmgInit (Ghcb, &InterruptState);
+    CcExitVmgInit (Ghcb, &InterruptState);
 
     //
     // Build the page state structure
@@ -293,7 +293,7 @@ InternalSetPageState (
       PvalidateRange (Info, CurrentEntry, EndEntry, TRUE);
     }
 
-    VmgDone (Ghcb, InterruptState);
+    CcExitVmgDone (Ghcb, InterruptState);
 
     BaseAddress = NextAddress;
   }
diff --git a/OvmfPkg/Library/CcExitLib/CcExitLib.c b/OvmfPkg/Library/CcExitLib/CcExitLib.c
index 477064cde2bb..e256000fb283 100644
--- a/OvmfPkg/Library/CcExitLib/CcExitLib.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitLib.c
@@ -103,7 +103,7 @@ VmgExitErrorCheck (
 **/
 UINT64
 EFIAPI
-VmgExit (
+CcExitVmgExit (
   IN OUT GHCB    *Ghcb,
   IN     UINT64  ExitCode,
   IN     UINT64  ExitInfo1,
@@ -114,9 +114,9 @@ VmgExit (
   Ghcb->SaveArea.SwExitInfo1 = ExitInfo1;
   Ghcb->SaveArea.SwExitInfo2 = ExitInfo2;
 
-  VmgSetOffsetValid (Ghcb, GhcbSwExitCode);
-  VmgSetOffsetValid (Ghcb, GhcbSwExitInfo1);
-  VmgSetOffsetValid (Ghcb, GhcbSwExitInfo2);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitCode);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitInfo1);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitInfo2);
 
   //
   // Guest memory is used for the guest-hypervisor communication, so fence
@@ -138,12 +138,12 @@ VmgExit (
 
   @param[in, out]  Ghcb            A pointer to the GHCB
   @param[in, out]  InterruptState  A pointer to hold the current interrupt
-                                   state, used for restoring in VmgDone ()
+                                   state, used for restoring in CcExitVmgDone ()
 
 **/
 VOID
 EFIAPI
-VmgInit (
+CcExitVmgInit (
   IN OUT GHCB     *Ghcb,
   IN OUT BOOLEAN  *InterruptState
   )
@@ -173,7 +173,7 @@ VmgInit (
 **/
 VOID
 EFIAPI
-VmgDone (
+CcExitVmgDone (
   IN OUT GHCB     *Ghcb,
   IN     BOOLEAN  InterruptState
   )
@@ -195,7 +195,7 @@ VmgDone (
 **/
 VOID
 EFIAPI
-VmgSetOffsetValid (
+CcExitVmgSetOffsetValid (
   IN OUT GHCB           *Ghcb,
   IN     GHCB_REGISTER  Offset
   )
@@ -224,7 +224,7 @@ VmgSetOffsetValid (
 **/
 BOOLEAN
 EFIAPI
-VmgIsOffsetValid (
+CcExitVmgIsOffsetValid (
   IN GHCB           *Ghcb,
   IN GHCB_REGISTER  Offset
   )
diff --git a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
index ad2a922c9f43..985e5479775c 100644
--- a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
@@ -611,7 +611,7 @@ UnsupportedExit (
 {
   UINT64  Status;
 
-  Status = VmgExit (Ghcb, SVM_EXIT_UNSUPPORTED, Regs->ExceptionData, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_UNSUPPORTED, Regs->ExceptionData, 0);
   if (Status == 0) {
     GHCB_EVENT_INJECTION  Event;
 
@@ -755,8 +755,8 @@ MmioExit (
       CopyMem (Ghcb->SharedBuffer, &InstructionData->Ext.RegData, Bytes);
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -807,8 +807,8 @@ MmioExit (
       CopyMem (Ghcb->SharedBuffer, &Regs->Rax, Bytes);
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -843,8 +843,8 @@ MmioExit (
       CopyMem (Ghcb->SharedBuffer, InstructionData->Immediate, Bytes);
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -882,8 +882,8 @@ MmioExit (
       ExitInfo2 = Bytes;
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -942,8 +942,8 @@ MmioExit (
       ExitInfo2 = Bytes;
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -979,8 +979,8 @@ MmioExit (
       ExitInfo2 = Bytes;
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -1011,8 +1011,8 @@ MmioExit (
       ExitInfo2 = Bytes;
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -1068,11 +1068,11 @@ MwaitExit (
   DecodeModRm (Regs, InstructionData);
 
   Ghcb->SaveArea.Rax = Regs->Rax;
-  VmgSetOffsetValid (Ghcb, GhcbRax);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
   Ghcb->SaveArea.Rcx = Regs->Rcx;
-  VmgSetOffsetValid (Ghcb, GhcbRcx);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);
 
-  return VmgExit (Ghcb, SVM_EXIT_MWAIT, 0, 0);
+  return CcExitVmgExit (Ghcb, SVM_EXIT_MWAIT, 0, 0);
 }
 
 /**
@@ -1100,13 +1100,13 @@ MonitorExit (
   DecodeModRm (Regs, InstructionData);
 
   Ghcb->SaveArea.Rax = Regs->Rax;  // Identity mapped, so VA = PA
-  VmgSetOffsetValid (Ghcb, GhcbRax);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
   Ghcb->SaveArea.Rcx = Regs->Rcx;
-  VmgSetOffsetValid (Ghcb, GhcbRcx);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);
   Ghcb->SaveArea.Rdx = Regs->Rdx;
-  VmgSetOffsetValid (Ghcb, GhcbRdx);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRdx);
 
-  return VmgExit (Ghcb, SVM_EXIT_MONITOR, 0, 0);
+  return CcExitVmgExit (Ghcb, SVM_EXIT_MONITOR, 0, 0);
 }
 
 /**
@@ -1131,7 +1131,7 @@ WbinvdExit (
   IN     SEV_ES_INSTRUCTION_DATA  *InstructionData
   )
 {
-  return VmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0);
+  return CcExitVmgExit (Ghcb, SVM_EXIT_WBINVD, 0, 0);
 }
 
 /**
@@ -1160,14 +1160,14 @@ RdtscpExit (
 
   DecodeModRm (Regs, InstructionData);
 
-  Status = VmgExit (Ghcb, SVM_EXIT_RDTSCP, 0, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDTSCP, 0, 0);
   if (Status != 0) {
     return Status;
   }
 
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRcx) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRcx) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))
   {
     return UnsupportedExit (Ghcb, Regs, InstructionData);
   }
@@ -1206,16 +1206,16 @@ VmmCallExit (
   DecodeModRm (Regs, InstructionData);
 
   Ghcb->SaveArea.Rax = Regs->Rax;
-  VmgSetOffsetValid (Ghcb, GhcbRax);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
   Ghcb->SaveArea.Cpl = (UINT8)(Regs->Cs & 0x3);
-  VmgSetOffsetValid (Ghcb, GhcbCpl);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbCpl);
 
-  Status = VmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);
   if (Status != 0) {
     return Status;
   }
 
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax)) {
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) {
     return UnsupportedExit (Ghcb, Regs, InstructionData);
   }
 
@@ -1254,28 +1254,28 @@ MsrExit (
     case 0x30: // WRMSR
       ExitInfo1          = 1;
       Ghcb->SaveArea.Rax = Regs->Rax;
-      VmgSetOffsetValid (Ghcb, GhcbRax);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
       Ghcb->SaveArea.Rdx = Regs->Rdx;
-      VmgSetOffsetValid (Ghcb, GhcbRdx);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbRdx);
     //
     // fall through
     //
     case 0x32: // RDMSR
       Ghcb->SaveArea.Rcx = Regs->Rcx;
-      VmgSetOffsetValid (Ghcb, GhcbRcx);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);
       break;
     default:
       return UnsupportedExit (Ghcb, Regs, InstructionData);
   }
 
-  Status = VmgExit (Ghcb, SVM_EXIT_MSR, ExitInfo1, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_MSR, ExitInfo1, 0);
   if (Status != 0) {
     return Status;
   }
 
   if (ExitInfo1 == 0) {
-    if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||
-        !VmgIsOffsetValid (Ghcb, GhcbRdx))
+    if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||
+        !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))
     {
       return UnsupportedExit (Ghcb, Regs, InstructionData);
     }
@@ -1471,8 +1471,8 @@ IoioExit (
       }
 
       Ghcb->SaveArea.SwScratch = (UINT64)Ghcb->SharedBuffer;
-      VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-      Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2);
+      CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+      Status = CcExitVmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2);
       if (Status != 0) {
         return Status;
       }
@@ -1495,15 +1495,15 @@ IoioExit (
       CopyMem (&Ghcb->SaveArea.Rax, &Regs->Rax, IOIO_DATA_BYTES (ExitInfo1));
     }
 
-    VmgSetOffsetValid (Ghcb, GhcbRax);
+    CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
 
-    Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0);
+    Status = CcExitVmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0);
     if (Status != 0) {
       return Status;
     }
 
     if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {
-      if (!VmgIsOffsetValid (Ghcb, GhcbRax)) {
+      if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) {
         return UnsupportedExit (Ghcb, Regs, InstructionData);
       }
 
@@ -1536,7 +1536,7 @@ InvdExit (
   IN     SEV_ES_INSTRUCTION_DATA  *InstructionData
   )
 {
-  return VmgExit (Ghcb, SVM_EXIT_INVD, 0, 0);
+  return CcExitVmgExit (Ghcb, SVM_EXIT_INVD, 0, 0);
 }
 
 /**
@@ -1581,23 +1581,23 @@ GetCpuidHyp (
 {
   *UnsupportedExit   = FALSE;
   Ghcb->SaveArea.Rax = EaxIn;
-  VmgSetOffsetValid (Ghcb, GhcbRax);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
   Ghcb->SaveArea.Rcx = EcxIn;
-  VmgSetOffsetValid (Ghcb, GhcbRcx);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);
   if (EaxIn == CPUID_EXTENDED_STATE) {
     Ghcb->SaveArea.XCr0 = XCr0;
-    VmgSetOffsetValid (Ghcb, GhcbXCr0);
+    CcExitVmgSetOffsetValid (Ghcb, GhcbXCr0);
   }
 
-  *Status = VmgExit (Ghcb, SVM_EXIT_CPUID, 0, 0);
+  *Status = CcExitVmgExit (Ghcb, SVM_EXIT_CPUID, 0, 0);
   if (*Status != 0) {
     return FALSE;
   }
 
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRbx) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRcx) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRbx) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRcx) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))
   {
     *UnsupportedExit = TRUE;
     return FALSE;
@@ -2049,15 +2049,15 @@ RdpmcExit (
   UINT64  Status;
 
   Ghcb->SaveArea.Rcx = Regs->Rcx;
-  VmgSetOffsetValid (Ghcb, GhcbRcx);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRcx);
 
-  Status = VmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDPMC, 0, 0);
   if (Status != 0) {
     return Status;
   }
 
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))
   {
     return UnsupportedExit (Ghcb, Regs, InstructionData);
   }
@@ -2092,13 +2092,13 @@ RdtscExit (
 {
   UINT64  Status;
 
-  Status = VmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_RDTSC, 0, 0);
   if (Status != 0) {
     return Status;
   }
 
-  if (!VmgIsOffsetValid (Ghcb, GhcbRax) ||
-      !VmgIsOffsetValid (Ghcb, GhcbRdx))
+  if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax) ||
+      !CcExitVmgIsOffsetValid (Ghcb, GhcbRdx))
   {
     return UnsupportedExit (Ghcb, Regs, InstructionData);
   }
@@ -2150,9 +2150,9 @@ Dr7WriteExit (
   // Using a value of 0 for ExitInfo1 means RAX holds the value
   //
   Ghcb->SaveArea.Rax = *Register;
-  VmgSetOffsetValid (Ghcb, GhcbRax);
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
 
-  Status = VmgExit (Ghcb, SVM_EXIT_DR7_WRITE, 0, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_DR7_WRITE, 0, 0);
   if (Status != 0) {
     return Status;
   }
@@ -2243,7 +2243,7 @@ InternalVmgExitHandleVc (
 
   Regs = SystemContext.SystemContextX64;
 
-  VmgInit (Ghcb, &InterruptState);
+  CcExitVmgInit (Ghcb, &InterruptState);
 
   ExitCode = Regs->ExceptionData;
   switch (ExitCode) {
@@ -2327,7 +2327,7 @@ InternalVmgExitHandleVc (
     VcRet = EFI_PROTOCOL_ERROR;
   }
 
-  VmgDone (Ghcb, InterruptState);
+  CcExitVmgDone (Ghcb, InterruptState);
 
   return VcRet;
 }
diff --git a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
index 08e92c66ce74..081af7e12aa5 100644
--- a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
@@ -464,7 +464,7 @@ MmioExit (
 **/
 EFI_STATUS
 EFIAPI
-VmTdExitHandleVe (
+CcExitHandleVe (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   )
diff --git a/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c b/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c
index bb718161f588..522f747f08c1 100644
--- a/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c
+++ b/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c
@@ -33,7 +33,7 @@
 **/
 EFI_STATUS
 EFIAPI
-VmgExitHandleVc (
+CcExitHandleVc (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   )
diff --git a/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c b/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c
index 769e0b5b7417..da70581af8d8 100644
--- a/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c
+++ b/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c
@@ -33,7 +33,7 @@
 **/
 EFI_STATUS
 EFIAPI
-VmgExitHandleVc (
+CcExitHandleVc (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   )
diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index 80a1194ffcb9..e1b9fd9b7f68 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -50,7 +50,7 @@ AmdSevSnpInitialize (
   }
 
   //
-  // Query the hypervisor feature using the VmgExit and set the value in the
+  // Query the hypervisor feature using the CcExitVmgExit and set the value in the
   // hypervisor features PCD.
   //
   HvFeatures = GetHypervisorFeature ();
@@ -129,19 +129,19 @@ GetHypervisorFeature (
   //
   // Initialize the GHCB
   //
-  VmgInit (Ghcb, &InterruptState);
+  CcExitVmgInit (Ghcb, &InterruptState);
 
   //
   // Query the Hypervisor Features.
   //
-  Status = VmgExit (Ghcb, SVM_EXIT_HYPERVISOR_FEATURES, 0, 0);
+  Status = CcExitVmgExit (Ghcb, SVM_EXIT_HYPERVISOR_FEATURES, 0, 0);
   if ((Status != 0)) {
     SevEsProtocolFailure (GHCB_TERMINATE_GHCB_GENERAL);
   }
 
   Features = Ghcb->SaveArea.SwExitInfo2;
 
-  VmgDone (Ghcb, InterruptState);
+  CcExitVmgDone (Ghcb, InterruptState);
 
   return Features;
 }
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c
index 58bcad825d57..d57f7ca25ccf 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c
@@ -82,12 +82,12 @@ QemuFlashPtrWrite (
     // #VC exception. Instead, use the VMGEXIT MMIO write support directly
     // to perform the update.
     //
-    VmgInit (Ghcb, &InterruptState);
+    CcExitVmgInit (Ghcb, &InterruptState);
     Ghcb->SharedBuffer[0]    = Value;
     Ghcb->SaveArea.SwScratch = (UINT64)(UINTN)Ghcb->SharedBuffer;
-    VmgSetOffsetValid (Ghcb, GhcbSwScratch);
-    VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, PhysAddr, 1);
-    VmgDone (Ghcb, InterruptState);
+    CcExitVmgSetOffsetValid (Ghcb, GhcbSwScratch);
+    CcExitVmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, PhysAddr, 1);
+    CcExitVmgDone (Ghcb, InterruptState);
   } else {
     *Ptr = Value;
   }
diff --git a/UefiCpuPkg/Include/Library/CcExitLib.h b/UefiCpuPkg/Include/Library/CcExitLib.h
index 1ae618c19b9e..3381d583691f 100644
--- a/UefiCpuPkg/Include/Library/CcExitLib.h
+++ b/UefiCpuPkg/Include/Library/CcExitLib.h
@@ -41,7 +41,7 @@
 **/
 UINT64
 EFIAPI
-VmgExit (
+CcExitVmgExit (
   IN OUT GHCB    *Ghcb,
   IN     UINT64  ExitCode,
   IN     UINT64  ExitInfo1,
@@ -56,12 +56,12 @@ VmgExit (
 
   @param[in, out]  Ghcb            A pointer to the GHCB
   @param[in, out]  InterruptState  A pointer to hold the current interrupt
-                                   state, used for restoring in VmgDone ()
+                                   state, used for restoring in CcExitVmgDone ()
 
 **/
 VOID
 EFIAPI
-VmgInit (
+CcExitVmgInit (
   IN OUT GHCB     *Ghcb,
   IN OUT BOOLEAN  *InterruptState
   );
@@ -79,7 +79,7 @@ VmgInit (
 **/
 VOID
 EFIAPI
-VmgDone (
+CcExitVmgDone (
   IN OUT GHCB     *Ghcb,
   IN     BOOLEAN  InterruptState
   );
@@ -96,7 +96,7 @@ VmgDone (
 **/
 VOID
 EFIAPI
-VmgSetOffsetValid (
+CcExitVmgSetOffsetValid (
   IN OUT GHCB           *Ghcb,
   IN     GHCB_REGISTER  Offset
   );
@@ -116,7 +116,7 @@ VmgSetOffsetValid (
 **/
 BOOLEAN
 EFIAPI
-VmgIsOffsetValid (
+CcExitVmgIsOffsetValid (
   IN GHCB           *Ghcb,
   IN GHCB_REGISTER  Offset
   );
@@ -142,7 +142,7 @@ VmgIsOffsetValid (
 **/
 EFI_STATUS
 EFIAPI
-VmgExitHandleVc (
+CcExitHandleVc (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   );
@@ -168,7 +168,7 @@ VmgExitHandleVc (
 **/
 EFI_STATUS
 EFIAPI
-VmTdExitHandleVe (
+CcExitHandleVe (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   );
diff --git a/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c
index 79eca74e138f..230e50705b4a 100644
--- a/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c
+++ b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c
@@ -35,7 +35,7 @@
 **/
 UINT64
 EFIAPI
-VmgExit (
+CcExitVmgExit (
   IN OUT GHCB    *Ghcb,
   IN     UINT64  ExitCode,
   IN     UINT64  ExitInfo1,
@@ -60,12 +60,12 @@ VmgExit (
 
   @param[in, out]  Ghcb            A pointer to the GHCB
   @param[in, out]  InterruptState  A pointer to hold the current interrupt
-                                   state, used for restoring in VmgDone ()
+                                   state, used for restoring in CcExitVmgDone ()
 
 **/
 VOID
 EFIAPI
-VmgInit (
+CcExitVmgInit (
   IN OUT GHCB     *Ghcb,
   IN OUT BOOLEAN  *InterruptState
   )
@@ -85,7 +85,7 @@ VmgInit (
 **/
 VOID
 EFIAPI
-VmgDone (
+CcExitVmgDone (
   IN OUT GHCB     *Ghcb,
   IN     BOOLEAN  InterruptState
   )
@@ -104,7 +104,7 @@ VmgDone (
 **/
 VOID
 EFIAPI
-VmgSetOffsetValid (
+CcExitVmgSetOffsetValid (
   IN OUT GHCB           *Ghcb,
   IN     GHCB_REGISTER  Offset
   )
@@ -126,7 +126,7 @@ VmgSetOffsetValid (
 **/
 BOOLEAN
 EFIAPI
-VmgIsOffsetValid (
+CcExitVmgIsOffsetValid (
   IN GHCB           *Ghcb,
   IN GHCB_REGISTER  Offset
   )
@@ -155,7 +155,7 @@ VmgIsOffsetValid (
 **/
 EFI_STATUS
 EFIAPI
-VmgExitHandleVc (
+CcExitHandleVc (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   )
@@ -183,7 +183,7 @@ VmgExitHandleVc (
 **/
 EFI_STATUS
 EFIAPI
-VmTdExitHandleVe (
+CcExitHandleVe (
   IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
   IN OUT EFI_SYSTEM_CONTEXT  SystemContext
   )
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
index 2b6d9da5c713..748cf8d3bfc6 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
@@ -40,7 +40,7 @@ CommonExceptionHandlerWorker (
       //   On other       - ExceptionType contains (possibly new) exception
       //                    value
       //
-      Status = VmgExitHandleVc (&ExceptionType, SystemContext);
+      Status = CcExitHandleVc (&ExceptionType, SystemContext);
       if (!EFI_ERROR (Status)) {
         return;
       }
@@ -57,7 +57,7 @@ CommonExceptionHandlerWorker (
       //   On other       - ExceptionType contains (possibly new) exception
       //                    value
       //
-      Status = VmTdExitHandleVe (&ExceptionType, SystemContext);
+      Status = CcExitHandleVe (&ExceptionType, SystemContext);
       if (!EFI_ERROR (Status)) {
         return;
       }
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
index 0a9ea79f52dc..497cd1649930 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
@@ -39,7 +39,7 @@ CommonExceptionHandler (
       //   On other       - ExceptionType contains (possibly new) exception
       //                    value
       //
-      Status = VmgExitHandleVc (&ExceptionType, SystemContext);
+      Status = CcExitHandleVc (&ExceptionType, SystemContext);
       if (!EFI_ERROR (Status)) {
         return;
       }
@@ -57,7 +57,7 @@ CommonExceptionHandler (
       //   On other       - ExceptionType contains (possibly new) exception
       //                    value
       //
-      Status = VmTdExitHandleVe (&ExceptionType, SystemContext);
+      Status = CcExitHandleVe (&ExceptionType, SystemContext);
       if (!EFI_ERROR (Status)) {
         return;
       }
diff --git a/UefiCpuPkg/Library/MpInitLib/AmdSev.c b/UefiCpuPkg/Library/MpInitLib/AmdSev.c
index 2dd8f4d74621..ca9bfed7f3b1 100644
--- a/UefiCpuPkg/Library/MpInitLib/AmdSev.c
+++ b/UefiCpuPkg/Library/MpInitLib/AmdSev.c
@@ -209,7 +209,7 @@ SevEsPlaceApHlt (
     Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
     Ghcb                    = Msr.Ghcb;
 
-    VmgInit (Ghcb, &InterruptState);
+    CcExitVmgInit (Ghcb, &InterruptState);
 
     if (DoDecrement) {
       DoDecrement = FALSE;
@@ -221,13 +221,13 @@ SevEsPlaceApHlt (
       InterlockedDecrement ((UINT32 *)&CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
     }
 
-    Status = VmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0);
+    Status = CcExitVmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0);
     if ((Status == 0) && (Ghcb->SaveArea.SwExitInfo2 != 0)) {
-      VmgDone (Ghcb, InterruptState);
+      CcExitVmgDone (Ghcb, InterruptState);
       break;
     }
 
-    VmgDone (Ghcb, InterruptState);
+    CcExitVmgDone (Ghcb, InterruptState);
   }
 
   //
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index ef56af1f738b..a84e9e33bafa 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -222,9 +222,9 @@ GetSevEsAPMemory (
   Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
   Ghcb                    = Msr.Ghcb;
 
-  VmgInit (Ghcb, &InterruptState);
-  VmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64)(UINTN)StartAddress);
-  VmgDone (Ghcb, InterruptState);
+  CcExitVmgInit (Ghcb, &InterruptState);
+  CcExitVmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64)(UINTN)StartAddress);
+  CcExitVmgDone (Ghcb, InterruptState);
 
   return (UINTN)StartAddress;
 }
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c
index 4c4f81af7c22..bfda1e19030d 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c
+++ b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c
@@ -150,16 +150,16 @@ SevSnpCreateSaveArea (
   Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
   Ghcb                    = Msr.Ghcb;
 
-  VmgInit (Ghcb, &InterruptState);
+  CcExitVmgInit (Ghcb, &InterruptState);
   Ghcb->SaveArea.Rax = SaveArea->SevFeatures;
-  VmgSetOffsetValid (Ghcb, GhcbRax);
-  VmgExitStatus = VmgExit (
+  CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
+  VmgExitStatus = CcExitVmgExit (
                     Ghcb,
                     SVM_EXIT_SNP_AP_CREATION,
                     ExitInfo1,
                     ExitInfo2
                     );
-  VmgDone (Ghcb, InterruptState);
+  CcExitVmgDone (Ghcb, InterruptState);
 
   ASSERT (VmgExitStatus == 0);
   if (VmgExitStatus != 0) {
-- 
2.29.2.windows.2


  parent reply	other threads:[~2022-11-08  1:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  1:14 [PATCH V4 0/3] Rename VmgExitLib to CcExitLib Min Xu
2022-11-08  1:14 ` [PATCH V4 1/3] OvmfPkg/UefiCpuPkg/UefiPayloadPkg: " Min Xu
2022-11-08  1:14 ` Min Xu [this message]
2022-11-08  1:14 ` [PATCH V4 3/3] Maintainers: Update the " Min Xu
2022-11-08  1:28 ` [edk2-stable202211] [PATCH V4 0/3] Rename " Yao, Jiewen
2022-11-10 16:38   ` Michael D Kinney
2022-11-10 17:06     ` Yao, Jiewen
2022-11-10  8:21 ` [edk2-devel] " Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221108011440.1750-3-min.m.xu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox