audk/OvmfPkg/QemuFlashFvbServicesRuntimeDxe
Tom Lendacky 437eb3f7a8 OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash detection with SEV-ES
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

The flash detection routine will attempt to determine how the flash
device behaves (e.g. ROM, RAM, Flash). But when SEV-ES is enabled and
the flash device behaves as a ROM device (meaning it is marked read-only
by the hypervisor), this check may result in an infinite nested page fault
because of the attempted write. Since the instruction cannot be emulated
when SEV-ES is enabled, the RIP is never advanced, resulting in repeated
nested page faults.

When SEV-ES is enabled, exit the flash detection early and assume that
the FD behaves as Flash. This will result in QemuFlashWrite() being called
to store EFI variables, which will also result in an infinite nested page
fault when the write is performed. In this case, update QemuFlashWrite()
to use the VMGEXIT MMIO write support to have the hypervisor perform the
write without having to emulate the instruction.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2020-08-17 02:46:39 +00:00
..
FvbInfo.c OvmfPkg/Qemu: Fix various typos 2020-02-10 22:30:07 +00:00
FvbServicesRuntimeDxe.inf OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash detection with SEV-ES 2020-08-17 02:46:39 +00:00
FvbServicesSmm.inf OvmfPkg: set fixed FlashNvStorage base addresses with -D SMM_REQUIRE 2020-03-12 21:14:46 +00:00
FwBlockService.c OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ ones 2020-04-30 13:01:16 +00:00
FwBlockService.h OvmfPkg/QemuFlashFvbServices: factor out SetPcdFlashNvStorageBaseAddresses 2020-03-12 21:14:46 +00:00
FwBlockServiceDxe.c OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ ones 2020-04-30 13:01:16 +00:00
FwBlockServiceSmm.c OvmfPkg: replace old EFI_D_ debug levels with new DEBUG_ ones 2020-04-30 13:01:16 +00:00
QemuFlash.c OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash detection with SEV-ES 2020-08-17 02:46:39 +00:00
QemuFlash.h OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash detection with SEV-ES 2020-08-17 02:46:39 +00:00
QemuFlashDxe.c OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash detection with SEV-ES 2020-08-17 02:46:39 +00:00
QemuFlashSmm.c OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash detection with SEV-ES 2020-08-17 02:46:39 +00:00