audk/OvmfPkg/PlatformPei
Laszlo Ersek 86defc2c25 OvmfPkg/PlatformPei: SEV: allocate pages of initial SMRAM save state map
In the next two patches, we'll temporarily decrypt the pages containing
the initial SMRAM save state map, for SMBASE relocation. (Unlike the
separate, relocated SMRAM save state map of each VCPU, the original,
shared map behaves similarly to a "common buffer" between guest and host.)
The decryption will occur near the beginning of the DXE phase, in
AmdSevDxe, and the re-encryption will occur in PiSmmCpuDxeSmm, via OVMF's
SmmCpuFeaturesLib instance.

There is a non-trivial time gap between these two points, and the DXE
phase might use the pages overlapping the initial SMRAM save state map for
arbitrary purposes meanwhile. In order to prevent any information leak
towards the hypervisor, make sure the DXE phase puts nothing in those
pages until re-encryption is done.

Creating a memalloc HOB for the area in question is safe:

- the temporary SEC/PEI RAM (stack and heap) is based at
  PcdOvmfSecPeiTempRamBase, which is above 8MB,

- the permanent PEI RAM (installed in PlatformPei's PublishPeiMemory()
  function) never starts below PcdOvmfDxeMemFvBase, which is also above
  8MB.

The allocated pages can be released to the DXE phase after SMBASE
relocation and re-encryption are complete.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
2018-03-06 13:30:32 +01:00
..
AmdSev.c OvmfPkg/PlatformPei: SEV: allocate pages of initial SMRAM save state map 2018-03-06 13:30:32 +01:00
Cmos.c
Cmos.h
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: support >=1TB high RAM, and discontiguous high RAM 2017-08-05 03:45:09 +02:00
Platform.c OvmfPkg/PlatformPei: log informative message at DEBUG_INFO level 2017-09-11 22:39:31 +02: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: DENY_EXECUTE_ON_SECURITY_VIOLATION when SEV is active 2017-10-17 21:28:27 +02: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