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>
This commit is contained in:
Tom Lendacky 2024-11-18 12:59:32 -06:00 committed by mergify[bot]
parent a6f1433e95
commit f0d2bc3ab2
1 changed files with 8 additions and 0 deletions

View File

@ -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);