qemu-devel
[Top][All Lists]
Advanced

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

[PATCH RFC 07/11] vl: Implement qemu_until_phase() running from arbitrar


From: Markus Armbruster
Subject: [PATCH RFC 07/11] vl: Implement qemu_until_phase() running from arbitrary phase
Date: Thu, 2 Dec 2021 08:04:46 +0100

A later patch will want to use qemu_until_phase() to advance from one
arbitrary phase to another.  Implement advancing from arbitrary phase
to PHASE_MACHINE_READY.

Indentation is intentionally off to minimize diffs.  It's RFC :)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 softmmu/vl.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index e340475986..b7f15d9f86 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1043,7 +1043,8 @@ void qemu_until_phase(void)
     MachineClass *machine_class;
     FILE *vmstate_dump_file = NULL;
 
-    assert(phase_get() == PHASE_NO_MACHINE);
+    switch (phase_get()) {
+    case PHASE_NO_MACHINE:
 
     qemu_process_early_options();
 
@@ -1077,6 +1078,9 @@ void qemu_until_phase(void)
     qemu_apply_machine_options(NULL);
     phase_advance(PHASE_MACHINE_CREATED);
 
+    /* fall through */
+    case PHASE_MACHINE_CREATED:
+
     /*
      * Note: uses machine properties such as kernel-irqchip, must run
      * after qemu_apply_machine_options.
@@ -1084,6 +1088,9 @@ void qemu_until_phase(void)
     configure_accelerators("FIXME");
     phase_advance(PHASE_ACCEL_CREATED);
 
+    /* fall through */
+    case PHASE_ACCEL_CREATED:
+
     /*
      * Beware, QOM objects created before this point miss global and
      * compat properties.
@@ -1128,7 +1135,13 @@ void qemu_until_phase(void)
     }
 
     qemu_init_board();
+    assert(phase_get() == PHASE_MACHINE_INITIALIZED);
+
+    /* fall through */
+    case PHASE_MACHINE_INITIALIZED:
+
     qemu_machine_creation_done();
+    assert(phase_get() == PHASE_MACHINE_READY);
 
     if (replay_mode != REPLAY_MODE_NONE) {
         replay_vmstate_init();
@@ -1151,4 +1164,8 @@ void qemu_until_phase(void)
     accel_setup_post(current_machine);
     os_setup_post();
     resume_mux_open();
+
+    case PHASE_MACHINE_READY:
+        break;
+    }
 }
-- 
2.31.1




reply via email to

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