hw/i386/pc_sysfw: stub out x86_firmware_configure

x86_firmware_configure requires ovmf support. Add a stub for this function call
for cases where OVMF is not supported.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>
Message-ID: <20260319122137.142178-2-anisinha@redhat.com>
Tested-by: Xudong Hao <xudong.hao@intel.com>
[PMD: Remove "kvm/tdx.h" include line]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Ani Sinha
2026-03-19 17:51:35 +05:30
committed by Philippe Mathieu-Daudé
parent 08324de90d
commit c78bac1e67
3 changed files with 38 additions and 32 deletions

View File

@@ -37,7 +37,6 @@
#include "hw/block/flash.h"
#include "system/kvm.h"
#include "target/i386/sev.h"
#include "kvm/tdx.h"
#define FLASH_SECTOR_SIZE 4096
@@ -283,34 +282,3 @@ void pc_system_firmware_init(PCMachineState *pcms,
}
}
}
void x86_firmware_configure(hwaddr gpa, void *ptr, int size)
{
int ret;
/*
* OVMF places a GUIDed structures in the flash, so
* search for them
*/
pc_system_parse_ovmf_flash(ptr, size);
if (sev_enabled()) {
/* Copy the SEV metadata table (if it exists) */
pc_system_parse_sev_metadata(ptr, size);
ret = sev_es_save_reset_vector(ptr, size);
if (ret) {
error_report("failed to locate and/or save reset vector");
exit(1);
}
sev_encrypt_flash(gpa, ptr, size, &error_fatal);
} else if (is_tdx_vm()) {
ret = tdx_parse_tdvf(ptr, size);
if (ret) {
error_report("failed to parse TDVF for TDX VM");
exit(1);
}
}
}

View File

@@ -24,3 +24,8 @@ void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size)
{
g_assert_not_reached();
}
void x86_firmware_configure(hwaddr gpa, void *ptr, int size)
{
g_assert_not_reached();
}

View File

@@ -28,6 +28,8 @@
#include "hw/i386/pc.h"
#include "exec/target_page.h"
#include "cpu.h"
#include "target/i386/sev.h"
#include "kvm/tdx.h"
#define OVMF_TABLE_FOOTER_GUID "96b582de-1fb2-45f7-baea-a366c55a082d"
@@ -160,3 +162,34 @@ bool pc_system_ovmf_table_find(const char *entry, uint8_t **data,
}
return false;
}
void x86_firmware_configure(hwaddr gpa, void *ptr, int size)
{
int ret;
/*
* OVMF places a GUIDed structures in the flash, so
* search for them
*/
pc_system_parse_ovmf_flash(ptr, size);
if (sev_enabled()) {
/* Copy the SEV metadata table (if it exists) */
pc_system_parse_sev_metadata(ptr, size);
ret = sev_es_save_reset_vector(ptr, size);
if (ret) {
error_report("failed to locate and/or save reset vector");
exit(1);
}
sev_encrypt_flash(gpa, ptr, size, &error_fatal);
} else if (is_tdx_vm()) {
ret = tdx_parse_tdvf(ptr, size);
if (ret) {
error_report("failed to parse TDVF for TDX VM");
exit(1);
}
}
}