public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
@ 2022-11-08  1:14 Min Xu
  2022-11-08  1:14 ` [PATCH V4 1/3] OvmfPkg/UefiCpuPkg/UefiPayloadPkg: " Min Xu
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Min Xu @ 2022-11-08  1:14 UTC (permalink / raw)
  To: devel
  Cc: Min Xu, Eric Dong, Ray Ni, Brijesh Singh, Erdem Aktas,
	Gerd Hoffmann, James Bottomley, Jiewen Yao, Tom Lendacky,
	Guo Dong, Sean Rhodes, James Lu, Gua Guo, Michael D Kinney,
	Liming Gao

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

VmgExitLib once was designed to provide interfaces to support #VC handler
and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
introduced, this library is updated to support #VE as well. Now the name
of VmgExitLib cannot reflect what the lib does.

This patch-set renames VmgExitLib to CcExitLib (Cc means Confidential
Computing). This is simple renaming and there is no logic changes. Then
APIs defined in CcExitLib.h are added with a CcExit prefix. This is to
make the name more meaningful.

Code: https://github.com/mxu9/edk2/tree/CcExitLib.v4

v4 changes:
 - The previous versions of the patch-set are to first duplicate a new
   CcExitLib then delete the old VmgExitLib. According to this comments
   https://edk2.groups.io/g/devel/message/96019 it suggests renaming in
   a single patch is better.
 - Lib APIs are added with CcExit prefix, not CcExitLib prefix.

v3 changes:
 - Rename CcExitHandleVc / CcExitHandleVe to
   CcExitLibHandleVc / CcExitLibHandleVe to make the nameing consistent.
 - Update the CcExitLib to merge the patch eff44c008d99
  (OvmfPkg/VmgExitLig: HALT on #VE when access to private memory).
 
v2 changes:
 - Patch #3 is added to import CcExitLib in OvmfPkg's *.dsc. This is to
   prevent the building from being broken in the following patches.

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>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>

Min M Xu (3):
  OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib
  OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
  Maintainers: Update the VmgExitLib to CcExitLib

 Maintainers.txt                               |   2 +-
 OvmfPkg/AmdSev/AmdSevX64.dsc                  |   4 +-
 OvmfPkg/Bhyve/BhyveX64.dsc                    |   2 +-
 OvmfPkg/CloudHv/CloudHvX64.dsc                |   6 +-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   4 +-
 .../DxeMemEncryptSevLib.inf                   |   2 +-
 .../PeiMemEncryptSevLib.inf                   |   2 +-
 .../SecMemEncryptSevLib.inf                   |   2 +-
 .../X64/SnpPageStateChangeInternal.c          |  10 +-
 .../VmgExitLib.c => CcExitLib/CcExitLib.c}    |  23 ++--
 .../CcExitLib.inf}                            |  17 +--
 .../CcExitTd.h}                               |   4 +-
 .../CcExitVcHandler.c}                        | 129 +++++++++---------
 .../CcExitVcHandler.h}                        |   6 +-
 .../CcExitVeHandler.c}                        |   6 +-
 .../PeiDxeCcExitVcHandler.c}                  |   6 +-
 .../SecCcExitLib.inf}                         |  14 +-
 .../SecCcExitVcHandler.c}                     |   6 +-
 .../X64/TdVmcallCpuid.nasm                    |   0
 OvmfPkg/Microvm/MicrovmX64.dsc                |   4 +-
 OvmfPkg/OvmfPkgIa32.dsc                       |   4 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                    |   4 +-
 OvmfPkg/OvmfPkgX64.dsc                        |   6 +-
 OvmfPkg/OvmfXen.dsc                           |   2 +-
 OvmfPkg/PlatformPei/AmdSev.c                  |  10 +-
 OvmfPkg/PlatformPei/PlatformPei.inf           |   2 +-
 .../FvbServicesRuntimeDxe.inf                 |   2 +-
 .../QemuFlashDxe.c                            |  10 +-
 .../Library/{VmgExitLib.h => CcExitLib.h}     |  29 ++--
 .../CcExitLibNull.c}                          |  47 +++++--
 .../CcExitLibNull.inf}                        |  12 +-
 .../Library/CcExitLibNull/CcExitLibNull.uni   |  14 ++
 .../DxeCpuExceptionHandlerLib.inf             |   2 +-
 .../PeiCpuExceptionHandlerLib.inf             |   2 +-
 .../PeiDxeSmmCpuException.c                   |   6 +-
 .../SecPeiCpuException.c                      |   6 +-
 .../SecPeiCpuExceptionHandlerLib.inf          |   2 +-
 .../SmmCpuExceptionHandlerLib.inf             |   2 +-
 .../Xcode5SecPeiCpuExceptionHandlerLib.inf    |   2 +-
 UefiCpuPkg/Library/MpInitLib/AmdSev.c         |  10 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |   2 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |   8 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c          |   2 +-
 UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |   2 +-
 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c     |  10 +-
 .../Library/VmgExitLibNull/VmTdExitNull.c     |  38 ------
 .../Library/VmgExitLibNull/VmgExitLibNull.uni |  15 --
 UefiCpuPkg/UefiCpuPkg.dec                     |   4 +-
 UefiCpuPkg/UefiCpuPkg.dsc                     |   4 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc             |   2 +-
 50 files changed, 252 insertions(+), 258 deletions(-)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.c => CcExitLib/CcExitLib.c} (89%)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.inf => CcExitLib/CcExitLib.inf} (66%)
 rename OvmfPkg/Library/{VmgExitLib/VmTdExitHandler.h => CcExitLib/CcExitTd.h} (86%)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.c => CcExitLib/CcExitVcHandler.c} (90%)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.h => CcExitLib/CcExitVcHandler.h} (89%)
 rename OvmfPkg/Library/{VmgExitLib/VmTdExitVeHandler.c => CcExitLib/CcExitVeHandler.c} (95%)
 rename OvmfPkg/Library/{VmgExitLib/PeiDxeVmgExitVcHandler.c => CcExitLib/PeiDxeCcExitVcHandler.c} (93%)
 rename OvmfPkg/Library/{VmgExitLib/SecVmgExitLib.inf => CcExitLib/SecCcExitLib.inf} (79%)
 rename OvmfPkg/Library/{VmgExitLib/SecVmgExitVcHandler.c => CcExitLib/SecCcExitVcHandler.c} (93%)
 rename OvmfPkg/Library/{VmgExitLib => CcExitLib}/X64/TdVmcallCpuid.nasm (100%)
 rename UefiCpuPkg/Include/Library/{VmgExitLib.h => CcExitLib.h} (87%)
 rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.c => CcExitLibNull/CcExitLibNull.c} (76%)
 rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.inf => CcExitLibNull/CcExitLibNull.inf} (60%)
 create mode 100644 UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
 delete mode 100644 UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
 delete mode 100644 UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni

-- 
2.29.2.windows.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH V4 1/3] OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib
  2022-11-08  1:14 [PATCH V4 0/3] Rename VmgExitLib to CcExitLib Min Xu
@ 2022-11-08  1:14 ` Min Xu
  2022-11-08  1:14 ` [PATCH V4 2/3] OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib Min Xu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Min Xu @ 2022-11-08  1:14 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Guo Dong, Sean Rhodes, James Lu, Gua Guo, Eric Dong,
	Ray Ni, Brijesh Singh, Erdem Aktas, Gerd Hoffmann,
	James Bottomley, Jiewen Yao, Tom Lendacky

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

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

VmgExitLib once was designed to provide interfaces to support #VC handler
and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
introduced, this library is updated to support #VE as well. Now the name
of VmgExitLib cannot reflect what the lib does.

This patch renames VmgExitLib to CcExitLib (Cc means Confidential
Computing). This is a simple renaming and there is no logic changes.
After renaming all the VmgExitLib related codes are updated with
CcExitLib. These changes are in OvmfPkg/UefiCpuPkg/UefiPayloadPkg.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
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>
---
 OvmfPkg/AmdSev/AmdSevX64.dsc                  |  4 +-
 OvmfPkg/Bhyve/BhyveX64.dsc                    |  2 +-
 OvmfPkg/CloudHv/CloudHvX64.dsc                |  6 +--
 OvmfPkg/IntelTdx/IntelTdxX64.dsc              |  4 +-
 .../DxeMemEncryptSevLib.inf                   |  2 +-
 .../PeiMemEncryptSevLib.inf                   |  2 +-
 .../SecMemEncryptSevLib.inf                   |  2 +-
 .../X64/SnpPageStateChangeInternal.c          |  2 +-
 .../VmgExitLib.c => CcExitLib/CcExitLib.c}    |  5 ++-
 .../CcExitLib.inf}                            | 17 +++++----
 .../CcExitTd.h}                               |  4 +-
 .../CcExitVcHandler.c}                        |  5 +--
 .../CcExitVcHandler.h}                        |  6 +--
 .../CcExitVeHandler.c}                        |  4 +-
 .../PeiDxeCcExitVcHandler.c}                  |  4 +-
 .../SecCcExitLib.inf}                         | 14 +++----
 .../SecCcExitVcHandler.c}                     |  4 +-
 .../X64/TdVmcallCpuid.nasm                    |  0
 OvmfPkg/Microvm/MicrovmX64.dsc                |  4 +-
 OvmfPkg/OvmfPkgIa32.dsc                       |  4 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                    |  4 +-
 OvmfPkg/OvmfPkgX64.dsc                        |  6 +--
 OvmfPkg/OvmfXen.dsc                           |  2 +-
 OvmfPkg/PlatformPei/AmdSev.c                  |  2 +-
 OvmfPkg/PlatformPei/PlatformPei.inf           |  2 +-
 .../FvbServicesRuntimeDxe.inf                 |  2 +-
 .../QemuFlashDxe.c                            |  2 +-
 .../Library/{VmgExitLib.h => CcExitLib.h}     | 13 ++++---
 .../CcExitLibNull.c}                          | 33 +++++++++++++++-
 .../CcExitLibNull.inf}                        | 12 +++---
 .../Library/CcExitLibNull/CcExitLibNull.uni   | 14 +++++++
 .../DxeCpuExceptionHandlerLib.inf             |  2 +-
 .../PeiCpuExceptionHandlerLib.inf             |  2 +-
 .../PeiDxeSmmCpuException.c                   |  2 +-
 .../SecPeiCpuException.c                      |  2 +-
 .../SecPeiCpuExceptionHandlerLib.inf          |  2 +-
 .../SmmCpuExceptionHandlerLib.inf             |  2 +-
 .../Xcode5SecPeiCpuExceptionHandlerLib.inf    |  2 +-
 UefiCpuPkg/Library/MpInitLib/AmdSev.c         |  2 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |  2 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |  2 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c          |  2 +-
 UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |  2 +-
 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c     |  2 +-
 .../Library/VmgExitLibNull/VmTdExitNull.c     | 38 -------------------
 .../Library/VmgExitLibNull/VmgExitLibNull.uni | 15 --------
 UefiCpuPkg/UefiCpuPkg.dec                     |  4 +-
 UefiCpuPkg/UefiCpuPkg.dsc                     |  4 +-
 UefiPayloadPkg/UefiPayloadPkg.dsc             |  2 +-
 49 files changed, 135 insertions(+), 141 deletions(-)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.c => CcExitLib/CcExitLib.c} (94%)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.inf => CcExitLib/CcExitLib.inf} (66%)
 rename OvmfPkg/Library/{VmgExitLib/VmTdExitHandler.h => CcExitLib/CcExitTd.h} (86%)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.c => CcExitLib/CcExitVcHandler.c} (95%)
 rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.h => CcExitLib/CcExitVcHandler.h} (89%)
 rename OvmfPkg/Library/{VmgExitLib/VmTdExitVeHandler.c => CcExitLib/CcExitVeHandler.c} (95%)
 rename OvmfPkg/Library/{VmgExitLib/PeiDxeVmgExitVcHandler.c => CcExitLib/PeiDxeCcExitVcHandler.c} (94%)
 rename OvmfPkg/Library/{VmgExitLib/SecVmgExitLib.inf => CcExitLib/SecCcExitLib.inf} (79%)
 rename OvmfPkg/Library/{VmgExitLib/SecVmgExitVcHandler.c => CcExitLib/SecCcExitVcHandler.c} (94%)
 rename OvmfPkg/Library/{VmgExitLib => CcExitLib}/X64/TdVmcallCpuid.nasm (100%)
 rename UefiCpuPkg/Include/Library/{VmgExitLib.h => CcExitLib.h} (89%)
 rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.c => CcExitLibNull/CcExitLibNull.c} (79%)
 rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.inf => CcExitLibNull/CcExitLibNull.inf} (60%)
 create mode 100644 UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
 delete mode 100644 UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
 delete mode 100644 UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 90e8a213ef77..8f7cae787e97 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -204,7 +204,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
 
 [LibraryClasses.common.SEC]
@@ -229,7 +229,7 @@
 !else
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 !endif
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
 
 [LibraryClasses.common.PEI_CORE]
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 475b88b21a4c..e3bb367b6bf6 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -232,7 +232,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
 
 [LibraryClasses.common.SEC]
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index 10b16104acd7..ce277cb2398b 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -251,7 +251,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
 
 [LibraryClasses.common.SEC]
@@ -275,7 +275,7 @@
 !else
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 !endif
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
 
 [LibraryClasses.common.PEI_CORE]
@@ -915,7 +915,7 @@
   #
   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
     <LibraryClasses>
-    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+    CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index c0c1a15b0926..345892651520 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -215,7 +215,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
   TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
   PlatformInitLib|OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
@@ -237,7 +237,7 @@
 !else
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 !endif
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
   PrePiHobListPointerLib|OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointerLibTdx.inf
   HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf b/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
index 35b7d519d938..cc24961c9265 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
@@ -51,7 +51,7 @@
   DebugLib
   MemoryAllocationLib
   PcdLib
-  VmgExitLib
+  CcExitLib
 
 [FeaturePcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf b/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf
index 714da3323765..8f56783da55e 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLib.inf
@@ -51,7 +51,7 @@
   DebugLib
   MemoryAllocationLib
   PcdLib
-  VmgExitLib
+  CcExitLib
 
 [FeaturePcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf b/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
index 284e5acc1177..b6d76e7e630f 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
@@ -48,7 +48,7 @@
   CpuLib
   DebugLib
   PcdLib
-  VmgExitLib
+  CcExitLib
 
 [FixedPcd]
   gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index d11aafae8472..73698a7b9d8c 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -13,7 +13,7 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/MemEncryptSevLib.h>
 #include <Library/DebugLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 
 #include <Register/Amd/Ghcb.h>
 #include <Register/Amd/Msr.h>
diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c b/OvmfPkg/Library/CcExitLib/CcExitLib.c
similarity index 94%
rename from OvmfPkg/Library/VmgExitLib/VmgExitLib.c
rename to OvmfPkg/Library/CcExitLib/CcExitLib.c
index c20552187074..477064cde2bb 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitLib.c
@@ -1,7 +1,8 @@
 /** @file
-  VMGEXIT Support Library.
+  CcExitLib Support Library.
 
   Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+  Copyright (C) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -9,7 +10,7 @@
 #include <Base.h>
 #include <Uefi.h>
 #include <Library/BaseMemoryLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Msr.h>
 
 /**
diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitLib.inf b/OvmfPkg/Library/CcExitLib/CcExitLib.inf
similarity index 66%
rename from OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
rename to OvmfPkg/Library/CcExitLib/CcExitLib.inf
index 255b0c1a2f7f..131fa6267522 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
+++ b/OvmfPkg/Library/CcExitLib/CcExitLib.inf
@@ -1,18 +1,19 @@
 ## @file
-#  VMGEXIT Support Library.
+#  CcExitLib Library.
 #
 #  Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+#  Copyright (C) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = VmgExitLib
+  BASE_NAME                      = CcExitLib
   FILE_GUID                      = 0e923c25-13cd-430b-8714-ffe85652a97b
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = VmgExitLib|PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_DRIVER
+  LIBRARY_CLASS                  = CcExitLib|PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_DRIVER
 
 #
 # The following information is for reference only and not required by the build tools.
@@ -21,11 +22,11 @@
 #
 
 [Sources.common]
-  VmgExitLib.c
-  VmgExitVcHandler.c
-  VmgExitVcHandler.h
-  PeiDxeVmgExitVcHandler.c
-  VmTdExitVeHandler.c
+  CcExitLib.c
+  CcExitVcHandler.c
+  CcExitVcHandler.h
+  PeiDxeCcExitVcHandler.c
+  CcExitVeHandler.c
   X64/TdVmcallCpuid.nasm
 
 [Packages]
diff --git a/OvmfPkg/Library/VmgExitLib/VmTdExitHandler.h b/OvmfPkg/Library/CcExitLib/CcExitTd.h
similarity index 86%
rename from OvmfPkg/Library/VmgExitLib/VmTdExitHandler.h
rename to OvmfPkg/Library/CcExitLib/CcExitTd.h
index 7eacd0872f46..013a55e2078c 100644
--- a/OvmfPkg/Library/VmgExitLib/VmTdExitHandler.h
+++ b/OvmfPkg/Library/CcExitLib/CcExitTd.h
@@ -5,8 +5,8 @@
 
 **/
 
-#ifndef VMTD_EXIT_HANDLER_H_
-#define VMTD_EXIT_HANDLER_H_
+#ifndef CC_EXIT_TD_H_
+#define CC_EXIT_TD_H_
 
 #include <Base.h>
 #include <Uefi.h>
diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
similarity index 95%
rename from OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
rename to OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
index a4393dffbd63..ad2a922c9f43 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
@@ -11,13 +11,12 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/LocalApicLib.h>
 #include <Library/MemEncryptSevLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Msr.h>
 #include <Register/Intel/Cpuid.h>
 #include <IndustryStandard/InstructionParsing.h>
 
-#include "VmgExitVcHandler.h"
-// #include <Library/MemEncryptSevLib.h>
+#include "CcExitVcHandler.h"
 
 //
 // Instruction execution mode definition
diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.h b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.h
similarity index 89%
rename from OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.h
rename to OvmfPkg/Library/CcExitLib/CcExitVcHandler.h
index 3a37cb04f616..464591fcb7bc 100644
--- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.h
+++ b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.h
@@ -6,12 +6,12 @@
 
 **/
 
-#ifndef __VMG_EXIT_VC_HANDLER_H__
-#define __VMG_EXIT_VC_HANDLER_H__
+#ifndef CC_EXIT_VC_HANDLER_H_
+#define CC_EXIT_VC_HANDLER_H_
 
 #include <Base.h>
 #include <Uefi.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 
 /**
   Handle a #VC exception.
diff --git a/OvmfPkg/Library/VmgExitLib/VmTdExitVeHandler.c b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
similarity index 95%
rename from OvmfPkg/Library/VmgExitLib/VmTdExitVeHandler.c
rename to OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
index c89268c5d8e8..08e92c66ce74 100644
--- a/OvmfPkg/Library/VmgExitLib/VmTdExitVeHandler.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
@@ -8,8 +8,8 @@
 
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
-#include "VmTdExitHandler.h"
-#include <Library/VmgExitLib.h>
+#include "CcExitTd.h"
+#include <Library/CcExitLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <IndustryStandard/Tdx.h>
 #include <IndustryStandard/InstructionParsing.h>
diff --git a/OvmfPkg/Library/VmgExitLib/PeiDxeVmgExitVcHandler.c b/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c
similarity index 94%
rename from OvmfPkg/Library/VmgExitLib/PeiDxeVmgExitVcHandler.c
rename to OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c
index e3d071583750..bb718161f588 100644
--- a/OvmfPkg/Library/VmgExitLib/PeiDxeVmgExitVcHandler.c
+++ b/OvmfPkg/Library/CcExitLib/PeiDxeCcExitVcHandler.c
@@ -10,10 +10,10 @@
 #include <Uefi.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/MemEncryptSevLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Msr.h>
 
-#include "VmgExitVcHandler.h"
+#include "CcExitVcHandler.h"
 
 /**
   Handle a #VC exception.
diff --git a/OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf b/OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
similarity index 79%
rename from OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
rename to OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
index f9bd4974f6dc..1ee22ce0aea1 100644
--- a/OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
+++ b/OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
@@ -8,11 +8,11 @@
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = SecVmgExitLib
+  BASE_NAME                      = SecCcExitLib
   FILE_GUID                      = dafff819-f86c-4cff-a70e-83161e5bcf9a
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = VmgExitLib|SEC
+  LIBRARY_CLASS                  = CcExitLib|SEC
 
 #
 # The following information is for reference only and not required by the build tools.
@@ -21,11 +21,11 @@
 #
 
 [Sources.common]
-  VmgExitLib.c
-  VmgExitVcHandler.c
-  VmgExitVcHandler.h
-  SecVmgExitVcHandler.c
-  VmTdExitVeHandler.c
+  CcExitLib.c
+  CcExitVcHandler.c
+  CcExitVcHandler.h
+  SecCcExitVcHandler.c
+  CcExitVeHandler.c
   X64/TdVmcallCpuid.nasm
 
 [Packages]
diff --git a/OvmfPkg/Library/VmgExitLib/SecVmgExitVcHandler.c b/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c
similarity index 94%
rename from OvmfPkg/Library/VmgExitLib/SecVmgExitVcHandler.c
rename to OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c
index fe8680f831d9..769e0b5b7417 100644
--- a/OvmfPkg/Library/VmgExitLib/SecVmgExitVcHandler.c
+++ b/OvmfPkg/Library/CcExitLib/SecCcExitVcHandler.c
@@ -10,10 +10,10 @@
 #include <Uefi.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/MemEncryptSevLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Msr.h>
 
-#include "VmgExitVcHandler.h"
+#include "CcExitVcHandler.h"
 
 /**
   Handle a #VC exception.
diff --git a/OvmfPkg/Library/VmgExitLib/X64/TdVmcallCpuid.nasm b/OvmfPkg/Library/CcExitLib/X64/TdVmcallCpuid.nasm
similarity index 100%
rename from OvmfPkg/Library/VmgExitLib/X64/TdVmcallCpuid.nasm
rename to OvmfPkg/Library/CcExitLib/X64/TdVmcallCpuid.nasm
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 7eff8e2a88d9..994a02d30107 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -249,7 +249,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
   SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
   PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
   FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
@@ -277,7 +277,7 @@
 !else
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 !endif
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
 
 [LibraryClasses.common.PEI_CORE]
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index e9ba491237ae..6f774baf90f5 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -256,7 +256,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
 
 [LibraryClasses.common.SEC]
   TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf
@@ -984,7 +984,7 @@
   #
   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
     <LibraryClasses>
-    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+    CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index af566b953f36..c851764dec05 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -260,7 +260,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
   TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
 
@@ -1002,7 +1002,7 @@
   #
   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
     <LibraryClasses>
-    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+    CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index f39d9cd117e6..63c3a47aea30 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -276,7 +276,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
   TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
 
@@ -302,7 +302,7 @@
 !else
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
 !endif
-  VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf
+  CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
   CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf
 
@@ -1072,7 +1072,7 @@
   #
   OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
     <LibraryClasses>
-    VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+    CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 58a7c97cddf7..8bb497088bd2 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -231,7 +231,7 @@
 
 [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
 
 [LibraryClasses.common.SEC]
diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index 385562b44c4e..80a1194ffcb9 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -19,7 +19,7 @@
 #include <PiPei.h>
 #include <Register/Amd/Msr.h>
 #include <Register/Intel/SmramSaveStateMap.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <ConfidentialComputingGuestAttr.h>
 
 #include "Platform.h"
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index 3cd83e6ec3e5..1fadadeb5565 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -63,7 +63,7 @@
   MtrrLib
   MemEncryptSevLib
   PcdLib
-  VmgExitLib
+  CcExitLib
   PlatformInitLib
 
 [Pcd]
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
index 8bb2325157ea..f47170478900 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
@@ -53,7 +53,7 @@
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   UefiRuntimeLib
-  VmgExitLib
+  CcExitLib
 
 [Guids]
   gEfiEventVirtualAddressChangeGuid   # ALWAYS_CONSUMED
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c
index 172d6a4267f8..58bcad825d57 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c
@@ -11,7 +11,7 @@
 
 #include <Library/UefiRuntimeLib.h>
 #include <Library/MemEncryptSevLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Msr.h>
 
 #include "QemuFlash.h"
diff --git a/UefiCpuPkg/Include/Library/VmgExitLib.h b/UefiCpuPkg/Include/Library/CcExitLib.h
similarity index 89%
rename from UefiCpuPkg/Include/Library/VmgExitLib.h
rename to UefiCpuPkg/Include/Library/CcExitLib.h
index f9f911099a7b..1ae618c19b9e 100644
--- a/UefiCpuPkg/Include/Library/VmgExitLib.h
+++ b/UefiCpuPkg/Include/Library/CcExitLib.h
@@ -1,16 +1,19 @@
 /** @file
-  Public header file for the VMGEXIT Support library class.
+  Public header file for the CcExitLib.
 
-  This library class defines some routines used when invoking the VMGEXIT
-  instruction in support of SEV-ES and to handle #VC exceptions.
+  This library class defines some routines used for below CcExit handler.
+   - Invoking the VMGEXIT instruction in support of SEV-ES and to handle
+     #VC exceptions.
+   - Handle #VE exception in TDX.
 
   Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#ifndef __VMG_EXIT_LIB_H__
-#define __VMG_EXIT_LIB_H__
+#ifndef CC_EXIT_LIB_H_
+#define CC_EXIT_LIB_H_
 
 #include <Protocol/DebugSupport.h>
 #include <Register/Amd/Ghcb.h>
diff --git a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c
similarity index 79%
rename from UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c
rename to UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c
index d661d8597434..79eca74e138f 100644
--- a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c
+++ b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.c
@@ -1,14 +1,15 @@
 /** @file
-  VMGEXIT Base Support Library.
+  CcExit Base Support Library.
 
   Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <Base.h>
 #include <Uefi.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 
 /**
   Perform VMGEXIT.
@@ -163,3 +164,31 @@ VmgExitHandleVc (
 
   return EFI_UNSUPPORTED;
 }
+
+/**
+  Handle a #VE exception.
+
+  Performs the necessary processing to handle a #VE exception.
+
+  @param[in, out]  ExceptionType  Pointer to an EFI_EXCEPTION_TYPE to be set
+                                  as value to use on error.
+  @param[in, out]  SystemContext  Pointer to EFI_SYSTEM_CONTEXT
+
+  @retval  EFI_SUCCESS            Exception handled
+  @retval  EFI_UNSUPPORTED        #VE not supported, (new) exception value to
+                                  propagate provided
+  @retval  EFI_PROTOCOL_ERROR     #VE handling failed, (new) exception value to
+                                  propagate provided
+
+**/
+EFI_STATUS
+EFIAPI
+VmTdExitHandleVe (
+  IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
+  IN OUT EFI_SYSTEM_CONTEXT  SystemContext
+  )
+{
+  *ExceptionType = VE_EXCEPTION;
+
+  return EFI_UNSUPPORTED;
+}
diff --git a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
similarity index 60%
rename from UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
rename to UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
index 4aab601939ff..ed7f611cbc7e 100644
--- a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+++ b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
@@ -1,23 +1,23 @@
 ## @file
-#  VMGEXIT Support Library.
+#  CcExit Base Support Library.
 #
 #  Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+#  Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = VmgExitLibNull
-  MODULE_UNI_FILE                = VmgExitLibNull.uni
+  BASE_NAME                      = CcExitLibNull
+  MODULE_UNI_FILE                = CcExitLibNull.uni
   FILE_GUID                      = 3cd7368f-ef9b-4a9b-9571-2ed93813677e
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = VmgExitLib
+  LIBRARY_CLASS                  = CcExitLib
 
 [Sources.common]
-  VmgExitLibNull.c
-  VmTdExitNull.c
+  CcExitLibNull.c
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
new file mode 100644
index 000000000000..b18ae8792ed7
--- /dev/null
+++ b/UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
@@ -0,0 +1,14 @@
+// /** @file
+// CcExitLib instance.
+//
+// Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
+// Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT             #language en-US "CcExitLib NULL instance"
+
+#string STR_MODULE_DESCRIPTION          #language en-US "CcExitLib NULL instance."
+
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
index e7a81bebdb13..d0f82095cf92 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@@ -60,4 +60,4 @@
   PeCoffGetEntryPointLib
   MemoryAllocationLib
   DebugLib
-  VmgExitLib
+  CcExitLib
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
index 7c2ec3b2db4c..5339f8e60404 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
@@ -52,7 +52,7 @@
   HobLib
   MemoryAllocationLib
   SynchronizationLib
-  VmgExitLib
+  CcExitLib
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard    # CONSUMES
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
index a7d0897ef1f9..2b6d9da5c713 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include <Library/DebugLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include "CpuExceptionCommon.h"
 
 /**
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
index ad5e0e9ed4f1..0a9ea79f52dc 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include <PiPei.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include "CpuExceptionCommon.h"
 
 CONST UINTN  mDoFarReturnFlag = 0;
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
index 6a170286c8fc..df44371fe018 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
@@ -48,7 +48,7 @@
   PrintLib
   LocalApicLib
   PeCoffGetEntryPointLib
-  VmgExitLib
+  CcExitLib
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
index 9dde07612a04..8f8a5dab7930 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
@@ -51,7 +51,7 @@
   LocalApicLib
   PeCoffGetEntryPointLib
   DebugLib
-  VmgExitLib
+  CcExitLib
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
index 6d2f66504a5b..619b39d7f1de 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
@@ -53,7 +53,7 @@
   PrintLib
   LocalApicLib
   PeCoffGetEntryPointLib
-  VmgExitLib
+  CcExitLib
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard
diff --git a/UefiCpuPkg/Library/MpInitLib/AmdSev.c b/UefiCpuPkg/Library/MpInitLib/AmdSev.c
index 4e4c63a52de4..2dd8f4d74621 100644
--- a/UefiCpuPkg/Library/MpInitLib/AmdSev.c
+++ b/UefiCpuPkg/Library/MpInitLib/AmdSev.c
@@ -8,7 +8,7 @@
 **/
 
 #include "MpLib.h"
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 
 /**
   Get Protected mode code segment with 16-bit default addressing
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index e1cd0b350008..cd07de3a3c0b 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -54,7 +54,7 @@
   DebugAgentLib
   SynchronizationLib
   PcdLib
-  VmgExitLib
+  CcExitLib
   MicrocodeLib
 
 [Protocols]
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index 78cc3e2b93fd..ef56af1f738b 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -12,7 +12,7 @@
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/DebugAgentLib.h>
 #include <Library/DxeServicesTableLib.h>
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Fam17Msr.h>
 #include <Register/Amd/Ghcb.h>
 
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 1c053f87a4c6..e5dc852ed95f 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -9,7 +9,7 @@
 **/
 
 #include "MpLib.h"
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Fam17Msr.h>
 #include <Register/Amd/Ghcb.h>
 
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index 5facf4db9499..afd551bb0f64 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -53,7 +53,7 @@
   SynchronizationLib
   PeiServicesLib
   PcdLib
-  VmgExitLib
+  CcExitLib
   MicrocodeLib
 
 [Pcd]
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c
index a3cd377ef600..4c4f81af7c22 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c
+++ b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c
@@ -9,7 +9,7 @@
 **/
 
 #include "MpLib.h"
-#include <Library/VmgExitLib.h>
+#include <Library/CcExitLib.h>
 #include <Register/Amd/Fam17Msr.h>
 #include <Register/Amd/Ghcb.h>
 
diff --git a/UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c b/UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
deleted file mode 100644
index 6a4e8087cb89..000000000000
--- a/UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/** @file
-
-  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#include <Base.h>
-#include <Uefi.h>
-#include <Library/VmgExitLib.h>
-
-/**
-  Handle a #VE exception.
-
-  Performs the necessary processing to handle a #VE exception.
-
-  @param[in, out]  ExceptionType  Pointer to an EFI_EXCEPTION_TYPE to be set
-                                  as value to use on error.
-  @param[in, out]  SystemContext  Pointer to EFI_SYSTEM_CONTEXT
-
-  @retval  EFI_SUCCESS            Exception handled
-  @retval  EFI_UNSUPPORTED        #VE not supported, (new) exception value to
-                                  propagate provided
-  @retval  EFI_PROTOCOL_ERROR     #VE handling failed, (new) exception value to
-                                  propagate provided
-
-**/
-EFI_STATUS
-EFIAPI
-VmTdExitHandleVe (
-  IN OUT EFI_EXCEPTION_TYPE  *ExceptionType,
-  IN OUT EFI_SYSTEM_CONTEXT  SystemContext
-  )
-{
-  *ExceptionType = VE_EXCEPTION;
-
-  return EFI_UNSUPPORTED;
-}
diff --git a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni b/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni
deleted file mode 100644
index 8639bc0e8ce9..000000000000
--- a/UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni
+++ /dev/null
@@ -1,15 +0,0 @@
-// /** @file
-// VMGEXIT support library instance.
-//
-// VMGEXIT support library instance.
-//
-// Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT             #language en-US "VMGEXIT support NULL library instance"
-
-#string STR_MODULE_DESCRIPTION          #language en-US "VMGEXIT support NULL library instance."
-
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 718323d9042c..cff239d5283e 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -53,8 +53,8 @@
   ##
   MpInitLib|Include/Library/MpInitLib.h
 
-  ##  @libraryclass  Provides function to support VMGEXIT processing.
-  VmgExitLib|Include/Library/VmgExitLib.h
+  ##  @libraryclass  Provides function to support CcExit processing.
+  CcExitLib|Include/Library/CcExitLib.h
 
   ##  @libraryclass  Provides function to get CPU cache information.
   CpuCacheInfoLib|Include/Library/CpuCacheInfoLib.h
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 0e1a99ddc09f..67b0ce46e455 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -59,7 +59,7 @@
   PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
   PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
   TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
   SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf
   CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
@@ -163,7 +163,7 @@
   UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
   UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
   UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
-  UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
   UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf
   UefiCpuPkg/SecCore/SecCore.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1150be6acd0e..723a50a42284 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -301,7 +301,7 @@
   VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
   VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
-  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
+  CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
   ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
 
 [LibraryClasses.common]
-- 
2.29.2.windows.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH V4 2/3] OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
  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
  2022-11-08  1:14 ` [PATCH V4 3/3] Maintainers: Update the VmgExitLib to CcExitLib Min Xu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Min Xu @ 2022-11-08  1:14 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Eric Dong, Ray Ni, Brijesh Singh, Erdem Aktas,
	Gerd Hoffmann, James Bottomley, Jiewen Yao, Tom Lendacky

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH V4 3/3] Maintainers: Update the VmgExitLib to CcExitLib
  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 ` [PATCH V4 2/3] OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib Min Xu
@ 2022-11-08  1:14 ` Min Xu
  2022-11-08  1:28 ` [edk2-stable202211] [PATCH V4 0/3] Rename " Yao, Jiewen
  2022-11-10  8:21 ` [edk2-devel] " Ni, Ray
  4 siblings, 0 replies; 8+ messages in thread
From: Min Xu @ 2022-11-08  1:14 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Michael D Kinney, Liming Gao, Erdem Aktas,
	Gerd Hoffmann, James Bottomley, Jiewen Yao, Tom Lendacky

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

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

VmgExitLib is renamed as CcExitLib. The related section in
Maintainers.txt should be updated as well.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
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>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 Maintainers.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index 889990fa566f..454b93420da4 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -475,7 +475,7 @@ F: OvmfPkg/Include/Library/MemEncryptSevLib.h
 F: OvmfPkg/IoMmuDxe/AmdSevIoMmu.*
 F: OvmfPkg/Library/BaseMemEncryptSevLib/
 F: OvmfPkg/Library/PlatformBootManagerLibGrub/
-F: OvmfPkg/Library/VmgExitLib/
+F: OvmfPkg/Library/CcExitLib/
 F: OvmfPkg/PlatformPei/AmdSev.c
 F: OvmfPkg/ResetVector/
 F: OvmfPkg/Sec/
-- 
2.29.2.windows.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-stable202211] [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
  2022-11-08  1:14 [PATCH V4 0/3] Rename VmgExitLib to CcExitLib Min Xu
                   ` (2 preceding siblings ...)
  2022-11-08  1:14 ` [PATCH V4 3/3] Maintainers: Update the VmgExitLib to CcExitLib Min Xu
@ 2022-11-08  1:28 ` Yao, Jiewen
  2022-11-10 16:38   ` Michael D Kinney
  2022-11-10  8:21 ` [edk2-devel] " Ni, Ray
  4 siblings, 1 reply; 8+ messages in thread
From: Yao, Jiewen @ 2022-11-08  1:28 UTC (permalink / raw)
  To: Xu, Min M, devel@edk2.groups.io
  Cc: Dong, Eric, Ni, Ray, Brijesh Singh, Aktas, Erdem, Gerd Hoffmann,
	James Bottomley, Tom Lendacky, Dong, Guo, Rhodes, Sean, Lu, James,
	Guo, Gua, Kinney, Michael D, Gao, Liming

Hi
I suggest we catch this to edk2-stable202211.

I already give R-B for V3 before soft-freeze.

The V4 just merges 2 patch into 1, based upon other feedback.

Thank you
Yao, Jiewen


> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Tuesday, November 8, 2022 9:15 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric <eric.dong@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Brijesh Singh <brijesh.singh@amd.com>; Aktas,
> Erdem <erdemaktas@google.com>; Gerd Hoffmann <kraxel@redhat.com>;
> James Bottomley <jejb@linux.ibm.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>;
> Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>
> Subject: [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123
> 
> VmgExitLib once was designed to provide interfaces to support #VC handler
> and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
> introduced, this library is updated to support #VE as well. Now the name
> of VmgExitLib cannot reflect what the lib does.
> 
> This patch-set renames VmgExitLib to CcExitLib (Cc means Confidential
> Computing). This is simple renaming and there is no logic changes. Then
> APIs defined in CcExitLib.h are added with a CcExit prefix. This is to
> make the name more meaningful.
> 
> Code: https://github.com/mxu9/edk2/tree/CcExitLib.v4
> 
> v4 changes:
>  - The previous versions of the patch-set are to first duplicate a new
>    CcExitLib then delete the old VmgExitLib. According to this comments
>    https://edk2.groups.io/g/devel/message/96019 it suggests renaming in
>    a single patch is better.
>  - Lib APIs are added with CcExit prefix, not CcExitLib prefix.
> 
> v3 changes:
>  - Rename CcExitHandleVc / CcExitHandleVe to
>    CcExitLibHandleVc / CcExitLibHandleVe to make the nameing consistent.
>  - Update the CcExitLib to merge the patch eff44c008d99
>   (OvmfPkg/VmgExitLig: HALT on #VE when access to private memory).
> 
> v2 changes:
>  - Patch #3 is added to import CcExitLib in OvmfPkg's *.dsc. This is to
>    prevent the building from being broken in the following patches.
> 
> 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>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Sean Rhodes <sean@starlabs.systems>
> Cc: James Lu <james.lu@intel.com>
> Cc: Gua Guo <gua.guo@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
> 
> Min M Xu (3):
>   OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib
>   OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
>   Maintainers: Update the VmgExitLib to CcExitLib
> 
>  Maintainers.txt                               |   2 +-
>  OvmfPkg/AmdSev/AmdSevX64.dsc                  |   4 +-
>  OvmfPkg/Bhyve/BhyveX64.dsc                    |   2 +-
>  OvmfPkg/CloudHv/CloudHvX64.dsc                |   6 +-
>  OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   4 +-
>  .../DxeMemEncryptSevLib.inf                   |   2 +-
>  .../PeiMemEncryptSevLib.inf                   |   2 +-
>  .../SecMemEncryptSevLib.inf                   |   2 +-
>  .../X64/SnpPageStateChangeInternal.c          |  10 +-
>  .../VmgExitLib.c => CcExitLib/CcExitLib.c}    |  23 ++--
>  .../CcExitLib.inf}                            |  17 +--
>  .../CcExitTd.h}                               |   4 +-
>  .../CcExitVcHandler.c}                        | 129 +++++++++---------
>  .../CcExitVcHandler.h}                        |   6 +-
>  .../CcExitVeHandler.c}                        |   6 +-
>  .../PeiDxeCcExitVcHandler.c}                  |   6 +-
>  .../SecCcExitLib.inf}                         |  14 +-
>  .../SecCcExitVcHandler.c}                     |   6 +-
>  .../X64/TdVmcallCpuid.nasm                    |   0
>  OvmfPkg/Microvm/MicrovmX64.dsc                |   4 +-
>  OvmfPkg/OvmfPkgIa32.dsc                       |   4 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc                    |   4 +-
>  OvmfPkg/OvmfPkgX64.dsc                        |   6 +-
>  OvmfPkg/OvmfXen.dsc                           |   2 +-
>  OvmfPkg/PlatformPei/AmdSev.c                  |  10 +-
>  OvmfPkg/PlatformPei/PlatformPei.inf           |   2 +-
>  .../FvbServicesRuntimeDxe.inf                 |   2 +-
>  .../QemuFlashDxe.c                            |  10 +-
>  .../Library/{VmgExitLib.h => CcExitLib.h}     |  29 ++--
>  .../CcExitLibNull.c}                          |  47 +++++--
>  .../CcExitLibNull.inf}                        |  12 +-
>  .../Library/CcExitLibNull/CcExitLibNull.uni   |  14 ++
>  .../DxeCpuExceptionHandlerLib.inf             |   2 +-
>  .../PeiCpuExceptionHandlerLib.inf             |   2 +-
>  .../PeiDxeSmmCpuException.c                   |   6 +-
>  .../SecPeiCpuException.c                      |   6 +-
>  .../SecPeiCpuExceptionHandlerLib.inf          |   2 +-
>  .../SmmCpuExceptionHandlerLib.inf             |   2 +-
>  .../Xcode5SecPeiCpuExceptionHandlerLib.inf    |   2 +-
>  UefiCpuPkg/Library/MpInitLib/AmdSev.c         |  10 +-
>  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |   2 +-
>  UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |   8 +-
>  UefiCpuPkg/Library/MpInitLib/MpLib.c          |   2 +-
>  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |   2 +-
>  UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c     |  10 +-
>  .../Library/VmgExitLibNull/VmTdExitNull.c     |  38 ------
>  .../Library/VmgExitLibNull/VmgExitLibNull.uni |  15 --
>  UefiCpuPkg/UefiCpuPkg.dec                     |   4 +-
>  UefiCpuPkg/UefiCpuPkg.dsc                     |   4 +-
>  UefiPayloadPkg/UefiPayloadPkg.dsc             |   2 +-
>  50 files changed, 252 insertions(+), 258 deletions(-)
>  rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.c => CcExitLib/CcExitLib.c}
> (89%)
>  rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.inf =>
> CcExitLib/CcExitLib.inf} (66%)
>  rename OvmfPkg/Library/{VmgExitLib/VmTdExitHandler.h =>
> CcExitLib/CcExitTd.h} (86%)
>  rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.c =>
> CcExitLib/CcExitVcHandler.c} (90%)
>  rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.h =>
> CcExitLib/CcExitVcHandler.h} (89%)
>  rename OvmfPkg/Library/{VmgExitLib/VmTdExitVeHandler.c =>
> CcExitLib/CcExitVeHandler.c} (95%)
>  rename OvmfPkg/Library/{VmgExitLib/PeiDxeVmgExitVcHandler.c =>
> CcExitLib/PeiDxeCcExitVcHandler.c} (93%)
>  rename OvmfPkg/Library/{VmgExitLib/SecVmgExitLib.inf =>
> CcExitLib/SecCcExitLib.inf} (79%)
>  rename OvmfPkg/Library/{VmgExitLib/SecVmgExitVcHandler.c =>
> CcExitLib/SecCcExitVcHandler.c} (93%)
>  rename OvmfPkg/Library/{VmgExitLib =>
> CcExitLib}/X64/TdVmcallCpuid.nasm (100%)
>  rename UefiCpuPkg/Include/Library/{VmgExitLib.h => CcExitLib.h} (87%)
>  rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.c =>
> CcExitLibNull/CcExitLibNull.c} (76%)
>  rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.inf =>
> CcExitLibNull/CcExitLibNull.inf} (60%)
>  create mode 100644 UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
>  delete mode 100644 UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
>  delete mode 100644
> UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni
> 
> --
> 2.29.2.windows.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
  2022-11-08  1:14 [PATCH V4 0/3] Rename VmgExitLib to CcExitLib Min Xu
                   ` (3 preceding siblings ...)
  2022-11-08  1:28 ` [edk2-stable202211] [PATCH V4 0/3] Rename " Yao, Jiewen
@ 2022-11-10  8:21 ` Ni, Ray
  4 siblings, 0 replies; 8+ messages in thread
From: Ni, Ray @ 2022-11-10  8:21 UTC (permalink / raw)
  To: Min Xu, devel

[-- Attachment #1: Type: text/plain, Size: 40 bytes --]

Reviewed-by: Ray Ni <ray.ni@intel.com>

[-- Attachment #2: Type: text/html, Size: 99 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-stable202211] [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Michael D Kinney @ 2022-11-10 16:38 UTC (permalink / raw)
  To: Yao, Jiewen, Xu, Min M, devel@edk2.groups.io, Kinney, Michael D
  Cc: Dong, Eric, Ni, Ray, Brijesh Singh, Aktas, Erdem, Gerd Hoffmann,
	James Bottomley, Tom Lendacky, Dong, Guo, Rhodes, Sean, Lu, James,
	Guo, Gua, Gao, Liming

Hi Jiewen,

Changing the name of a library is a non-backwards compatible change from a platform DSC
file perspective for downstream consumers.

Whenever any type of non-backwards compatible change is made, we need to highlight
that in the commit messages and the Patch #0.

The rename is clearly documented in this series.  I am only asking that the
non-backwards compatible aspect be highlighted along with instructions on what
updates to a downstream platform DSC are required.

We can work on ways to collect this type of information into a release note
format so the changes required to move from one release to the next are
clearly documented.

Best regards,

Mike

> -----Original Message-----
> From: Yao, Jiewen <jiewen.yao@intel.com>
> Sent: Monday, November 7, 2022 5:28 PM
> To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Brijesh Singh <brijesh.singh@amd.com>; Aktas, Erdem
> <erdemaktas@google.com>; Gerd Hoffmann <kraxel@redhat.com>; James Bottomley <jejb@linux.ibm.com>; Tom Lendacky
> <thomas.lendacky@amd.com>; Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>;
> Guo, Gua <gua.guo@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
> Subject: [edk2-stable202211] [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
> 
> Hi
> I suggest we catch this to edk2-stable202211.
> 
> I already give R-B for V3 before soft-freeze.
> 
> The V4 just merges 2 patch into 1, based upon other feedback.
> 
> Thank you
> Yao, Jiewen
> 
> 
> > -----Original Message-----
> > From: Xu, Min M <min.m.xu@intel.com>
> > Sent: Tuesday, November 8, 2022 9:15 AM
> > To: devel@edk2.groups.io
> > Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric <eric.dong@intel.com>;
> > Ni, Ray <ray.ni@intel.com>; Brijesh Singh <brijesh.singh@amd.com>; Aktas,
> > Erdem <erdemaktas@google.com>; Gerd Hoffmann <kraxel@redhat.com>;
> > James Bottomley <jejb@linux.ibm.com>; Yao, Jiewen
> > <jiewen.yao@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> > Dong, Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>;
> > Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Kinney,
> > Michael D <michael.d.kinney@intel.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>
> > Subject: [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123
> >
> > VmgExitLib once was designed to provide interfaces to support #VC handler
> > and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
> > introduced, this library is updated to support #VE as well. Now the name
> > of VmgExitLib cannot reflect what the lib does.
> >
> > This patch-set renames VmgExitLib to CcExitLib (Cc means Confidential
> > Computing). This is simple renaming and there is no logic changes. Then
> > APIs defined in CcExitLib.h are added with a CcExit prefix. This is to
> > make the name more meaningful.
> >
> > Code: https://github.com/mxu9/edk2/tree/CcExitLib.v4
> >
> > v4 changes:
> >  - The previous versions of the patch-set are to first duplicate a new
> >    CcExitLib then delete the old VmgExitLib. According to this comments
> >    https://edk2.groups.io/g/devel/message/96019 it suggests renaming in
> >    a single patch is better.
> >  - Lib APIs are added with CcExit prefix, not CcExitLib prefix.
> >
> > v3 changes:
> >  - Rename CcExitHandleVc / CcExitHandleVe to
> >    CcExitLibHandleVc / CcExitLibHandleVe to make the nameing consistent.
> >  - Update the CcExitLib to merge the patch eff44c008d99
> >   (OvmfPkg/VmgExitLig: HALT on #VE when access to private memory).
> >
> > v2 changes:
> >  - Patch #3 is added to import CcExitLib in OvmfPkg's *.dsc. This is to
> >    prevent the building from being broken in the following patches.
> >
> > 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>
> > Cc: Guo Dong <guo.dong@intel.com>
> > Cc: Sean Rhodes <sean@starlabs.systems>
> > Cc: James Lu <james.lu@intel.com>
> > Cc: Gua Guo <gua.guo@intel.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
> > Signed-off-by: Min Xu <min.m.xu@intel.com>
> >
> > Min M Xu (3):
> >   OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib
> >   OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
> >   Maintainers: Update the VmgExitLib to CcExitLib
> >
> >  Maintainers.txt                               |   2 +-
> >  OvmfPkg/AmdSev/AmdSevX64.dsc                  |   4 +-
> >  OvmfPkg/Bhyve/BhyveX64.dsc                    |   2 +-
> >  OvmfPkg/CloudHv/CloudHvX64.dsc                |   6 +-
> >  OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   4 +-
> >  .../DxeMemEncryptSevLib.inf                   |   2 +-
> >  .../PeiMemEncryptSevLib.inf                   |   2 +-
> >  .../SecMemEncryptSevLib.inf                   |   2 +-
> >  .../X64/SnpPageStateChangeInternal.c          |  10 +-
> >  .../VmgExitLib.c => CcExitLib/CcExitLib.c}    |  23 ++--
> >  .../CcExitLib.inf}                            |  17 +--
> >  .../CcExitTd.h}                               |   4 +-
> >  .../CcExitVcHandler.c}                        | 129 +++++++++---------
> >  .../CcExitVcHandler.h}                        |   6 +-
> >  .../CcExitVeHandler.c}                        |   6 +-
> >  .../PeiDxeCcExitVcHandler.c}                  |   6 +-
> >  .../SecCcExitLib.inf}                         |  14 +-
> >  .../SecCcExitVcHandler.c}                     |   6 +-
> >  .../X64/TdVmcallCpuid.nasm                    |   0
> >  OvmfPkg/Microvm/MicrovmX64.dsc                |   4 +-
> >  OvmfPkg/OvmfPkgIa32.dsc                       |   4 +-
> >  OvmfPkg/OvmfPkgIa32X64.dsc                    |   4 +-
> >  OvmfPkg/OvmfPkgX64.dsc                        |   6 +-
> >  OvmfPkg/OvmfXen.dsc                           |   2 +-
> >  OvmfPkg/PlatformPei/AmdSev.c                  |  10 +-
> >  OvmfPkg/PlatformPei/PlatformPei.inf           |   2 +-
> >  .../FvbServicesRuntimeDxe.inf                 |   2 +-
> >  .../QemuFlashDxe.c                            |  10 +-
> >  .../Library/{VmgExitLib.h => CcExitLib.h}     |  29 ++--
> >  .../CcExitLibNull.c}                          |  47 +++++--
> >  .../CcExitLibNull.inf}                        |  12 +-
> >  .../Library/CcExitLibNull/CcExitLibNull.uni   |  14 ++
> >  .../DxeCpuExceptionHandlerLib.inf             |   2 +-
> >  .../PeiCpuExceptionHandlerLib.inf             |   2 +-
> >  .../PeiDxeSmmCpuException.c                   |   6 +-
> >  .../SecPeiCpuException.c                      |   6 +-
> >  .../SecPeiCpuExceptionHandlerLib.inf          |   2 +-
> >  .../SmmCpuExceptionHandlerLib.inf             |   2 +-
> >  .../Xcode5SecPeiCpuExceptionHandlerLib.inf    |   2 +-
> >  UefiCpuPkg/Library/MpInitLib/AmdSev.c         |  10 +-
> >  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |   2 +-
> >  UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |   8 +-
> >  UefiCpuPkg/Library/MpInitLib/MpLib.c          |   2 +-
> >  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |   2 +-
> >  UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c     |  10 +-
> >  .../Library/VmgExitLibNull/VmTdExitNull.c     |  38 ------
> >  .../Library/VmgExitLibNull/VmgExitLibNull.uni |  15 --
> >  UefiCpuPkg/UefiCpuPkg.dec                     |   4 +-
> >  UefiCpuPkg/UefiCpuPkg.dsc                     |   4 +-
> >  UefiPayloadPkg/UefiPayloadPkg.dsc             |   2 +-
> >  50 files changed, 252 insertions(+), 258 deletions(-)
> >  rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.c => CcExitLib/CcExitLib.c}
> > (89%)
> >  rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.inf =>
> > CcExitLib/CcExitLib.inf} (66%)
> >  rename OvmfPkg/Library/{VmgExitLib/VmTdExitHandler.h =>
> > CcExitLib/CcExitTd.h} (86%)
> >  rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.c =>
> > CcExitLib/CcExitVcHandler.c} (90%)
> >  rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.h =>
> > CcExitLib/CcExitVcHandler.h} (89%)
> >  rename OvmfPkg/Library/{VmgExitLib/VmTdExitVeHandler.c =>
> > CcExitLib/CcExitVeHandler.c} (95%)
> >  rename OvmfPkg/Library/{VmgExitLib/PeiDxeVmgExitVcHandler.c =>
> > CcExitLib/PeiDxeCcExitVcHandler.c} (93%)
> >  rename OvmfPkg/Library/{VmgExitLib/SecVmgExitLib.inf =>
> > CcExitLib/SecCcExitLib.inf} (79%)
> >  rename OvmfPkg/Library/{VmgExitLib/SecVmgExitVcHandler.c =>
> > CcExitLib/SecCcExitVcHandler.c} (93%)
> >  rename OvmfPkg/Library/{VmgExitLib =>
> > CcExitLib}/X64/TdVmcallCpuid.nasm (100%)
> >  rename UefiCpuPkg/Include/Library/{VmgExitLib.h => CcExitLib.h} (87%)
> >  rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.c =>
> > CcExitLibNull/CcExitLibNull.c} (76%)
> >  rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.inf =>
> > CcExitLibNull/CcExitLibNull.inf} (60%)
> >  create mode 100644 UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
> >  delete mode 100644 UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
> >  delete mode 100644
> > UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni
> >
> > --
> > 2.29.2.windows.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-stable202211] [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
  2022-11-10 16:38   ` Michael D Kinney
@ 2022-11-10 17:06     ` Yao, Jiewen
  0 siblings, 0 replies; 8+ messages in thread
From: Yao, Jiewen @ 2022-11-10 17:06 UTC (permalink / raw)
  To: Kinney, Michael D, Xu, Min M, devel@edk2.groups.io
  Cc: Dong, Eric, Ni, Ray, Brijesh Singh, Aktas, Erdem, Gerd Hoffmann,
	James Bottomley, Tom Lendacky, Dong, Guo, Rhodes, Sean, Lu, James,
	Guo, Gua, Gao, Liming

Yes, Mike. Good point.

We will send a new patch to highlight: 1) incompatibility change, 2) how to upgrade.

Thanks for the suggestion.


> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Friday, November 11, 2022 12:39 AM
> To: Yao, Jiewen <jiewen.yao@intel.com>; Xu, Min M
> <min.m.xu@intel.com>; devel@edk2.groups.io; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Brijesh
> Singh <brijesh.singh@amd.com>; Aktas, Erdem <erdemaktas@google.com>;
> Gerd Hoffmann <kraxel@redhat.com>; James Bottomley
> <jejb@linux.ibm.com>; Tom Lendacky <thomas.lendacky@amd.com>; Dong,
> Guo <guo.dong@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu,
> James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>
> Subject: RE: [edk2-stable202211] [PATCH V4 0/3] Rename VmgExitLib to
> CcExitLib
> 
> Hi Jiewen,
> 
> Changing the name of a library is a non-backwards compatible change from
> a platform DSC
> file perspective for downstream consumers.
> 
> Whenever any type of non-backwards compatible change is made, we need
> to highlight
> that in the commit messages and the Patch #0.
> 
> The rename is clearly documented in this series.  I am only asking that the
> non-backwards compatible aspect be highlighted along with instructions on
> what
> updates to a downstream platform DSC are required.
> 
> We can work on ways to collect this type of information into a release note
> format so the changes required to move from one release to the next are
> clearly documented.
> 
> Best regards,
> 
> Mike
> 
> > -----Original Message-----
> > From: Yao, Jiewen <jiewen.yao@intel.com>
> > Sent: Monday, November 7, 2022 5:28 PM
> > To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
> > Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Brijesh
> Singh <brijesh.singh@amd.com>; Aktas, Erdem
> > <erdemaktas@google.com>; Gerd Hoffmann <kraxel@redhat.com>;
> James Bottomley <jejb@linux.ibm.com>; Tom Lendacky
> > <thomas.lendacky@amd.com>; Dong, Guo <guo.dong@intel.com>;
> Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>;
> > Guo, Gua <gua.guo@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
> > Subject: [edk2-stable202211] [PATCH V4 0/3] Rename VmgExitLib to
> CcExitLib
> >
> > Hi
> > I suggest we catch this to edk2-stable202211.
> >
> > I already give R-B for V3 before soft-freeze.
> >
> > The V4 just merges 2 patch into 1, based upon other feedback.
> >
> > Thank you
> > Yao, Jiewen
> >
> >
> > > -----Original Message-----
> > > From: Xu, Min M <min.m.xu@intel.com>
> > > Sent: Tuesday, November 8, 2022 9:15 AM
> > > To: devel@edk2.groups.io
> > > Cc: Xu, Min M <min.m.xu@intel.com>; Dong, Eric
> <eric.dong@intel.com>;
> > > Ni, Ray <ray.ni@intel.com>; Brijesh Singh <brijesh.singh@amd.com>;
> Aktas,
> > > Erdem <erdemaktas@google.com>; Gerd Hoffmann
> <kraxel@redhat.com>;
> > > James Bottomley <jejb@linux.ibm.com>; Yao, Jiewen
> > > <jiewen.yao@intel.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> > > Dong, Guo <guo.dong@intel.com>; Rhodes, Sean
> <sean@starlabs.systems>;
> > > Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>;
> Kinney,
> > > Michael D <michael.d.kinney@intel.com>; Gao, Liming
> > > <gaoliming@byosoft.com.cn>
> > > Subject: [PATCH V4 0/3] Rename VmgExitLib to CcExitLib
> > >
> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123
> > >
> > > VmgExitLib once was designed to provide interfaces to support #VC
> handler
> > > and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF)
> is
> > > introduced, this library is updated to support #VE as well. Now the
> name
> > > of VmgExitLib cannot reflect what the lib does.
> > >
> > > This patch-set renames VmgExitLib to CcExitLib (Cc means Confidential
> > > Computing). This is simple renaming and there is no logic changes. Then
> > > APIs defined in CcExitLib.h are added with a CcExit prefix. This is to
> > > make the name more meaningful.
> > >
> > > Code: https://github.com/mxu9/edk2/tree/CcExitLib.v4
> > >
> > > v4 changes:
> > >  - The previous versions of the patch-set are to first duplicate a new
> > >    CcExitLib then delete the old VmgExitLib. According to this comments
> > >    https://edk2.groups.io/g/devel/message/96019 it suggests renaming
> in
> > >    a single patch is better.
> > >  - Lib APIs are added with CcExit prefix, not CcExitLib prefix.
> > >
> > > v3 changes:
> > >  - Rename CcExitHandleVc / CcExitHandleVe to
> > >    CcExitLibHandleVc / CcExitLibHandleVe to make the nameing
> consistent.
> > >  - Update the CcExitLib to merge the patch eff44c008d99
> > >   (OvmfPkg/VmgExitLig: HALT on #VE when access to private memory).
> > >
> > > v2 changes:
> > >  - Patch #3 is added to import CcExitLib in OvmfPkg's *.dsc. This is to
> > >    prevent the building from being broken in the following patches.
> > >
> > > 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>
> > > Cc: Guo Dong <guo.dong@intel.com>
> > > Cc: Sean Rhodes <sean@starlabs.systems>
> > > Cc: James Lu <james.lu@intel.com>
> > > Cc: Gua Guo <gua.guo@intel.com>
> > > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
> > > Signed-off-by: Min Xu <min.m.xu@intel.com>
> > >
> > > Min M Xu (3):
> > >   OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib
> > >   OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
> > >   Maintainers: Update the VmgExitLib to CcExitLib
> > >
> > >  Maintainers.txt                               |   2 +-
> > >  OvmfPkg/AmdSev/AmdSevX64.dsc                  |   4 +-
> > >  OvmfPkg/Bhyve/BhyveX64.dsc                    |   2 +-
> > >  OvmfPkg/CloudHv/CloudHvX64.dsc                |   6 +-
> > >  OvmfPkg/IntelTdx/IntelTdxX64.dsc              |   4 +-
> > >  .../DxeMemEncryptSevLib.inf                   |   2 +-
> > >  .../PeiMemEncryptSevLib.inf                   |   2 +-
> > >  .../SecMemEncryptSevLib.inf                   |   2 +-
> > >  .../X64/SnpPageStateChangeInternal.c          |  10 +-
> > >  .../VmgExitLib.c => CcExitLib/CcExitLib.c}    |  23 ++--
> > >  .../CcExitLib.inf}                            |  17 +--
> > >  .../CcExitTd.h}                               |   4 +-
> > >  .../CcExitVcHandler.c}                        | 129 +++++++++---------
> > >  .../CcExitVcHandler.h}                        |   6 +-
> > >  .../CcExitVeHandler.c}                        |   6 +-
> > >  .../PeiDxeCcExitVcHandler.c}                  |   6 +-
> > >  .../SecCcExitLib.inf}                         |  14 +-
> > >  .../SecCcExitVcHandler.c}                     |   6 +-
> > >  .../X64/TdVmcallCpuid.nasm                    |   0
> > >  OvmfPkg/Microvm/MicrovmX64.dsc                |   4 +-
> > >  OvmfPkg/OvmfPkgIa32.dsc                       |   4 +-
> > >  OvmfPkg/OvmfPkgIa32X64.dsc                    |   4 +-
> > >  OvmfPkg/OvmfPkgX64.dsc                        |   6 +-
> > >  OvmfPkg/OvmfXen.dsc                           |   2 +-
> > >  OvmfPkg/PlatformPei/AmdSev.c                  |  10 +-
> > >  OvmfPkg/PlatformPei/PlatformPei.inf           |   2 +-
> > >  .../FvbServicesRuntimeDxe.inf                 |   2 +-
> > >  .../QemuFlashDxe.c                            |  10 +-
> > >  .../Library/{VmgExitLib.h => CcExitLib.h}     |  29 ++--
> > >  .../CcExitLibNull.c}                          |  47 +++++--
> > >  .../CcExitLibNull.inf}                        |  12 +-
> > >  .../Library/CcExitLibNull/CcExitLibNull.uni   |  14 ++
> > >  .../DxeCpuExceptionHandlerLib.inf             |   2 +-
> > >  .../PeiCpuExceptionHandlerLib.inf             |   2 +-
> > >  .../PeiDxeSmmCpuException.c                   |   6 +-
> > >  .../SecPeiCpuException.c                      |   6 +-
> > >  .../SecPeiCpuExceptionHandlerLib.inf          |   2 +-
> > >  .../SmmCpuExceptionHandlerLib.inf             |   2 +-
> > >  .../Xcode5SecPeiCpuExceptionHandlerLib.inf    |   2 +-
> > >  UefiCpuPkg/Library/MpInitLib/AmdSev.c         |  10 +-
> > >  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |   2 +-
> > >  UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       |   8 +-
> > >  UefiCpuPkg/Library/MpInitLib/MpLib.c          |   2 +-
> > >  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf |   2 +-
> > >  UefiCpuPkg/Library/MpInitLib/X64/AmdSev.c     |  10 +-
> > >  .../Library/VmgExitLibNull/VmTdExitNull.c     |  38 ------
> > >  .../Library/VmgExitLibNull/VmgExitLibNull.uni |  15 --
> > >  UefiCpuPkg/UefiCpuPkg.dec                     |   4 +-
> > >  UefiCpuPkg/UefiCpuPkg.dsc                     |   4 +-
> > >  UefiPayloadPkg/UefiPayloadPkg.dsc             |   2 +-
> > >  50 files changed, 252 insertions(+), 258 deletions(-)
> > >  rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.c =>
> CcExitLib/CcExitLib.c}
> > > (89%)
> > >  rename OvmfPkg/Library/{VmgExitLib/VmgExitLib.inf =>
> > > CcExitLib/CcExitLib.inf} (66%)
> > >  rename OvmfPkg/Library/{VmgExitLib/VmTdExitHandler.h =>
> > > CcExitLib/CcExitTd.h} (86%)
> > >  rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.c =>
> > > CcExitLib/CcExitVcHandler.c} (90%)
> > >  rename OvmfPkg/Library/{VmgExitLib/VmgExitVcHandler.h =>
> > > CcExitLib/CcExitVcHandler.h} (89%)
> > >  rename OvmfPkg/Library/{VmgExitLib/VmTdExitVeHandler.c =>
> > > CcExitLib/CcExitVeHandler.c} (95%)
> > >  rename OvmfPkg/Library/{VmgExitLib/PeiDxeVmgExitVcHandler.c =>
> > > CcExitLib/PeiDxeCcExitVcHandler.c} (93%)
> > >  rename OvmfPkg/Library/{VmgExitLib/SecVmgExitLib.inf =>
> > > CcExitLib/SecCcExitLib.inf} (79%)
> > >  rename OvmfPkg/Library/{VmgExitLib/SecVmgExitVcHandler.c =>
> > > CcExitLib/SecCcExitVcHandler.c} (93%)
> > >  rename OvmfPkg/Library/{VmgExitLib =>
> > > CcExitLib}/X64/TdVmcallCpuid.nasm (100%)
> > >  rename UefiCpuPkg/Include/Library/{VmgExitLib.h => CcExitLib.h} (87%)
> > >  rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.c =>
> > > CcExitLibNull/CcExitLibNull.c} (76%)
> > >  rename UefiCpuPkg/Library/{VmgExitLibNull/VmgExitLibNull.inf =>
> > > CcExitLibNull/CcExitLibNull.inf} (60%)
> > >  create mode 100644
> UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.uni
> > >  delete mode 100644
> UefiCpuPkg/Library/VmgExitLibNull/VmTdExitNull.c
> > >  delete mode 100644
> > > UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni
> > >
> > > --
> > > 2.29.2.windows.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-10 17:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH V4 2/3] OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib Min Xu
2022-11-08  1:14 ` [PATCH V4 3/3] Maintainers: Update the VmgExitLib to CcExitLib 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox