summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-12-04 09:44:54 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-04 12:40:35 +0000
commit775d6cd7ed6030f70f1b49194ec7c528e858fee5 (patch)
treef5f0055c476cc90c18a36b22325f88b628a484a1 /OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c
parent194cdc1700c195e1951c5623990ed9cf227f2df2 (diff)
downloadedk2-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>
Diffstat (limited to 'OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c')
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c8
1 files changed, 6 insertions, 2 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;