mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 14:44:28 +02:00
UefiCpuPkg/MpInitLib: Reduce reset vector memory pressure
The AP reset vector stack allocation is only required if running as an SEV-ES guest. Since the reset vector allocation is below 1MB in memory, eliminate the requirement for bare-metal systems and non SEV-ES guests to allocate the extra stack area, which can be large if the PcdCpuMaxLogicalProcessorNumber value is large, and also remove the CPU_STACK_ALIGNMENT alignment. Fixes: 7b7508ad784d ("UefiCpuPkg: Allow AP booting under SEV-ES") Cc: Garrett Kirkendall <garrett.kirkendall@amd.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Message-Id: <21345cdbc906519558202b3851257ca07b9239ba.1600884239.git.thomas.lendacky@amd.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: supply missing space character after "PcdGet32"]
This commit is contained in:
parent
92e9c44f20
commit
93edd1887e
@ -1141,20 +1141,6 @@ RestoreWakeupBuffer(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Calculate the size of the reset stack.
|
|
||||||
|
|
||||||
@return Total amount of memory required for stacks
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
UINTN
|
|
||||||
GetApResetStackSize (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return AP_RESET_STACK_SIZE * PcdGet32(PcdCpuMaxLogicalProcessorNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate the size of the reset vector.
|
Calculate the size of the reset vector.
|
||||||
|
|
||||||
@ -1170,11 +1156,23 @@ GetApResetVectorSize (
|
|||||||
{
|
{
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
Size = ALIGN_VALUE (AddressMap->RendezvousFunnelSize +
|
Size = AddressMap->RendezvousFunnelSize +
|
||||||
AddressMap->SwitchToRealSize +
|
AddressMap->SwitchToRealSize +
|
||||||
sizeof (MP_CPU_EXCHANGE_INFO),
|
sizeof (MP_CPU_EXCHANGE_INFO);
|
||||||
CPU_STACK_ALIGNMENT);
|
|
||||||
Size += GetApResetStackSize ();
|
//
|
||||||
|
// The AP reset stack is only used by SEV-ES guests. Do not add to the
|
||||||
|
// allocation if SEV-ES is not enabled.
|
||||||
|
//
|
||||||
|
if (PcdGetBool (PcdSevEsIsEnabled)) {
|
||||||
|
//
|
||||||
|
// Stack location is based on APIC ID, so use the total number of
|
||||||
|
// processors for calculating the total stack area.
|
||||||
|
//
|
||||||
|
Size += AP_RESET_STACK_SIZE * PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
|
||||||
|
|
||||||
|
Size = ALIGN_VALUE (Size, CPU_STACK_ALIGNMENT);
|
||||||
|
}
|
||||||
|
|
||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user