);\r
}\r
\r
-/**\r
- Calculate the size of the reset stack.\r
-\r
- @return Total amount of memory required for stacks\r
-**/\r
-STATIC\r
-UINTN\r
-GetApResetStackSize (\r
- VOID\r
- )\r
-{\r
- return AP_RESET_STACK_SIZE * PcdGet32(PcdCpuMaxLogicalProcessorNumber);\r
-}\r
-\r
/**\r
Calculate the size of the reset vector.\r
\r
{\r
UINTN Size;\r
\r
- Size = ALIGN_VALUE (AddressMap->RendezvousFunnelSize +\r
- AddressMap->SwitchToRealSize +\r
- sizeof (MP_CPU_EXCHANGE_INFO),\r
- CPU_STACK_ALIGNMENT);\r
- Size += GetApResetStackSize ();\r
+ Size = AddressMap->RendezvousFunnelSize +\r
+ AddressMap->SwitchToRealSize +\r
+ sizeof (MP_CPU_EXCHANGE_INFO);\r
+\r
+ //\r
+ // The AP reset stack is only used by SEV-ES guests. Do not add to the\r
+ // allocation if SEV-ES is not enabled.\r
+ //\r
+ if (PcdGetBool (PcdSevEsIsEnabled)) {\r
+ //\r
+ // Stack location is based on APIC ID, so use the total number of\r
+ // processors for calculating the total stack area.\r
+ //\r
+ Size += AP_RESET_STACK_SIZE * PcdGet32 (PcdCpuMaxLogicalProcessorNumber);\r
+\r
+ Size = ALIGN_VALUE (Size, CPU_STACK_ALIGNMENT);\r
+ }\r
\r
return Size;\r
}\r