[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
- [PATCH RFC 00/11] vl: Explore redesign of startup, Markus Armbruster, 2021/12/02
- [PATCH RFC 02/11] vl: Drop x-exit-preconfig, Markus Armbruster, 2021/12/02
- [PATCH RFC 10/11] vl: Disregard lack of 'allow-preconfig': true, Markus Armbruster, 2021/12/02
- [PATCH RFC 06/11] vl: Factor qemu_until_phase() out of qemu_init(),
Markus Armbruster <=
- [PATCH RFC 07/11] vl: Implement qemu_until_phase() running from arbitrary phase, Markus Armbruster, 2021/12/02
- [PATCH RFC 03/11] vl: Hardcode a QMP monitor on stdio for now, Markus Armbruster, 2021/12/02
- [PATCH RFC 08/11] vl: Implement qemu_until_phase() running to arbitrary phase, Markus Armbruster, 2021/12/02
- [PATCH RFC 11/11] vl: Enter main loop in phase @machine-initialized, Markus Armbruster, 2021/12/02
- [PATCH RFC 05/11] vl: Demonstrate (bad) CLI wrapped around QMP, Markus Armbruster, 2021/12/02
- [PATCH RFC 04/11] vl: Hardcode a VGA device for now, Markus Armbruster, 2021/12/02
- [PATCH RFC 09/11] vl: New QMP command until-phase, Markus Armbruster, 2021/12/02
- [PATCH RFC 01/11] vl: Cut off the CLI with an axe, Markus Armbruster, 2021/12/02
- Re: [PATCH RFC 00/11] vl: Explore redesign of startup, Markus Armbruster, 2021/12/02
- Re: [PATCH RFC 00/11] vl: Explore redesign of startup, Damien Hedde, 2021/12/07