All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com, berrange@redhat.com,
	mark.burton@greensocs.com, edgar.iglesias@gmail.co,
	mirela.grujic@greensocs.com, marcandre.lureau@redhat.com,
	pbonzini@redhat.com, jsnow@redhat.com
Subject: [PATCH RFC 06/11] vl: Factor qemu_until_phase() out of qemu_init()
Date: Thu,  2 Dec 2021 08:04:45 +0100	[thread overview]
Message-ID: <20211202070450.264743-7-armbru@redhat.com> (raw)
In-Reply-To: <20211202070450.264743-1-armbru@redhat.com>

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



  parent reply	other threads:[~2021-12-02  7:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  7:04 [PATCH RFC 00/11] vl: Explore redesign of startup Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 01/11] vl: Cut off the CLI with an axe Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 02/11] vl: Drop x-exit-preconfig Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 03/11] vl: Hardcode a QMP monitor on stdio for now Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 04/11] vl: Hardcode a VGA device " Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 05/11] vl: Demonstrate (bad) CLI wrapped around QMP Markus Armbruster
2021-12-02  7:04 ` Markus Armbruster [this message]
2021-12-02  7:04 ` [PATCH RFC 07/11] vl: Implement qemu_until_phase() running from arbitrary phase Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 08/11] vl: Implement qemu_until_phase() running to " Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 09/11] vl: New QMP command until-phase Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 10/11] vl: Disregard lack of 'allow-preconfig': true Markus Armbruster
2021-12-02  7:04 ` [PATCH RFC 11/11] vl: Enter main loop in phase @machine-initialized Markus Armbruster
2021-12-02 10:26 ` [PATCH RFC 00/11] vl: Explore redesign of startup Markus Armbruster
2021-12-07 16:52 ` Damien Hedde
2021-12-08  7:07   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211202070450.264743-7-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@gmail.co \
    --cc=jsnow@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.burton@greensocs.com \
    --cc=mirela.grujic@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.