audk/OvmfPkg/Library
Brijesh Singh b721aa749b OvmfPkg/BaseMemEncryptSevLib: Enable protection for newly added page table
Commit 2ac1730bf2 (MdeModulePkg/DxeIpl: Mark page table as read-only)
sets the memory pages used for page table as read-only after paging is
setup and sets CR0.WP to protect CPU modifying the read-only pages.
The commit causes #PF when MemEncryptSevClearPageEncMask() or
MemEncryptSevSetPageEncMask() tries to change the page-table attributes.

This patch takes the similar approach as Commit 147fd35c3e
(UefiCpuPkg/CpuDxe: Enable protection for newly added page table).
When page table protection is enabled, we disable it temporarily before
changing the page table attributes.

This patch makes use of the same approach as Commit 2ac1730bf2
(MdeModulePkg/DxeIpl: Mark page table as read-only)) for allocating
page table memory from reserved memory pool, which helps to reduce a
potential "split" operation.

The patch duplicates code from commit 147fd35c3e. The code duplication
will be removed after we implement page table manipulation library. See
bugzilla https://bugzilla.tianocore.org/show_bug.cgi?id=847.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
2018-01-15 21:18:50 +01:00
..
AcpiTimerLib OvmfPkg: determine PMBA value dependent on host bridge device ID 2016-05-17 20:48:39 +02:00
BaseMemEncryptSevLib OvmfPkg/BaseMemEncryptSevLib: Enable protection for newly added page table 2018-01-15 21:18:50 +01:00
DxePciLibI440FxQ35 OvmfPkg: add DxePciLibI440FxQ35 2016-03-10 21:28:29 +01:00
EmuVariableFvbLib
LoadLinuxLib OvmfPkg: Make more use of ARRAY_SIZE() 2016-10-27 18:21:06 +02:00
LockBoxLib ArmVirtPkg, OvmfPkg: retire QemuFwCfgS3Enabled() from QemuFwCfgLib 2017-03-14 21:49:16 +01:00
NvVarsFileLib OvmfPkg: Remove superfluous return statements. 2017-01-19 10:28:40 +01:00
PciHostBridgeLib OvmfPkg: Make more use of ARRAY_SIZE() 2016-10-27 18:21:06 +02:00
PlatformBootManagerLib OvmfPkg/PlatformBootManagerLib: log informative message at DEBUG_INFO lvl 2017-09-11 22:39:32 +02:00
PlatformDebugLibIoPort OvmfPkg: save on I/O port accesses when the debug port is not in use 2017-11-17 18:35:12 +01:00
PlatformFvbLibNull
PlatformHasIoMmuLib OvmfPkg: Add PlatformHasIoMmuLib 2017-07-10 21:17:28 -07:00
PlatformSecureLib
QemuBootOrderLib OvmfPkg/QemuBootOrderLib: let an OFW devpath match multiple UEFI boot opts 2017-11-28 21:37:11 +01:00
QemuFwCfgLib OvmfPkg/QemuFwCfgDxeLib: SEV: zero FW_CFG_DMA_ACCESS before decrypting it 2017-08-29 22:44:33 +02:00
QemuFwCfgS3Lib OvmfPkg/QemuFwCfgS3Lib: Fix VS tool chain build failure 2017-03-15 21:18:40 -07:00
ResetSystemLib OvmfPkg/ResetSystemLib: Implement ResetPlatformSpecific 2016-09-02 10:07:15 +08:00
SerializeVariablesLib OvmfPkg/SerializeVariablesLib: Relax check for the read-only variable 2016-05-26 13:21:36 +02:00
SmbiosVersionLib OvmfPkg/SmbiosVersionLib: eliminate unchecked PcdSetXX() calls 2016-10-25 10:46:19 +02:00
SmmCpuFeaturesLib
VirtioLib OvmfPkg/VirtioLib: change the parameter of VirtioAppendDesc() to UINT64 2017-08-25 10:42:19 +02:00
VirtioMmioDeviceLib OvmfPkg/Virtio: take RingBaseShift in SetQueueAddress() 2017-08-25 10:42:19 +02:00
XenConsoleSerialPortLib OvmfPkg/XenConsoleSerialPortLib: don't include <Uefi/UefiBaseType.h> 2016-10-26 12:03:39 +02:00
XenHypercallLib OvmfPkg/XenHypercallLib: enable virt extensions for ARM 2017-11-17 09:56:50 +00:00
XenIoMmioLib OvmfPkg/XenIoMmioLib: add missing MemoryAllocationLib dependency to INF 2016-04-13 17:26:06 +02:00