All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mirela Grujic <mirela.grujic@greensocs.com>
To: qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com, edgar.iglesias@xilinx.com,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	mark.burton@greensocs.com,
	"Mirela Grujic" <mirela.grujic@greensocs.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [RFC PATCH 3/9] rename MachineInitPhase enumeration constants
Date: Thu, 13 May 2021 10:25:43 +0200	[thread overview]
Message-ID: <20210513082549.114275-4-mirela.grujic@greensocs.com> (raw)
In-Reply-To: <20210513082549.114275-1-mirela.grujic@greensocs.com>

This renaming is a second phase in getting the code ready for
defining MachineInitPhase in qapi (enumeration constants are
going to be generated and prefixed with a name derived from
the enumeration type, i.e. MACHINE_INIT_PHASE_.

Signed-off-by: Mirela Grujic <mirela.grujic@greensocs.com>
---
 include/hw/qdev-core.h | 10 +++++-----
 hw/core/machine.c      |  4 ++--
 hw/core/qdev.c         |  4 ++--
 softmmu/vl.c           | 20 ++++++++++----------
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 5e3c6d4482..dc2f63478b 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -813,30 +813,30 @@ bool qdev_should_hide_device(QemuOpts *opts);
 
 typedef enum MachineInitPhase {
     /* current_machine is NULL.  */
-    PHASE_NO_MACHINE,
+    MACHINE_INIT_PHASE_NO_MACHINE,
 
     /* current_machine is not NULL, but current_machine->accel is NULL.  */
-    PHASE_MACHINE_CREATED,
+    MACHINE_INIT_PHASE_MACHINE_CREATED,
 
     /*
      * current_machine->accel is not NULL, but the machine properties have
      * not been validated and machine_class->init has not yet been called.
      */
-    PHASE_ACCEL_CREATED,
+    MACHINE_INIT_PHASE_ACCEL_CREATED,
 
     /*
      * machine_class->init has been called, thus creating any embedded
      * devices and validating machine properties.  Devices created at
      * this time are considered to be cold-plugged.
      */
-    PHASE_MACHINE_INITIALIZED,
+    MACHINE_INIT_PHASE_INITIALIZED,
 
     /*
      * QEMU is ready to start CPUs and devices created at this time
      * are considered to be hot-plugged.  The monitor is not restricted
      * to "preconfig" commands.
      */
-    PHASE_MACHINE_READY,
+    MACHINE_INIT_PHASE_READY,
 } MachineInitPhase;
 
 extern bool phase_check(MachineInitPhase phase);
diff --git a/hw/core/machine.c b/hw/core/machine.c
index eba046924d..16ce88407c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1230,7 +1230,7 @@ void machine_run_board_init(MachineState *machine)
     }
 
     machine_class->init(machine);
-    phase_advance(PHASE_MACHINE_INITIALIZED);
+    phase_advance(MACHINE_INIT_PHASE_INITIALIZED);
 }
 
 static NotifierList machine_init_done_notifiers =
@@ -1262,7 +1262,7 @@ void qdev_machine_creation_done(void)
      * ok, initial machine setup is done, starting from now we can
      * only create hotpluggable devices
      */
-    phase_advance(PHASE_MACHINE_READY);
+    phase_advance(MACHINE_INIT_PHASE_READY);
     qdev_assert_realized_properly();
 
     /* TODO: once all bus devices are qdevified, this should be done
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 71906170f9..350f2acf74 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -1157,12 +1157,12 @@ MachineInitPhase phase_get(void)
 
 bool machine_is_initialized(void)
 {
-    return machine_phase >= PHASE_MACHINE_INITIALIZED;
+    return machine_phase >= MACHINE_INIT_PHASE_INITIALIZED;
 }
 
 bool machine_is_ready(void)
 {
-    return machine_phase >= PHASE_MACHINE_READY;
+    return machine_phase >= MACHINE_INIT_PHASE_READY;
 }
 
 static const TypeInfo device_type_info = {
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 3af9743ceb..88f504aff9 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2510,7 +2510,7 @@ static void qemu_init_board(void)
     /* process plugin before CPUs are created, but once -smp has been parsed */
     qemu_plugin_load_list(&plugin_list, &error_fatal);
 
-    /* From here on we enter MACHINE_PHASE_INITIALIZED.  */
+    /* From here on we enter MACHINE_INIT_PHASE_INITIALIZED.  */
     machine_run_board_init(current_machine);
 
     drive_check_orphaned();
@@ -2582,7 +2582,7 @@ static void qemu_machine_enter_phase(MachineInitPhase target_phase,
                                      Error **errp)
 {
     /* target phases before initialization are not handled here */
-    if (target_phase < PHASE_MACHINE_INITIALIZED) {
+    if (target_phase < MACHINE_INIT_PHASE_INITIALIZED) {
         error_setg(errp, "Target machine phase too early to enter this way");
         return;
     }
@@ -2597,14 +2597,14 @@ static void qemu_machine_enter_phase(MachineInitPhase target_phase,
      * if machine has not yet passed 'initialized' phase and according to the
      * target_phase it should
      */
-    if (target_phase >= PHASE_MACHINE_INITIALIZED &&
-        phase_get() < PHASE_MACHINE_INITIALIZED) {
+    if (target_phase >= MACHINE_INIT_PHASE_INITIALIZED &&
+        phase_get() < MACHINE_INIT_PHASE_INITIALIZED) {
         qemu_init_board();
         qemu_create_cli_devices();
     }
 
-    if (target_phase >= PHASE_MACHINE_READY &&
-        phase_get() < PHASE_MACHINE_READY) {
+    if (target_phase >= MACHINE_INIT_PHASE_READY &&
+        phase_get() < MACHINE_INIT_PHASE_READY) {
         qemu_machine_creation_done();
 
         if (loadvm) {
@@ -2641,7 +2641,7 @@ void qmp_x_exit_preconfig(Error **errp)
         return;
     }
 
-    qemu_machine_enter_phase(PHASE_MACHINE_READY, errp);
+    qemu_machine_enter_phase(MACHINE_INIT_PHASE_READY, errp);
 }
 
 void qemu_init(int argc, char **argv, char **envp)
@@ -3580,14 +3580,14 @@ void qemu_init(int argc, char **argv, char **envp)
     qemu_create_early_backends();
 
     qemu_apply_machine_options();
-    phase_advance(PHASE_MACHINE_CREATED);
+    phase_advance(MACHINE_INIT_PHASE_MACHINE_CREATED);
 
     /*
      * Note: uses machine properties such as kernel-irqchip, must run
      * after machine_set_property().
      */
     configure_accelerators(argv[0]);
-    phase_advance(PHASE_ACCEL_CREATED);
+    phase_advance(MACHINE_INIT_PHASE_ACCEL_CREATED);
 
     /*
      * Beware, QOM objects created before this point miss global and
@@ -3637,7 +3637,7 @@ void qemu_init(int argc, char **argv, char **envp)
     }
 
     if (!preconfig_requested) {
-        qemu_machine_enter_phase(PHASE_MACHINE_READY, &error_fatal);
+        qemu_machine_enter_phase(MACHINE_INIT_PHASE_READY, &error_fatal);
     }
     qemu_init_displays();
     accel_setup_post(current_machine);
-- 
2.25.1



  parent reply	other threads:[~2021-05-13  8:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  8:25 [RFC PATCH 0/9] Initial support for machine creation via QMP Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 1/9] vl: Allow finer control in advancing machine through phases Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 2/9] replace machine phase_check with machine_is_initialized/ready calls Mirela Grujic
2021-05-13 17:46   ` Paolo Bonzini
2021-05-14 13:13     ` Mirela Grujic
2021-05-14 21:14       ` Paolo Bonzini
2021-06-07 16:03         ` Eric Blake
2021-05-13  8:25 ` Mirela Grujic [this message]
2021-05-13  8:25 ` [RFC PATCH 4/9] qapi: Implement 'query-machine-phase' command Mirela Grujic
2021-05-13 17:44   ` Paolo Bonzini
2021-05-19 15:43     ` Daniel P. Berrangé
2021-05-13  8:25 ` [RFC PATCH 5/9] qapi: Implement 'next-machine-phase' command Mirela Grujic
2021-06-04 14:25   ` Eric Blake
2021-06-05 14:40     ` Paolo Bonzini
2021-05-13  8:25 ` [RFC PATCH 6/9] qapi: Implement 'advance-machine-phase' command Mirela Grujic
2021-05-19 15:37   ` Kevin Wolf
2021-05-13  8:25 ` [RFC PATCH 7/9] qdev-monitor: Restructure and fix the check for command availability Mirela Grujic
2021-05-13 17:43   ` Paolo Bonzini
2021-05-14 13:00     ` Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 8/9] qapi: Introduce 'allow-init-config' option Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 9/9] qapi: Allow some commands to be executed in machine 'initialized' phase Mirela Grujic
2021-05-13 17:52 ` [RFC PATCH 0/9] Initial support for machine creation via QMP Paolo Bonzini
2021-05-14 12:48   ` Mirela Grujic
2021-05-14 16:00     ` Paolo Bonzini
2021-05-14 16:20       ` Daniel P. Berrangé
2021-05-14 18:32         ` Paolo Bonzini
2021-05-24 17:20           ` Igor Mammedov
2021-05-24 19:05             ` Igor Mammedov
2021-05-21 11:32   ` Markus Armbruster
2021-05-21 17:02     ` Paolo Bonzini
2021-05-21 14:06   ` Mirela Grujic
2021-05-21 16:57     ` Paolo Bonzini
2021-05-24 18:27       ` Igor Mammedov

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=20210513082549.114275-4-mirela.grujic@greensocs.com \
    --to=mirela.grujic@greensocs.com \
    --cc=berrange@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=ehabkost@redhat.com \
    --cc=mark.burton@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.