Skip to content

Commit

Permalink
Add a PCD to allow the AP wakeup buffer to be reserved (#209)
Browse files Browse the repository at this point in the history
## Description

Creates a new PCD which when set will cause the AP wakeup buffer to be
allocated as a reserved type.

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Includes tests?
- [ ] Includes documentation?
- [ ] Breaking change?

## How This Was Tested

Tested on custom Q35 image

## Integration Instructions

N/A
  • Loading branch information
cfernald authored and kenlautner committed May 9, 2023
1 parent 7ba3a80 commit c2d2413
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckIntervalInMicroSeconds ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdGhcbHypervisorFeatures ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase ## SOMETIMES_CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApWakeupBufferReserved ## CONSUMES MU_CHANGE
# MU_CHANGE START Remove memory protection PCD references
# gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
# MU_CHANGE END
Expand Down
8 changes: 6 additions & 2 deletions UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,12 @@ GetWakeupBuffer (
EFI_PHYSICAL_ADDRESS StartAddress;
EFI_MEMORY_TYPE MemoryType;

if (ConfidentialComputingGuestHas (CCAttrAmdSevEs) &&
!ConfidentialComputingGuestHas (CCAttrAmdSevSnp))
// MU_CHANGE START Add PCD to make wakeup buffer reserved
if (PcdGetBool (PcdCpuApWakeupBufferReserved)) {
MemoryType = EfiReservedMemoryType;
// MU_CHANGE END
} else if (ConfidentialComputingGuestHas (CCAttrAmdSevEs) &&
!ConfidentialComputingGuestHas (CCAttrAmdSevSnp))
{
//
// An SEV-ES-only guest requires the memory to be reserved. SEV-SNP, which
Expand Down
15 changes: 11 additions & 4 deletions UefiCpuPkg/UefiCpuPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@
# @Prompt Support SmmFeatureControl.
gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable|TRUE|BOOLEAN|0x32132110
## MS_CHANGE
## If TRUE, Install the protocol to communicate to the Smm Exception
# handler so automated testing can be performed.
#
## If TRUE, Install the protocol to communicate to the Smm Exception
# handler so automated testing can be performed.
#
gUefiCpuPkgTokenSpaceGuid.PcdSmmExceptionTestModeSupport|FALSE|BOOLEAN|0x00000021

[PcdsFixedAtBuild]
Expand Down Expand Up @@ -209,7 +209,7 @@
gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize|0x0|UINT32|0x30002006

## MS_CHANGE
## If TRUE, the default Cpu Exception Handler in SMM will reboot
## If TRUE, the default Cpu Exception Handler in SMM will reboot
# This handler state can be changed by using the Exception Test Protocol
gUefiCpuPkgTokenSpaceGuid.PcdSmmExceptionRebootInsteadOfHaltDefault|TRUE|BOOLEAN|0x00000020

Expand Down Expand Up @@ -352,6 +352,13 @@
# @Prompt Current boot is a power-on reset.
gUefiCpuPkgTokenSpaceGuid.PcdIsPowerOnReset|FALSE|BOOLEAN|0x0000001B

# MU_CHANGE START Add PCD to make wakeup buffer reserved
## Specifies that the wake-up buffer for AP startup should be permanently
# allocated as reserved.
# @Prompt Allocates CPU wake-up buffer as reserved.
gUefiCpuPkgTokenSpaceGuid.PcdCpuApWakeupBufferReserved|FALSE|BOOLEAN|0x0000001F
# MU_CHANGE END

[PcdsFixedAtBuild.X64, PcdsPatchableInModule.X64, PcdsDynamic.X64, PcdsDynamicEx.X64]
## Indicate access to non-SMRAM memory is restricted to reserved, runtime and ACPI NVS type after SmmReadyToLock.
# MMIO access is always allowed regardless of the value of this PCD.
Expand Down

0 comments on commit c2d2413

Please sign in to comment.