Revert "UefiCpuPkg: Has APs in 64 bit long-mode before booting to OS."
This reverts commit 73ccde8f6d
since it
results in a hang of the IA32 processor and needs further clean-up.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4234
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
d8d829b89d
commit
cbcf0cd65e
@@ -28,7 +28,6 @@ volatile BOOLEAN mStopCheckAllApsStatus = TRUE;
|
||||
VOID *mReservedApLoopFunc = NULL;
|
||||
UINTN mReservedTopOfApStack;
|
||||
volatile UINT32 mNumberToFinish = 0;
|
||||
UINTN mApPageTable;
|
||||
|
||||
//
|
||||
// Begin wakeup buffer allocation below 0x88000
|
||||
@@ -408,9 +407,12 @@ RelocateApLoop (
|
||||
AsmRelocateApLoopFunc (
|
||||
MwaitSupport,
|
||||
CpuMpData->ApTargetCState,
|
||||
CpuMpData->PmCodeSegment,
|
||||
StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
|
||||
(UINTN)&mNumberToFinish,
|
||||
mApPageTable
|
||||
CpuMpData->Pm16CodeSegment,
|
||||
CpuMpData->SevEsAPBuffer,
|
||||
CpuMpData->WakeupBuffer
|
||||
);
|
||||
}
|
||||
|
||||
@@ -475,6 +477,7 @@ InitMpGlobalData (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
UINTN ApSafeBufferSize;
|
||||
UINTN Index;
|
||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
|
||||
@@ -542,45 +545,60 @@ InitMpGlobalData (
|
||||
// Allocating it in advance since memory services are not available in
|
||||
// Exit Boot Services callback function.
|
||||
//
|
||||
// +------------+
|
||||
// | Ap Loop |
|
||||
// +------------+
|
||||
// | Stack * N |
|
||||
// +------------+ (low address)
|
||||
ApSafeBufferSize = EFI_PAGES_TO_SIZE (
|
||||
EFI_SIZE_TO_PAGES (
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncSize
|
||||
)
|
||||
);
|
||||
Address = BASE_4GB - 1;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiReservedMemoryType,
|
||||
EFI_SIZE_TO_PAGES (ApSafeBufferSize),
|
||||
&Address
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mReservedApLoopFunc = (VOID *)(UINTN)Address;
|
||||
ASSERT (mReservedApLoopFunc != NULL);
|
||||
|
||||
//
|
||||
// Make sure that the buffer memory is executable if NX protection is enabled
|
||||
// for EfiReservedMemoryType.
|
||||
//
|
||||
// TODO: Check EFI_MEMORY_XP bit set or not once it's available in DXE GCD
|
||||
// service.
|
||||
//
|
||||
Status = gDS->GetMemorySpaceDescriptor (Address, &MemDesc);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gDS->SetMemorySpaceAttributes (
|
||||
Address,
|
||||
ApSafeBufferSize,
|
||||
MemDesc.Attributes & (~EFI_MEMORY_XP)
|
||||
);
|
||||
}
|
||||
|
||||
ApSafeBufferSize = EFI_PAGES_TO_SIZE (
|
||||
EFI_SIZE_TO_PAGES (
|
||||
CpuMpData->CpuCount * AP_SAFE_STACK_SIZE
|
||||
+ CpuMpData->AddressMap.RelocateApLoopFuncSize
|
||||
)
|
||||
);
|
||||
Address = BASE_4GB - 1;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiReservedMemoryType,
|
||||
EFI_SIZE_TO_PAGES (ApSafeBufferSize),
|
||||
&Address
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mReservedTopOfApStack = (UINTN)AllocateReservedPages (EFI_SIZE_TO_PAGES (ApSafeBufferSize));
|
||||
ASSERT (mReservedTopOfApStack != 0);
|
||||
mReservedTopOfApStack = (UINTN)Address + ApSafeBufferSize;
|
||||
ASSERT ((mReservedTopOfApStack & (UINTN)(CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||
ASSERT ((AP_SAFE_STACK_SIZE & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||
|
||||
mReservedApLoopFunc = (VOID *)(mReservedTopOfApStack + CpuMpData->CpuCount * AP_SAFE_STACK_SIZE);
|
||||
if (StandardSignatureIsAuthenticAMD ()) {
|
||||
CopyMem (
|
||||
mReservedApLoopFunc,
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncAddressAmd,
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncSizeAmd
|
||||
);
|
||||
} else {
|
||||
CopyMem (
|
||||
mReservedApLoopFunc,
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncAddress,
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncSize
|
||||
);
|
||||
|
||||
mApPageTable = CreatePageTable (
|
||||
mReservedTopOfApStack,
|
||||
ApSafeBufferSize
|
||||
);
|
||||
}
|
||||
|
||||
mReservedTopOfApStack += CpuMpData->CpuCount * AP_SAFE_STACK_SIZE;
|
||||
CopyMem (
|
||||
mReservedApLoopFunc,
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncAddress,
|
||||
CpuMpData->AddressMap.RelocateApLoopFuncSize
|
||||
);
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_TIMER | EVT_NOTIFY_SIGNAL,
|
||||
|
Reference in New Issue
Block a user