]> Git Repo - qemu.git/commitdiff
vl: move rom_load_all after machine init done
authorEric Auger <[email protected]>
Tue, 16 Jun 2015 16:07:54 +0000 (17:07 +0100)
committerPaolo Bonzini <[email protected]>
Tue, 7 Jul 2015 09:03:16 +0000 (11:03 +0200)
On ARM, commit ac9d32e39664e060cd1b538ff190980d57ad69e4 postponed the
memory preparation for boot until the machine init done notifier. This
has for consequence to insert ROM at machine init done time.

However the rom_load_all function stayed called before the ROM are
inserted. As a consequence the rom_load_all function does not do
everything it is expected to do, on ARM.

It currently registers the ROM reset notifier but does not iterate through
the registered ROM list. the isrom field is not set properly. This latter
is used to report info in the monitor and also to decide whether the
rom->data can be freed on ROM reset notifier.

To fix that regression the patch moves the rom_load_all call after
machine init done. We also take the opportunity to rename the rom_load_all
function into rom_check_and_resgister_reset() and integrate the
rom_load_done in it.

Signed-off-by: Eric Auger <[email protected]>
Reported-by: Peter Crosthwaite <[email protected]>
Message-Id: <1434470874[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/core/loader.c
include/hw/loader.h
vl.c

index 7ee675c1dfd69402733013b700e7f90fc169528e..216eeeb917f857df35ee006ed99bb036c1ecab0e 100644 (file)
@@ -933,7 +933,7 @@ static void rom_reset(void *unused)
     }
 }
 
-int rom_load_all(void)
+int rom_check_and_register_reset(void)
 {
     hwaddr addr = 0;
     MemoryRegionSection section;
@@ -957,12 +957,8 @@ int rom_load_all(void)
         memory_region_unref(section.mr);
     }
     qemu_register_reset(rom_reset, NULL);
-    return 0;
-}
-
-void rom_load_done(void)
-{
     roms_loaded = 1;
+    return 0;
 }
 
 void rom_set_fw(FWCfgState *f)
index 485ff8f2f1474ca8e2cf7fdb6aedacf60911d5f2..f7b43ab62f270346cf770e546eeac8040086a9a0 100644 (file)
@@ -75,8 +75,7 @@ MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len,
                            void *callback_opaque);
 int rom_add_elf_program(const char *name, void *data, size_t datasize,
                         size_t romsize, hwaddr addr);
-int rom_load_all(void);
-void rom_load_done(void);
+int rom_check_and_register_reset(void);
 void rom_set_fw(FWCfgState *f);
 int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
 void *rom_ptr(hwaddr addr);
diff --git a/vl.c b/vl.c
index 69ad90c87f7fd7f0c7be21305b04700040817c4a..2991af604bfc2f112d0c2924084156cb428d1283 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -4579,18 +4579,15 @@ int main(int argc, char **argv, char **envp)
 
     qdev_machine_creation_done();
 
-    if (rom_load_all() != 0) {
-        fprintf(stderr, "rom loading failed\n");
-        exit(1);
-    }
-
     /* TODO: once all bus devices are qdevified, this should be done
      * when bus is created by qdev.c */
     qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
     qemu_run_machine_init_done_notifiers();
 
-    /* Done notifiers can load ROMs */
-    rom_load_done();
+    if (rom_check_and_register_reset() != 0) {
+        fprintf(stderr, "rom check and register reset failed\n");
+        exit(1);
+    }
 
     qemu_system_reset(VMRESET_SILENT);
     if (loadvm) {
This page took 0.033831 seconds and 4 git commands to generate.