yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 26aeacdc397f54120d52ae10b543bb4050b940c7 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <26aeacdc397f54120d52ae10b543bb4050b940c7.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:18:39 +0100
0a122b
Subject: [PATCH 38/56] loader: allow adding ROMs in done callbacks
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-39-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56344
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 38/57] loader: allow adding ROMs in done callbacks
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Don't abort if machine done callbacks add ROMs.
0a122b
0a122b
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Tested-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit d916b46494a2a477636a59900ab1609de192f47a)
0a122b
---
0a122b
 include/hw/loader.h | 1 +
0a122b
 hw/core/loader.c    | 6 +++++-
0a122b
 vl.c                | 3 +++
0a122b
 3 files changed, 9 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/core/loader.c    | 6 +++++-
0a122b
 include/hw/loader.h | 1 +
0a122b
 vl.c                | 3 +++
0a122b
 3 files changed, 9 insertions(+), 1 deletion(-)
0a122b
0a122b
diff --git a/hw/core/loader.c b/hw/core/loader.c
0a122b
index ab4c7bd..4e72e01 100644
0a122b
--- a/hw/core/loader.c
0a122b
+++ b/hw/core/loader.c
0a122b
@@ -777,10 +777,14 @@ int rom_load_all(void)
0a122b
         rom->isrom = section.size && memory_region_is_rom(section.mr);
0a122b
     }
0a122b
     qemu_register_reset(rom_reset, NULL);
0a122b
-    roms_loaded = 1;
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
+void rom_load_done(void)
0a122b
+{
0a122b
+    roms_loaded = 1;
0a122b
+}
0a122b
+
0a122b
 void rom_set_fw(FWCfgState *f)
0a122b
 {
0a122b
     fw_cfg = f;
0a122b
diff --git a/include/hw/loader.h b/include/hw/loader.h
0a122b
index 1381a1d..50a017b 100644
0a122b
--- a/include/hw/loader.h
0a122b
+++ b/include/hw/loader.h
0a122b
@@ -33,6 +33,7 @@ void *rom_add_blob(const char *name, const void *blob, size_t len,
0a122b
 int rom_add_elf_program(const char *name, void *data, size_t datasize,
0a122b
                         size_t romsize, hwaddr addr);
0a122b
 int rom_load_all(void);
0a122b
+void rom_load_done(void);
0a122b
 void rom_set_fw(FWCfgState *f);
0a122b
 int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
0a122b
 void *rom_ptr(hwaddr addr);
0a122b
diff --git a/vl.c b/vl.c
0a122b
index 9b1738b..0cbbdf0 100644
0a122b
--- a/vl.c
0a122b
+++ b/vl.c
0a122b
@@ -4318,6 +4318,9 @@ int main(int argc, char **argv, char **envp)
0a122b
     qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
0a122b
     qemu_run_machine_init_done_notifiers();
0a122b
 
0a122b
+    /* Done notifiers can load ROMs */
0a122b
+    rom_load_done();
0a122b
+
0a122b
     qemu_system_reset(VMRESET_SILENT);
0a122b
     if (loadvm) {
0a122b
         if (load_vmstate(loadvm) < 0) {
0a122b
-- 
0a122b
1.7.11.7
0a122b