OvmfPkg/UefiCpuPkg/UefiPayloadPkg: 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 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>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
This commit is contained in:
Min M Xu 2022-11-07 14:30:26 +08:00 committed by mergify[bot]
parent b9e702c3c9
commit a89f558d3c
49 changed files with 135 additions and 141 deletions

View File

@ -204,7 +204,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
[LibraryClasses.common.SEC] [LibraryClasses.common.SEC]
@ -229,7 +229,7 @@
!else !else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
!endif !endif
VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
[LibraryClasses.common.PEI_CORE] [LibraryClasses.common.PEI_CORE]

View File

@ -232,7 +232,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
[LibraryClasses.common.SEC] [LibraryClasses.common.SEC]

View File

@ -251,7 +251,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
[LibraryClasses.common.SEC] [LibraryClasses.common.SEC]
@ -275,7 +275,7 @@
!else !else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
!endif !endif
VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
[LibraryClasses.common.PEI_CORE] [LibraryClasses.common.PEI_CORE]
@ -915,7 +915,7 @@
# #
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf { OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
<LibraryClasses> <LibraryClasses>
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
} }
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {

View File

@ -215,7 +215,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
PlatformInitLib|OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf PlatformInitLib|OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
@ -237,7 +237,7 @@
!else !else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
!endif !endif
VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
PrePiHobListPointerLib|OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointerLibTdx.inf PrePiHobListPointerLib|OvmfPkg/IntelTdx/PrePiHobListPointerLibTdx/PrePiHobListPointerLibTdx.inf
HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf

View File

@ -51,7 +51,7 @@
DebugLib DebugLib
MemoryAllocationLib MemoryAllocationLib
PcdLib PcdLib
VmgExitLib CcExitLib
[FeaturePcd] [FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire

View File

@ -51,7 +51,7 @@
DebugLib DebugLib
MemoryAllocationLib MemoryAllocationLib
PcdLib PcdLib
VmgExitLib CcExitLib
[FeaturePcd] [FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire

View File

@ -48,7 +48,7 @@
CpuLib CpuLib
DebugLib DebugLib
PcdLib PcdLib
VmgExitLib CcExitLib
[FixedPcd] [FixedPcd]
gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase

View File

@ -13,7 +13,7 @@
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemEncryptSevLib.h> #include <Library/MemEncryptSevLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Ghcb.h> #include <Register/Amd/Ghcb.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>

View File

@ -1,7 +1,8 @@
/** @file /** @file
VMGEXIT Support Library. CcExitLib Support Library.
Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR> 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 SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -9,7 +10,7 @@
#include <Base.h> #include <Base.h>
#include <Uefi.h> #include <Uefi.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
/** /**

View File

@ -1,18 +1,19 @@
## @file ## @file
# VMGEXIT Support Library. # CcExitLib Library.
# #
# Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR> # 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 # SPDX-License-Identifier: BSD-2-Clause-Patent
# #
## ##
[Defines] [Defines]
INF_VERSION = 0x00010005 INF_VERSION = 0x00010005
BASE_NAME = VmgExitLib BASE_NAME = CcExitLib
FILE_GUID = 0e923c25-13cd-430b-8714-ffe85652a97b FILE_GUID = 0e923c25-13cd-430b-8714-ffe85652a97b
MODULE_TYPE = BASE MODULE_TYPE = BASE
VERSION_STRING = 1.0 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. # The following information is for reference only and not required by the build tools.
@ -21,11 +22,11 @@
# #
[Sources.common] [Sources.common]
VmgExitLib.c CcExitLib.c
VmgExitVcHandler.c CcExitVcHandler.c
VmgExitVcHandler.h CcExitVcHandler.h
PeiDxeVmgExitVcHandler.c PeiDxeCcExitVcHandler.c
VmTdExitVeHandler.c CcExitVeHandler.c
X64/TdVmcallCpuid.nasm X64/TdVmcallCpuid.nasm
[Packages] [Packages]

View File

@ -5,8 +5,8 @@
**/ **/
#ifndef VMTD_EXIT_HANDLER_H_ #ifndef CC_EXIT_TD_H_
#define VMTD_EXIT_HANDLER_H_ #define CC_EXIT_TD_H_
#include <Base.h> #include <Base.h>
#include <Uefi.h> #include <Uefi.h>

View File

@ -11,13 +11,12 @@
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/LocalApicLib.h> #include <Library/LocalApicLib.h>
#include <Library/MemEncryptSevLib.h> #include <Library/MemEncryptSevLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
#include <Register/Intel/Cpuid.h> #include <Register/Intel/Cpuid.h>
#include <IndustryStandard/InstructionParsing.h> #include <IndustryStandard/InstructionParsing.h>
#include "VmgExitVcHandler.h" #include "CcExitVcHandler.h"
// #include <Library/MemEncryptSevLib.h>
// //
// Instruction execution mode definition // Instruction execution mode definition

View File

@ -6,12 +6,12 @@
**/ **/
#ifndef __VMG_EXIT_VC_HANDLER_H__ #ifndef CC_EXIT_VC_HANDLER_H_
#define __VMG_EXIT_VC_HANDLER_H__ #define CC_EXIT_VC_HANDLER_H_
#include <Base.h> #include <Base.h>
#include <Uefi.h> #include <Uefi.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
/** /**
Handle a #VC exception. Handle a #VC exception.

View File

@ -8,8 +8,8 @@
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include "VmTdExitHandler.h" #include "CcExitTd.h"
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <IndustryStandard/Tdx.h> #include <IndustryStandard/Tdx.h>
#include <IndustryStandard/InstructionParsing.h> #include <IndustryStandard/InstructionParsing.h>

View File

@ -10,10 +10,10 @@
#include <Uefi.h> #include <Uefi.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemEncryptSevLib.h> #include <Library/MemEncryptSevLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
#include "VmgExitVcHandler.h" #include "CcExitVcHandler.h"
/** /**
Handle a #VC exception. Handle a #VC exception.

View File

@ -8,11 +8,11 @@
[Defines] [Defines]
INF_VERSION = 0x00010005 INF_VERSION = 0x00010005
BASE_NAME = SecVmgExitLib BASE_NAME = SecCcExitLib
FILE_GUID = dafff819-f86c-4cff-a70e-83161e5bcf9a FILE_GUID = dafff819-f86c-4cff-a70e-83161e5bcf9a
MODULE_TYPE = BASE MODULE_TYPE = BASE
VERSION_STRING = 1.0 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. # The following information is for reference only and not required by the build tools.
@ -21,11 +21,11 @@
# #
[Sources.common] [Sources.common]
VmgExitLib.c CcExitLib.c
VmgExitVcHandler.c CcExitVcHandler.c
VmgExitVcHandler.h CcExitVcHandler.h
SecVmgExitVcHandler.c SecCcExitVcHandler.c
VmTdExitVeHandler.c CcExitVeHandler.c
X64/TdVmcallCpuid.nasm X64/TdVmcallCpuid.nasm
[Packages] [Packages]

View File

@ -10,10 +10,10 @@
#include <Uefi.h> #include <Uefi.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemEncryptSevLib.h> #include <Library/MemEncryptSevLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
#include "VmgExitVcHandler.h" #include "CcExitVcHandler.h"
/** /**
Handle a #VC exception. Handle a #VC exception.

View File

@ -249,7 +249,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
@ -277,7 +277,7 @@
!else !else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
!endif !endif
VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
[LibraryClasses.common.PEI_CORE] [LibraryClasses.common.PEI_CORE]

View File

@ -256,7 +256,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
[LibraryClasses.common.SEC] [LibraryClasses.common.SEC]
TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf
@ -984,7 +984,7 @@
# #
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf { OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
<LibraryClasses> <LibraryClasses>
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
} }
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {

View File

@ -260,7 +260,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
@ -1002,7 +1002,7 @@
# #
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf { OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
<LibraryClasses> <LibraryClasses>
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
} }
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {

View File

@ -276,7 +276,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
@ -302,7 +302,7 @@
!else !else
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
!endif !endif
VmgExitLib|OvmfPkg/Library/VmgExitLib/SecVmgExitLib.inf CcExitLib|OvmfPkg/Library/CcExitLib/SecCcExitLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLib.inf
CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf
@ -1072,7 +1072,7 @@
# #
OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf { OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf {
<LibraryClasses> <LibraryClasses>
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
} }
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf { MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {

View File

@ -231,7 +231,7 @@
[LibraryClasses.common] [LibraryClasses.common]
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
[LibraryClasses.common.SEC] [LibraryClasses.common.SEC]

View File

@ -19,7 +19,7 @@
#include <PiPei.h> #include <PiPei.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
#include <Register/Intel/SmramSaveStateMap.h> #include <Register/Intel/SmramSaveStateMap.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <ConfidentialComputingGuestAttr.h> #include <ConfidentialComputingGuestAttr.h>
#include "Platform.h" #include "Platform.h"

View File

@ -63,7 +63,7 @@
MtrrLib MtrrLib
MemEncryptSevLib MemEncryptSevLib
PcdLib PcdLib
VmgExitLib CcExitLib
PlatformInitLib PlatformInitLib
[Pcd] [Pcd]

View File

@ -53,7 +53,7 @@
UefiBootServicesTableLib UefiBootServicesTableLib
UefiDriverEntryPoint UefiDriverEntryPoint
UefiRuntimeLib UefiRuntimeLib
VmgExitLib CcExitLib
[Guids] [Guids]
gEfiEventVirtualAddressChangeGuid # ALWAYS_CONSUMED gEfiEventVirtualAddressChangeGuid # ALWAYS_CONSUMED

View File

@ -11,7 +11,7 @@
#include <Library/UefiRuntimeLib.h> #include <Library/UefiRuntimeLib.h>
#include <Library/MemEncryptSevLib.h> #include <Library/MemEncryptSevLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Msr.h> #include <Register/Amd/Msr.h>
#include "QemuFlash.h" #include "QemuFlash.h"

View File

@ -1,16 +1,19 @@
/** @file /** @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 This library class defines some routines used for below CcExit handler.
instruction in support of SEV-ES and to handle #VC exceptions. - 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, 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 SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
#ifndef __VMG_EXIT_LIB_H__ #ifndef CC_EXIT_LIB_H_
#define __VMG_EXIT_LIB_H__ #define CC_EXIT_LIB_H_
#include <Protocol/DebugSupport.h> #include <Protocol/DebugSupport.h>
#include <Register/Amd/Ghcb.h> #include <Register/Amd/Ghcb.h>

View File

@ -1,14 +1,15 @@
/** @file /** @file
VMGEXIT Base Support Library. CcExit Base Support Library.
Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR> 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 SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
#include <Base.h> #include <Base.h>
#include <Uefi.h> #include <Uefi.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
/** /**
Perform VMGEXIT. Perform VMGEXIT.
@ -163,3 +164,31 @@ VmgExitHandleVc (
return EFI_UNSUPPORTED; 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;
}

View File

@ -1,23 +1,23 @@
## @file ## @file
# VMGEXIT Support Library. # CcExit Base Support Library.
# #
# Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.<BR> # 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 # SPDX-License-Identifier: BSD-2-Clause-Patent
# #
## ##
[Defines] [Defines]
INF_VERSION = 0x00010005 INF_VERSION = 0x00010005
BASE_NAME = VmgExitLibNull BASE_NAME = CcExitLibNull
MODULE_UNI_FILE = VmgExitLibNull.uni MODULE_UNI_FILE = CcExitLibNull.uni
FILE_GUID = 3cd7368f-ef9b-4a9b-9571-2ed93813677e FILE_GUID = 3cd7368f-ef9b-4a9b-9571-2ed93813677e
MODULE_TYPE = BASE MODULE_TYPE = BASE
VERSION_STRING = 1.0 VERSION_STRING = 1.0
LIBRARY_CLASS = VmgExitLib LIBRARY_CLASS = CcExitLib
[Sources.common] [Sources.common]
VmgExitLibNull.c CcExitLibNull.c
VmTdExitNull.c
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec

View File

@ -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."

View File

@ -60,4 +60,4 @@
PeCoffGetEntryPointLib PeCoffGetEntryPointLib
MemoryAllocationLib MemoryAllocationLib
DebugLib DebugLib
VmgExitLib CcExitLib

View File

@ -52,7 +52,7 @@
HobLib HobLib
MemoryAllocationLib MemoryAllocationLib
SynchronizationLib SynchronizationLib
VmgExitLib CcExitLib
[Pcd] [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard # CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard # CONSUMES

View File

@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include "CpuExceptionCommon.h" #include "CpuExceptionCommon.h"
/** /**

View File

@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
#include <PiPei.h> #include <PiPei.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include "CpuExceptionCommon.h" #include "CpuExceptionCommon.h"
CONST UINTN mDoFarReturnFlag = 0; CONST UINTN mDoFarReturnFlag = 0;

View File

@ -48,7 +48,7 @@
PrintLib PrintLib
LocalApicLib LocalApicLib
PeCoffGetEntryPointLib PeCoffGetEntryPointLib
VmgExitLib CcExitLib
[Pcd] [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard

View File

@ -51,7 +51,7 @@
LocalApicLib LocalApicLib
PeCoffGetEntryPointLib PeCoffGetEntryPointLib
DebugLib DebugLib
VmgExitLib CcExitLib
[Pcd] [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard

View File

@ -53,7 +53,7 @@
PrintLib PrintLib
LocalApicLib LocalApicLib
PeCoffGetEntryPointLib PeCoffGetEntryPointLib
VmgExitLib CcExitLib
[Pcd] [Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard

View File

@ -8,7 +8,7 @@
**/ **/
#include "MpLib.h" #include "MpLib.h"
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
/** /**
Get Protected mode code segment with 16-bit default addressing Get Protected mode code segment with 16-bit default addressing

View File

@ -54,7 +54,7 @@
DebugAgentLib DebugAgentLib
SynchronizationLib SynchronizationLib
PcdLib PcdLib
VmgExitLib CcExitLib
MicrocodeLib MicrocodeLib
[Protocols] [Protocols]

View File

@ -12,7 +12,7 @@
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugAgentLib.h> #include <Library/DebugAgentLib.h>
#include <Library/DxeServicesTableLib.h> #include <Library/DxeServicesTableLib.h>
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Fam17Msr.h> #include <Register/Amd/Fam17Msr.h>
#include <Register/Amd/Ghcb.h> #include <Register/Amd/Ghcb.h>

View File

@ -9,7 +9,7 @@
**/ **/
#include "MpLib.h" #include "MpLib.h"
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Fam17Msr.h> #include <Register/Amd/Fam17Msr.h>
#include <Register/Amd/Ghcb.h> #include <Register/Amd/Ghcb.h>

View File

@ -53,7 +53,7 @@
SynchronizationLib SynchronizationLib
PeiServicesLib PeiServicesLib
PcdLib PcdLib
VmgExitLib CcExitLib
MicrocodeLib MicrocodeLib
[Pcd] [Pcd]

View File

@ -9,7 +9,7 @@
**/ **/
#include "MpLib.h" #include "MpLib.h"
#include <Library/VmgExitLib.h> #include <Library/CcExitLib.h>
#include <Register/Amd/Fam17Msr.h> #include <Register/Amd/Fam17Msr.h>
#include <Register/Amd/Ghcb.h> #include <Register/Amd/Ghcb.h>

View File

@ -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;
}

View File

@ -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."

View File

@ -53,8 +53,8 @@
## ##
MpInitLib|Include/Library/MpInitLib.h MpInitLib|Include/Library/MpInitLib.h
## @libraryclass Provides function to support VMGEXIT processing. ## @libraryclass Provides function to support CcExit processing.
VmgExitLib|Include/Library/VmgExitLib.h CcExitLib|Include/Library/CcExitLib.h
## @libraryclass Provides function to get CPU cache information. ## @libraryclass Provides function to get CPU cache information.
CpuCacheInfoLib|Include/Library/CpuCacheInfoLib.h CpuCacheInfoLib|Include/Library/CpuCacheInfoLib.h

View File

@ -59,7 +59,7 @@
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.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 MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf
CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
@ -163,7 +163,7 @@
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf
UefiCpuPkg/SecCore/SecCore.inf UefiCpuPkg/SecCore/SecCore.inf

View File

@ -301,7 +301,7 @@
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.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 ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
[LibraryClasses.common] [LibraryClasses.common]