@@ -258,16 +258,9 @@ void pc_system_firmware_init(PCMachineState *pcms,
pc_system_flash_cleanup_unused(pcms);
}
-void x86_firmware_configure(hwaddr gpa, void *ptr, int size)
+static void x86_firmware_configure_sev(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) */
@@ -282,3 +275,20 @@ void x86_firmware_configure(hwaddr gpa, void *ptr, int size)
sev_encrypt_flash(gpa, ptr, size, &error_fatal);
}
}
+
+void x86_firmware_configure(hwaddr gpa, void *ptr, int size)
+{
+ /*
+ * OVMF places a GUIDed structures in the flash, so
+ * search for them
+ */
+ pc_system_parse_ovmf_flash(ptr, size);
+ x86_firmware_configure_sev(gpa, ptr, size);
+}
+
+void x86_firmware_reconfigure(hwaddr gpa, void *ptr, int size)
+{
+ invalidate_ovmf_parsed_metadata();
+ pc_system_parse_ovmf_flash(ptr, size);
+ x86_firmware_configure_sev(gpa, ptr, size);
+}
@@ -24,3 +24,8 @@ void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size)
{
g_assert_not_reached();
}
+
+void invalidate_ovmf_parsed_metadata(void)
+{
+ g_assert_not_reached();
+}
@@ -36,6 +36,11 @@ static bool ovmf_flash_parsed;
static uint8_t *ovmf_table;
static int ovmf_table_len;
+void invalidate_ovmf_parsed_metadata(void)
+{
+ ovmf_flash_parsed = false;
+}
+
void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size)
{
uint8_t *ptr;
@@ -211,6 +211,7 @@ void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory);
bool pc_system_ovmf_table_find(const char *entry, uint8_t **data,
int *data_len);
void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size);
+void invalidate_ovmf_parsed_metadata(void);
/* sgx.c */
void pc_machine_init_sgx_epc(PCMachineState *pcms);
@@ -155,5 +155,6 @@ DeviceState *ioapic_init_secondary(GSIState *gsi_state);
/* pc_sysfw.c */
void x86_firmware_configure(hwaddr gpa, void *ptr, int size);
+void x86_firmware_reconfigure(hwaddr gpa, void *ptr, int size);
#endif