Re: [PATCH V11 14/47] UefiCpuPkg: Enable Tdx support in MpInitLib


Min Xu
 

On March 28, 2022 4:25 PM, Ni Ray wrote:

+ CopyMem (ProcessorInfoBuffer, &gTdxProcessorInformation, sizeof
+ (EFI_PROCESSOR_INFORMATION));

Min,
You may not directly copy the whole structure to ProcessorInfoBuffer.

Because per the structure definition(below), ExtendedInformation is only filled
when CPU_V2_EXTENDED_TOPOLOGY is set in ProcessorNumber.

This behavior is to be backward compatible with old caller that passes old
structure (without ExtendedInformation) and support new caller that passes
new structure requiring ExtendedInformation.

So, the correct behavior is to only fill ExtendedInformation when
CPU_V2_EXTENDED_TOPOLOGY is set in ProcessorNumber.
The CPU_V2_EXTENDED_TOPOLOGY is a flag to tell callee that caller provides a
big enough buffer for ExtendedInformation.
Thanks much for the review comments. It will be fixed in the next version.

UINT32 StatusFlag;
///
/// The physical location of the processor, including the physical package
number
/// that identifies the cartridge, the physical core number within package, and
/// logical thread number within core.
///
EFI_CPU_PHYSICAL_LOCATION Location;
///
/// The extended information of the processor. This field is filled only when
/// CPU_V2_EXTENDED_TOPOLOGY is set in parameter ProcessorNumber.
EXTENDED_PROCESSOR_INFORMATION ExtendedInformation;
} EFI_PROCESSOR_INFORMATION;
Thanks
Min

Join devel@edk2.groups.io to automatically receive all group messages.