audk/OvmfPkg/Library
Laszlo Ersek 300aae1180 OvmfPkg/SEV: don't manage the lifecycle of the SMRAM at the default SMBASE
When OVMF runs in a SEV guest, the initial SMM Save State Map is

(1) allocated as EfiBootServicesData type memory in OvmfPkg/PlatformPei,
    function AmdSevInitialize(), for preventing unintended information
    sharing with the hypervisor;

(2) decrypted in AmdSevDxe;

(3) re-encrypted in OvmfPkg/Library/SmmCpuFeaturesLib, function
    SmmCpuFeaturesSmmRelocationComplete(), which is called by
    PiSmmCpuDxeSmm right after initial SMBASE relocation;

(4) released to DXE at the same location.

The SMRAM at the default SMBASE is a superset of the initial Save State
Map. The reserved memory allocation in InitializeRamRegions(), from the
previous patch, must override the allocating and freeing in (1) and (4),
respectively. (Note: the decrypting and re-encrypting in (2) and (3) are
unaffected.)

In AmdSevInitialize(), only assert the containment of the initial Save
State Map, in the larger area already allocated by InitializeRamRegions().

In SmmCpuFeaturesSmmRelocationComplete(), preserve the allocation of the
initial Save State Map into OS runtime, as part of the allocation done by
InitializeRamRegions(). Only assert containment.

These changes only affect the normal boot path (the UEFI memory map is
untouched during S3 resume).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Message-Id: <20200129214412.2361-9-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2020-02-05 12:59:32 +00:00
..
AcpiTimerLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
BaseMemEncryptSevLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
BasePciCapLib OvmfPkg/BasePciCapLib: suppress invalid "nullptr deref" warning 2019-04-18 16:06:04 +02:00
BasePciCapPciSegmentLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
DxePciLibI440FxQ35 OvmfPkg: strip trailing whitespace 2019-10-04 11:18:32 +01:00
EmuVariableFvbLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
LoadLinuxLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
LockBoxLib OvmfPkg: strip trailing whitespace 2019-10-04 11:18:32 +01:00
NvVarsFileLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
PciHostBridgeLib OvmfPkg/XenSupport: turn off address decoding before BAR sizing 2019-04-30 18:42:35 +02:00
PlatformBmPrintScLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
PlatformBootManagerLib OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0 2019-10-16 18:27:37 +02:00
PlatformDebugLibIoPort OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
PlatformFvbLibNull OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
PlatformHasIoMmuLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
PlatformSecureLib OvmfPkg: strip trailing whitespace 2019-10-04 11:18:32 +01:00
QemuBootOrderLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
QemuFwCfgLib OvmfPkg: strip trailing whitespace 2019-10-04 11:18:32 +01:00
QemuFwCfgS3Lib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
ResetSystemLib OvmfPkg: remove EnterS3WithImmediateWake () from ResetSystemLib 2020-01-10 07:00:51 +00:00
SerializeVariablesLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
SmbiosVersionLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
SmmCpuFeaturesLib OvmfPkg/SEV: don't manage the lifecycle of the SMRAM at the default SMBASE 2020-02-05 12:59:32 +00:00
Tcg2PhysicalPresenceLibNull OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Tcg2PhysicalPresenceLibQemu OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
TlsAuthConfigLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
UefiPciCapPciIoLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
VirtioLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
VirtioMmioDeviceLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
XenConsoleSerialPortLib OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
XenHypercallLib OvmfPkg/XenHypercallLib: Enable it in PEIM 2019-08-21 18:03:49 +02:00
XenIoMmioLib OvmfPkg: strip trailing whitespace 2019-10-04 11:18:32 +01:00
XenPlatformLib OvmfPkg/XenPlatformLib: Cache result for XenDetected 2019-08-21 18:03:49 +02:00
XenRealTimeClockLib OvmfPkg: Move XenRealTimeClockLib from ArmVirtPkg 2019-08-21 18:03:50 +02:00