diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Platform.c index c2e0430d22..10fc17355f 100644 --- a/OvmfPkg/Library/PlatformInitLib/Platform.c +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -563,6 +564,20 @@ PlatformMaxCpuCountInitialization ( UINT16 BootCpuCount = 0; UINT32 MaxCpuCount; + if (TdIsEnabled ()) { + BootCpuCount = (UINT16)TdVCpuNum (); + MaxCpuCount = TdMaxVCpuNum (); + + if (BootCpuCount > MaxCpuCount) { + DEBUG ((DEBUG_ERROR, "%a: Failed with BootCpuCount (%d) more than MaxCpuCount(%u) \n", __func__, BootCpuCount, MaxCpuCount)); + ASSERT (FALSE); + } + + PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber = MaxCpuCount; + PlatformInfoHob->PcdCpuBootLogicalProcessorNumber = BootCpuCount; + return; + } + // // Try to fetch the boot CPU count. // diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf index e9c07467bb..3e63ef4423 100644 --- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf +++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf @@ -53,8 +53,6 @@ PcdLib PciLib PeiHardwareInfoLib - -[LibraryClasses.X64] TdxLib [Guids] diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 5e2086eb33..34f7b9958b 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -251,6 +251,7 @@ AmdSvsmLib|UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf + TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLibNull.inf [LibraryClasses.common.SEC]