qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <eduardo@habkost.net>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Xiaoyao Li" <xiaoyao.li@intel.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PULL 9/9] i386: firmware parsing and sev setup for -bios loaded firmware
Date: Tue, 26 Apr 2022 13:03:57 +0200	[thread overview]
Message-ID: <20220426110358.1570723-10-kraxel@redhat.com> (raw)
In-Reply-To: <20220426110358.1570723-1-kraxel@redhat.com>

Don't register firmware as rom, not needed (see comment).
Add x86_firmware_configure() call for proper sev initialization.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220425135051.551037-4-kraxel@redhat.com>
---
 hw/i386/x86.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index ced31f67b9a8..79ebdface6e2 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -1115,12 +1115,25 @@ void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
     }
     bios = g_malloc(sizeof(*bios));
     memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
-    if (!isapc_ram_fw) {
-        memory_region_set_readonly(bios, true);
-    }
-    ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
-    if (ret != 0) {
-        goto bios_error;
+    if (sev_enabled()) {
+        /*
+         * The concept of a "reset" simply doesn't exist for
+         * confidential computing guests, we have to destroy and
+         * re-launch them instead.  So there is no need to register
+         * the firmware as rom to properly re-initialize on reset.
+         * Just go for a straight file load instead.
+         */
+        void *ptr = memory_region_get_ram_ptr(bios);
+        load_image_size(filename, ptr, bios_size);
+        x86_firmware_configure(ptr, bios_size);
+    } else {
+        if (!isapc_ram_fw) {
+            memory_region_set_readonly(bios, true);
+        }
+        ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
+        if (ret != 0) {
+            goto bios_error;
+        }
     }
     g_free(filename);
 
-- 
2.35.1



  parent reply	other threads:[~2022-04-26 11:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 11:03 [PULL 0/9] Kraxel 20220426 patches Gerd Hoffmann
2022-04-26 11:03 ` [PULL 1/9] hw/display/vmware_vga: do not discard screen updates Gerd Hoffmann
2022-04-26 11:03 ` [PULL 2/9] Replacing CONFIG_VNC_PNG with CONFIG_PNG Gerd Hoffmann
2022-04-26 17:35   ` Richard Henderson
2022-04-28  8:41     ` Kshitij Suri
2022-04-26 11:03 ` [PULL 3/9] Added parameter to take screenshot with screendump as PNG Gerd Hoffmann
2022-04-26 11:03 ` [PULL 4/9] ui/vnc: refactor arrays of addresses to SocketAddressList Gerd Hoffmann
2022-04-26 11:03 ` [PULL 5/9] qapi/ui: add 'display-update' command for changing listen address Gerd Hoffmann
2022-04-26 11:03 ` [PULL 6/9] avocado/vnc: add test_change_listen Gerd Hoffmann
2022-04-26 11:03 ` [PULL 7/9] i386: move bios load error message Gerd Hoffmann
2022-04-26 11:03 ` [PULL 8/9] i386: factor out x86_firmware_configure() Gerd Hoffmann
2022-04-26 11:03 ` Gerd Hoffmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-27 17:29 [PULL 0/9] Kraxel 20220427 patches Gerd Hoffmann
2022-04-27 17:29 ` [PULL 9/9] i386: firmware parsing and sev setup for -bios loaded firmware Gerd Hoffmann

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=20220426110358.1570723-10-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=xiaoyao.li@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).