audk/OvmfPkg/PlatformPei
Brijesh Singh 13b5d743c8 OvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled
Secure Encrypted Virtualization (SEV) guest VMs have the concept of
private and shared memory. Private memory is encrypted with the
guest-specific key, while shared memory may be encrypted with hypervisor
key.  Certain types of memory (namely instruction pages and guest page
tables) are always treated as private memory by the hardware.
For data memory, SEV guest VMs can choose which pages they would like
to be private. The choice is done using the standard CPU page tables
using the C-bit. When building the initial page table we mark all the
memory as private.

The patch sets the memory encryption PCD. The PCD is consumed by the
following edk2 modules, which manipulate page tables:

- PEI phase modules: CapsulePei, DxeIplPeim, S3Resume2Pei.

CapsulePei is not used by OVMF. DxeIplPeim consumes the PCD at the
end of the PEI phase, when it builds the initial page tables for the
DXE core / DXE phase. S3Resume2Pei does not consume the PCD in its
entry point function, only when DxeIplPeim branches to the S3 resume
path at the end of the PEI phase, and calls S3Resume2Pei's
EFI_PEI_S3_RESUME2_PPI.S3RestoreConfig2() member function.

Therefore it is safe to set the PCD for these modules in PlatformPei.

- DXE phase modules: BootScriptExecutorDxe, CpuDxe, PiSmmCpuDxeSmm.

They are all dispatched after the PEI phase, so setting the PCD for
them in PlatformPei is safe. (BootScriptExecutorDxe is launched "for
real" in the PEI phase during S3 resume, but it caches the PCD into a
static variable when its entry point is originally invoked in DXE.)

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-07-10 21:17:27 -07:00
..
AmdSev.c OvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled 2017-07-10 21:17:27 -07:00
Cmos.c Update the copyright notice format 2010-04-28 12:43:04 +00:00
Cmos.h Update the copyright notice format 2010-04-28 12:43:04 +00:00
FeatureControl.c OvmfPkg/PlatformPei: program MSR_IA32_FEATURE_CONTROL from fw_cfg 2016-07-15 07:38:56 +02:00
Fv.c OvmfPkg: decompress FVs on S3 resume if SMM_REQUIRE is set 2015-11-30 18:41:24 +00:00
MemDetect.c OvmfPkg/PlatformPei: honor extended TSEG in PcdQ35TsegMbytes if available 2017-07-05 22:29:28 +02:00
Platform.c OvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled 2017-07-10 21:17:27 -07:00
Platform.h OvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled 2017-07-10 21:17:27 -07:00
PlatformPei.inf OvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled 2017-07-10 21:17:27 -07:00
Xen.c OvmfPkg/PlatformPei: eliminate unchecked PcdSetXX() calls 2016-10-25 10:46:22 +02:00
Xen.h OvmfPkg: define EFI_XEN_OVMF_INFO 2013-12-08 01:35:52 +00:00