diff --git a/OvmfPkg/IntelTdx/Sec/SecMain.c b/OvmfPkg/IntelTdx/Sec/SecMain.c index 26d56be335..ab01ec9ab1 100644 --- a/OvmfPkg/IntelTdx/Sec/SecMain.c +++ b/OvmfPkg/IntelTdx/Sec/SecMain.c @@ -25,7 +25,7 @@ #include #include #include - +#include #include #define SEC_IDT_ENTRY_COUNT 34 @@ -61,7 +61,7 @@ SecCoreStartupWithStack ( UINT32 Index; volatile UINT8 *Table; - if (TdIsEnabled ()) { + if (CcProbe () == CcGuestTypeIntelTdx) { // // For Td guests, the memory map info is in TdHobLib. It should be processed // first so that the memory is accepted. Otherwise access to the unaccepted @@ -119,7 +119,7 @@ SecCoreStartupWithStack ( // AsmWriteIdtr (&IdtDescriptor); - if (TdIsEnabled ()) { + if (CcProbe () == CcGuestTypeIntelTdx) { // // InitializeCpuExceptionHandlers () should be called in Td guests so that // #VE exceptions can be handled correctly. diff --git a/OvmfPkg/IntelTdx/Sec/SecMain.inf b/OvmfPkg/IntelTdx/Sec/SecMain.inf index df2e749c35..9cf1249d02 100644 --- a/OvmfPkg/IntelTdx/Sec/SecMain.inf +++ b/OvmfPkg/IntelTdx/Sec/SecMain.inf @@ -49,6 +49,7 @@ CpuExceptionHandlerLib PeilessStartupLib PlatformInitLib + CcProbeLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c index ca9717a7b5..8949d10157 100644 --- a/OvmfPkg/Sec/SecMain.c +++ b/OvmfPkg/Sec/SecMain.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "AmdSev.h" #define SEC_IDT_ENTRY_COUNT 34 @@ -738,7 +739,7 @@ SecCoreStartupWithStack ( volatile UINT8 *Table; #if defined (TDX_GUEST_SUPPORTED) - if (TdIsEnabled ()) { + if (CcProbe () == CcGuestTypeIntelTdx) { // // For Td guests, the memory map info is in TdHobLib. It should be processed // first so that the memory is accepted. Otherwise access to the unaccepted @@ -828,7 +829,7 @@ SecCoreStartupWithStack ( } #if defined (TDX_GUEST_SUPPORTED) - if (TdIsEnabled ()) { + if (CcProbe () == CcGuestTypeIntelTdx) { // // InitializeCpuExceptionHandlers () should be called in Td guests so that // #VE exceptions can be handled correctly. diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf index 4b5b089ccd..27100595ae 100644 --- a/OvmfPkg/Sec/SecMain.inf +++ b/OvmfPkg/Sec/SecMain.inf @@ -54,6 +54,7 @@ LocalApicLib MemEncryptSevLib CpuExceptionHandlerLib + CcProbeLib [Ppis] gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED