From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min M Xu <min.m.xu@intel.com>, Eric Dong <eric.dong@intel.com>,
Ray Ni <ray.ni@intel.com>, Brijesh Singh <brijesh.singh@amd.com>,
Erdem Aktas <erdemaktas@google.com>,
Gerd Hoffmann <kraxel@redhat.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: [PATCH V3 4/9] UefiCpuPkg: Use CcExitLib instead of VmgExitLib
Date: Mon, 7 Nov 2022 08:27:12 +0800 [thread overview]
Message-ID: <20221107002717.461-5-min.m.xu@intel.com> (raw)
In-Reply-To: <20221107002717.461-1-min.m.xu@intel.com>
From: Min M Xu <min.m.xu@intel.com>
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4123
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. So VmgExitLib is replaced
by CcExitLib.
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>
---
.../DxeCpuExceptionHandlerLib.inf | 2 +-
.../PeiCpuExceptionHandlerLib.inf | 2 +-
.../CpuExceptionHandlerLib/PeiDxeSmmCpuException.c | 6 +++---
.../CpuExceptionHandlerLib/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 +++++-----
UefiCpuPkg/UefiCpuPkg.dsc | 2 ++
14 files changed, 30 insertions(+), 28 deletions(-)
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..588f0e1809a2 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"
/**
@@ -40,7 +40,7 @@ CommonExceptionHandlerWorker (
// On other - ExceptionType contains (possibly new) exception
// value
//
- Status = VmgExitHandleVc (&ExceptionType, SystemContext);
+ Status = CcExitLibHandleVc (&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 = CcExitLibHandleVe (&ExceptionType, SystemContext);
if (!EFI_ERROR (Status)) {
return;
}
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c
index ad5e0e9ed4f1..bb1d173eba6d 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;
@@ -39,7 +39,7 @@ CommonExceptionHandler (
// On other - ExceptionType contains (possibly new) exception
// value
//
- Status = VmgExitHandleVc (&ExceptionType, SystemContext);
+ Status = CcExitLibHandleVc (&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 = CcExitLibHandleVe (&ExceptionType, SystemContext);
if (!EFI_ERROR (Status)) {
return;
}
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..9af108fcb5ff 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
@@ -209,7 +209,7 @@ SevEsPlaceApHlt (
Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
Ghcb = Msr.Ghcb;
- VmgInit (Ghcb, &InterruptState);
+ CcExitLibVmgInit (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 = CcExitLibVmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0);
if ((Status == 0) && (Ghcb->SaveArea.SwExitInfo2 != 0)) {
- VmgDone (Ghcb, InterruptState);
+ CcExitLibVmgDone (Ghcb, InterruptState);
break;
}
- VmgDone (Ghcb, InterruptState);
+ CcExitLibVmgDone (Ghcb, InterruptState);
}
//
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..8c7a131a0a3f 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>
@@ -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);
+ CcExitLibVmgInit (Ghcb, &InterruptState);
+ CcExitLibVmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64)(UINTN)StartAddress);
+ CcExitLibVmgDone (Ghcb, InterruptState);
return (UINTN)StartAddress;
}
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..933f765f3f5e 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>
@@ -150,16 +150,16 @@ SevSnpCreateSaveArea (
Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
Ghcb = Msr.Ghcb;
- VmgInit (Ghcb, &InterruptState);
+ CcExitLibVmgInit (Ghcb, &InterruptState);
Ghcb->SaveArea.Rax = SaveArea->SevFeatures;
- VmgSetOffsetValid (Ghcb, GhcbRax);
- VmgExitStatus = VmgExit (
+ CcExitLibVmgSetOffsetValid (Ghcb, GhcbRax);
+ VmgExitStatus = CcExitLibVmgExit (
Ghcb,
SVM_EXIT_SNP_AP_CREATION,
ExitInfo1,
ExitInfo2
);
- VmgDone (Ghcb, InterruptState);
+ CcExitLibVmgDone (Ghcb, InterruptState);
ASSERT (VmgExitStatus == 0);
if (VmgExitStatus != 0) {
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 0e1a99ddc09f..57c74ba844d2 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -60,6 +60,7 @@
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
@@ -164,6 +165,7 @@
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
--
2.29.2.windows.2
next prev parent reply other threads:[~2022-11-07 0:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 0:27 [PATCH V3 0/9] Rename VmgExitLib to CcExitLib Min Xu
2022-11-07 0:27 ` [PATCH V3 1/9] UefiCpuPkg: Add CcExitLib Min Xu
2022-11-07 0:27 ` [PATCH V3 2/9] OvmfPkg: Implement CcExitLib Min Xu
2022-11-07 0:27 ` [PATCH V3 3/9] OvmfPkg: Add CcExitLib in *.dsc Min Xu
2022-11-07 0:27 ` Min Xu [this message]
2022-11-07 0:27 ` [PATCH V3 5/9] UefiPayloadPkg: Use CcExitLib instead of VmgExitLib Min Xu
2022-11-07 0:27 ` [PATCH V3 6/9] OvmfPkg: " Min Xu
2022-11-07 0:27 ` [PATCH V3 7/9] OvmfPkg: Delete VmgExitLib Min Xu
2022-11-07 0:27 ` [PATCH V3 8/9] UefiCpuPkg: " Min Xu
2022-11-07 0:27 ` [PATCH V3 9/9] Maintainers: Update the VmgExitLib to CcExitLib Min Xu
2022-11-07 5:32 ` [edk2-devel] [PATCH V3 0/9] Rename " Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221107002717.461-5-min.m.xu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox