mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
OvmfPkg: Use TdInfo instead of fw_cfg to get cpu count in TDVF
Currently TDVF gets cpu count information via fw_cfg, but this information can also be retrieved by calling of TdCall.TdInfo. And TdCall is responded by tdx-module which is trust. So, from the security perspective we shall use TdCall.Tdinfo instead of fw_cfg. 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>
This commit is contained in:
parent
262ab6259f
commit
ec18fa81d3
@ -33,6 +33,7 @@
|
||||
#include <Guid/SystemNvDataGuid.h>
|
||||
#include <Guid/VariableFormat.h>
|
||||
#include <OvmfPlatforms.h>
|
||||
#include <Library/TdxLib.h>
|
||||
|
||||
#include <Library/PlatformInitLib.h>
|
||||
|
||||
@ -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.
|
||||
//
|
||||
|
@ -53,8 +53,6 @@
|
||||
PcdLib
|
||||
PciLib
|
||||
PeiHardwareInfoLib
|
||||
|
||||
[LibraryClasses.X64]
|
||||
TdxLib
|
||||
|
||||
[Guids]
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user