diff options
author | Ceping Sun <cepingx.sun@intel.com> | 2024-05-08 02:10:26 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-30 15:45:40 +0000 |
commit | 9d5a9940e4b1bf7cc9080ff245485abbf1858d2c (patch) | |
tree | a72c4cb7df5733ef47cdd1e79c31f6b890cd8996 /OvmfPkg | |
parent | a1b0703e8ea59b2b353e644b92f01b8cad182d04 (diff) | |
download | edk2-9d5a9940e4b1bf7cc9080ff245485abbf1858d2c.tar.gz edk2-9d5a9940e4b1bf7cc9080ff245485abbf1858d2c.tar.bz2 edk2-9d5a9940e4b1bf7cc9080ff245485abbf1858d2c.zip |
OvmfPkg: Refactor PcdSetNxForStack usage in TDVF
In the current code, TDVF reads the PcdSetNxForStack value via fw_cfg ,
but overwrites it with a fixed value after the read is complete.
In this patch, TDVF removes the redundant logic code.
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
Diffstat (limited to 'OvmfPkg')
-rw-r--r-- | OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c | 1 | ||||
-rw-r--r-- | OvmfPkg/Library/PlatformInitLib/Platform.c | 5 | ||||
-rw-r--r-- | OvmfPkg/PlatformPei/IntelTdx.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c index 1632a23177..42db1a61cb 100644 --- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c +++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c @@ -109,7 +109,6 @@ InitializePlatform ( if (TdIsEnabled ()) {
PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCAttrIntelTdx;
PlatformInfoHob->PcdTdxSharedBitMask = TdSharedPageMask ();
- PlatformInfoHob->PcdSetNxForStack = TRUE;
}
PlatformMiscInitialization (PlatformInfoHob);
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Platform.c index f48bf16ae3..c2e0430d22 100644 --- a/OvmfPkg/Library/PlatformInitLib/Platform.c +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c @@ -261,6 +261,11 @@ PlatformNoexecDxeInitialization ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
+ if (TdIsEnabled ()) {
+ PlatformInfoHob->PcdSetNxForStack = TRUE;
+ return EFI_SUCCESS;
+ }
+
return QemuFwCfgParseBool ("opt/ovmf/PcdSetNxForStack", &PlatformInfoHob->PcdSetNxForStack);
}
diff --git a/OvmfPkg/PlatformPei/IntelTdx.c b/OvmfPkg/PlatformPei/IntelTdx.c index 3d625cabd8..1cb6729e56 100644 --- a/OvmfPkg/PlatformPei/IntelTdx.c +++ b/OvmfPkg/PlatformPei/IntelTdx.c @@ -48,7 +48,5 @@ IntelTdxInitialize ( PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ());
ASSERT_RETURN_ERROR (PcdStatus);
- PcdStatus = PcdSetBoolS (PcdSetNxForStack, TRUE);
- ASSERT_RETURN_ERROR (PcdStatus);
#endif
}
|