summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2024-11-18 12:59:32 -0600
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-11-23 18:02:30 +0000
commitf0d2bc3ab268c8e3c6da4158208df38bc9d3677e (patch)
tree10330c90c0c8ce7cd1b925b05a514e52264bf804
parenta6f1433e9598bfb7948d9af6b817e521d299a57d (diff)
downloadedk2-f0d2bc3ab268c8e3c6da4158208df38bc9d3677e.tar.gz
OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Do not use flash with SEV-SNP
SEV-SNP does not support the use of the Qemu flash device as SEV-SNP guests are started using the Qemu -bios option instead of the Qemu -drive if=pflash option. Perform runtime detection of SEV-SNP and exit early from the Qemu flash device initialization, indicating the Qemu flash device is not present. SEV-SNP guests will use the emulated variable support. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
-rw-r--r--OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
index a577aea556..5e393e98ed 100644
--- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
+++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c
@@ -259,6 +259,14 @@ QemuFlashInitialize (
VOID
)
{
+ //
+ // The SNP model does not provide for QEMU flash device support, so exit
+ // early before attempting to initialize any QEMU flash device support.
+ //
+ if (MemEncryptSevSnpIsEnabled ()) {
+ return EFI_UNSUPPORTED;
+ }
+
mFlashBase = (UINT8 *)(UINTN)PcdGet32 (PcdOvmfFdBaseAddress);
mFdBlockSize = PcdGet32 (PcdOvmfFirmwareBlockSize);
ASSERT (PcdGet32 (PcdOvmfFirmwareFdSize) % mFdBlockSize == 0);