qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH RFC 06/11] vl: Factor qemu_until_phase() out of qemu_init()


From: Markus Armbruster
Subject: [PATCH RFC 06/11] vl: Factor qemu_until_phase() out of qemu_init()
Date: Thu, 2 Dec 2021 08:04:45 +0100

This loses a hidden bit of CLI that evaded the axe murderer: picking
the default accelerator based on argv[0].

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/hw/qdev-core.h |  1 +
 hw/core/qdev.c         |  5 +++++
 softmmu/vl.c           | 16 ++++++++++++----
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 20d3066595..2a3a3b0118 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -876,6 +876,7 @@ typedef enum MachineInitPhase {
 } MachineInitPhase;
 
 extern bool phase_check(MachineInitPhase phase);
+extern MachineInitPhase phase_get(void);
 extern void phase_advance(MachineInitPhase phase);
 
 #endif
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 84f3019440..287eb81ff8 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -915,6 +915,11 @@ bool phase_check(MachineInitPhase phase)
     return machine_phase >= phase;
 }
 
+MachineInitPhase phase_get(void)
+{
+    return machine_phase;
+}
+
 void phase_advance(MachineInitPhase phase)
 {
     assert(machine_phase == phase - 1);
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 916cba35b7..e340475986 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -963,12 +963,10 @@ static void qemu_machine_creation_done(void)
         assert(machine->cgs->ready);
     }
 }
+static void qemu_until_phase(void);
 
 void qemu_init(int argc, char **argv, char **envp)
 {
-    MachineClass *machine_class;
-    FILE *vmstate_dump_file = NULL;
-
     qemu_add_opts(&qemu_drive_opts);
     qemu_add_drive_opts(&qemu_legacy_drive_opts);
     qemu_add_drive_opts(&qemu_common_drive_opts);
@@ -1037,6 +1035,16 @@ void qemu_init(int argc, char **argv, char **envp)
         }
     }
 
+    qemu_until_phase();
+}
+
+void qemu_until_phase(void)
+{
+    MachineClass *machine_class;
+    FILE *vmstate_dump_file = NULL;
+
+    assert(phase_get() == PHASE_NO_MACHINE);
+
     qemu_process_early_options();
 
     qemu_maybe_daemonize(pid_file);
@@ -1073,7 +1081,7 @@ void qemu_init(int argc, char **argv, char **envp)
      * Note: uses machine properties such as kernel-irqchip, must run
      * after qemu_apply_machine_options.
      */
-    configure_accelerators(argv[0]);
+    configure_accelerators("FIXME");
     phase_advance(PHASE_ACCEL_CREATED);
 
     /*
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]