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
BaseMemEncryptSevLib OvmfPkg/BaseMemEncryptSevLib: Enable protection for newly added page table 2018-01-15 21:18:50 +01:00
DxePciLibI440FxQ35
EmuVariableFvbLib
LoadLinuxLib
LockBoxLib
NvVarsFileLib
PciHostBridgeLib
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
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
ResetSystemLib
SerializeVariablesLib
SmbiosVersionLib
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
XenHypercallLib OvmfPkg/XenHypercallLib: enable virt extensions for ARM 2017-11-17 09:56:50 +00:00
XenIoMmioLib