vl: move various initialization routines out of qemu_init
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 21 Oct 2020 09:25:58 +0000 (05:25 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 10 Dec 2020 17:15:11 +0000 (12:15 -0500)
Some very simple initialization routines can be nested in existing
subsystem-level functions, do that to simplify qemu_init.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/core/machine.c
include/hw/qdev-core.h
migration/migration.c
softmmu/qdev-monitor.c
softmmu/vl.c

index bd97fc2f1ad4042c88a05d59d5b458f18242eb02..83f45a9351ecdc002ce1f2f884d55c32852b1692 100644 (file)
@@ -877,6 +877,9 @@ static void machine_initfn(Object *obj)
     MachineState *ms = MACHINE(obj);
     MachineClass *mc = MACHINE_GET_CLASS(obj);
 
+    container_get(obj, "/peripheral");
+    container_get(obj, "/peripheral-anon");
+
     ms->dump_guest_core = true;
     ms->mem_merge = true;
     ms->enable_graphics = true;
index 6ac86db44e8cfc3d77bae60193c23b6a04498da5..9fbb22a48d43e6b5102ab7b8014e5ee39c315ea3 100644 (file)
@@ -787,14 +787,6 @@ BusState *sysbus_get_default(void);
 char *qdev_get_fw_dev_path(DeviceState *dev);
 char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
 
-/**
- * @qdev_machine_init
- *
- * Initialize platform devices before machine init.  This is a hack until full
- * support for composition is added.
- */
-void qdev_machine_init(void);
-
 /**
  * device_legacy_reset:
  *
index 87a9b59f83f4677308ab184ad56f922c19a4a2b9..d9e94f4080076eee5d57b227abc97798665ffa1c 100644 (file)
@@ -182,6 +182,10 @@ void migration_object_init(void)
         error_report_err(err);
         exit(1);
     }
+
+    blk_mig_init();
+    ram_mig_init();
+    dirty_bitmap_mig_init();
 }
 
 void migration_shutdown(void)
index 301089eaea59d99cd34fd1a06f1bbf05f7d8a220..c2816c5a29679999e63185d16a99a59016f94e21 100644 (file)
@@ -928,12 +928,6 @@ BlockBackend *blk_by_qdev_id(const char *id, Error **errp)
     return blk;
 }
 
-void qdev_machine_init(void)
-{
-    qdev_get_peripheral_anon();
-    qdev_get_peripheral();
-}
-
 QemuOptsList qemu_device_opts = {
     .name = "device",
     .implied_opt_name = "driver",
index 9caff9fe8e25c3bd5d464b56e5e38ac032794126..8640ddd3eceae66a1e4367947c81454aa4dd4e4d 100644 (file)
@@ -4280,10 +4280,6 @@ void qemu_init(int argc, char **argv, char **envp)
         exit(1);
     }
 
-    blk_mig_init();
-    ram_mig_init();
-    dirty_bitmap_mig_init();
-
     qemu_opts_foreach(qemu_find_opts("mon"),
                       mon_init_func, NULL, &error_fatal);
 
@@ -4316,7 +4312,6 @@ void qemu_init(int argc, char **argv, char **envp)
        reading from the other reads, because timer polling functions query
        clock values from the log. */
     replay_checkpoint(CHECKPOINT_INIT);
-    qdev_machine_init();
 
     current_machine->boot_order = boot_order;