public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 09/27] hw/i386/pc_sysfw: stub out x86_firmware_configure
Date: Mon, 23 Mar 2026 17:52:00 +0100	[thread overview]
Message-ID: <20260323165218.96607-10-philmd@linaro.org> (raw)
In-Reply-To: <20260323165218.96607-1-philmd@linaro.org>

From: Ani Sinha <anisinha@redhat.com>

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>
---
 hw/i386/pc_sysfw.c            | 32 --------------------------------
 hw/i386/pc_sysfw_ovmf-stubs.c |  5 +++++
 hw/i386/pc_sysfw_ovmf.c       | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index d8a86756ca4..1a41a5972bd 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -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);
-        }
-    }
-}
diff --git a/hw/i386/pc_sysfw_ovmf-stubs.c b/hw/i386/pc_sysfw_ovmf-stubs.c
index aabe78b2710..b53906a0521 100644
--- a/hw/i386/pc_sysfw_ovmf-stubs.c
+++ b/hw/i386/pc_sysfw_ovmf-stubs.c
@@ -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();
+}
diff --git a/hw/i386/pc_sysfw_ovmf.c b/hw/i386/pc_sysfw_ovmf.c
index da947c3ca41..2f7d15c9f3e 100644
--- a/hw/i386/pc_sysfw_ovmf.c
+++ b/hw/i386/pc_sysfw_ovmf.c
@@ -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);
+        }
+    }
+}
-- 
2.53.0



  parent reply	other threads:[~2026-03-23 16:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 16:51 [PULL 00/27] Misc HW patches for 2026-03-23 Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 01/27] hw/riscv: Mark RISC-V specific peripherals as little-endian Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 02/27] hw/cxl: Use HPA in cxl_cfmws_find_device() rather than offset in window Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 03/27] hw/char/virtio-console: clear dangling GLib event source tag Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 04/27] hw/i3c/dw-i3c: Fix uninitialized data use in short transfer Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 05/27] hw/core/loader: fix error handling for load_image_targphys callers Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 06/27] hw/core/loader: fix error handling for get_image_size callers Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 07/27] util/event_notifier: fix error handling for event_notifier_init callers Philippe Mathieu-Daudé
2026-03-23 16:51 ` [PULL 08/27] hw/pci/msix: fix error handling for msix_init callers Philippe Mathieu-Daudé
2026-03-23 16:52 ` Philippe Mathieu-Daudé [this message]
2026-03-23 16:52 ` [PULL 10/27] hw/i386/hyperv: add stubs for synic enablement Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 11/27] hw/cxl: Respect Media Operation max ops discovery semantics Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 12/27] hw/cxl: Exclude Discovery from Media Operation Discovery output Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 13/27] backends/iommufd: report error when /dev/iommu is not available Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 14/27] hw/vfio/iommufd: report hint to user when vfio-dev/vfio*/dev is missing Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 15/27] hw/hyperv: Fix SynIC not initialized except on first vCPU Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 16/27] hw/usb/hcd-ohci: check for MPS=0 to avoid infinite loop Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 17/27] ati-vga: Fix colors when frame buffer endianness does not match host Philippe Mathieu-Daudé
2026-03-24 19:06   ` Peter Maydell
2026-03-24 20:21     ` BALATON Zoltan
2026-03-23 16:52 ` [PULL 18/27] ati-vga: Also switch mode on HW cursor enable bit change Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 19/27] ati-vga: Do not add crtc offset to src and dst data address Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 20/27] ati-vga: Avoid warnings about sign extension Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 21/27] ati-vga: Fix display updates in non-32 bit modes Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 22/27] ati-vga: Add work around for fuloong2e Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 23/27] ati-vga: Simplify pointer image handling Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 24/27] ati-vga: Make sure hardware cursor data is within vram Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 25/27] hw/net/ftgmac100: Improve DMA error handling Philippe Mathieu-Daudé
2026-03-24  8:03   ` Cédric Le Goater
2026-03-24 19:21     ` Philippe Mathieu-Daudé
2026-03-24 21:59       ` Cédric Le Goater
2026-03-23 16:52 ` [PULL 26/27] monitor: Correctly display virtual addresses while dumping memory Philippe Mathieu-Daudé
2026-03-23 16:52 ` [PULL 27/27] hw/hyperv: add QEMU_PACKED to uapi structs Philippe Mathieu-Daudé
2026-03-24 10:08 ` [PULL 00/27] Misc HW patches for 2026-03-23 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260323165218.96607-10-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox