diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2024-12-04 09:44:54 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-04 12:40:35 +0000 |
commit | 775d6cd7ed6030f70f1b49194ec7c528e858fee5 (patch) | |
tree | f5f0055c476cc90c18a36b22325f88b628a484a1 | |
parent | 194cdc1700c195e1951c5623990ed9cf227f2df2 (diff) | |
download | edk2-775d6cd7ed6030f70f1b49194ec7c528e858fee5.tar.gz |
OvmfPkg/QemuFwCfgDxeLib: use PcdConfidentialComputingGuestAttr
Check PcdConfidentialComputingGuestAttr instead of calling
MemEncryptSevIsEnabled() and MemEncryptTdxIsEnabled() to figure
whenever SEV or TDX is enabled.
This allows to remove the MemEncryptSevLib + MemEncryptTdxLib
dependencies.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c | 8 | ||||
-rw-r--r-- | OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c index 4250e633b5..c86f5914c7 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c @@ -56,6 +56,7 @@ QemuFwCfgInitialize ( {
UINT32 Signature;
UINT32 Revision;
+ UINT64 CcGuestAttr;
//
// Enable the access routines while probing to see if it is supported.
@@ -86,7 +87,10 @@ QemuFwCfgInitialize ( DEBUG ((DEBUG_INFO, "QemuFwCfg interface (DMA) is supported.\n"));
}
- if (mQemuFwCfgDmaSupported && (MemEncryptSevIsEnabled () || (MemEncryptTdxIsEnabled ()))) {
+ CcGuestAttr = PcdGet64 (PcdConfidentialComputingGuestAttr);
+ if (mQemuFwCfgDmaSupported && (CC_GUEST_IS_SEV (CcGuestAttr) ||
+ CC_GUEST_IS_TDX (CcGuestAttr)))
+ {
EFI_STATUS Status;
//
@@ -415,7 +419,7 @@ InternalQemuFwCfgDmaBytes ( // When SEV or TDX is enabled, map Buffer to DMA address before issuing the DMA
// request
//
- if (MemEncryptSevIsEnabled () || MemEncryptTdxIsEnabled ()) {
+ if (mIoMmuProtocol != NULL) {
VOID *AccessBuffer;
EFI_PHYSICAL_ADDRESS DataBufferAddress;
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf index ce3eaa5ed8..11fbcdab98 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf @@ -42,11 +42,12 @@ DebugLib
IoLib
MemoryAllocationLib
- MemEncryptSevLib
- MemEncryptTdxLib
[Protocols]
gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr
+
[Depex]
gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid
|