All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Shu <jim.shu@sifive.com>
To: Damien Hedde <damien.hedde@greensocs.com>
Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	mark.burton@greensocs.com, edgari@xilinx.com,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v5 3/6] vl: support machine-initialized target in phase_until()
Date: Wed, 25 May 2022 03:56:46 +0800	[thread overview]
Message-ID: <CALw707oTgZ-pJHjFq6wX4+EeeTiQQEuBsjebQJ4jvD_kcWvW+g@mail.gmail.com> (raw)
In-Reply-To: <20220519153402.41540-4-damien.hedde@greensocs.com>

[-- Attachment #1: Type: text/plain, Size: 2872 bytes --]

Tested-by: Jim Shu <jim.shu@sifive.com>

On Thu, May 19, 2022 at 11:36 PM Damien Hedde <damien.hedde@greensocs.com>
wrote:

> phase_until() now supports the following transitions:
> + accel-created -> machine-initialized
> + machine-initialized -> machine-ready
>
> As a consequence we can now support the use of qmp_exit_preconfig()
> from phases _accel-created_ and _machine-initialized_.
>
> This commit is a preparation to support cold plugging a device
> using qapi (which will be introduced in a following commit). For this
> we need fine grain control of the phase.
>
> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>
> v5: update due to refactor of previous commit
> ---
>  softmmu/vl.c | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 7f8d15b5b8..ea15e37973 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2698,8 +2698,9 @@ static void qemu_machine_creation_done(void)
>
>  void qmp_x_exit_preconfig(Error **errp)
>  {
> -    if (phase_check(PHASE_MACHINE_INITIALIZED)) {
> -        error_setg(errp, "The command is permitted only before machine
> initialization");
> +    if (phase_check(PHASE_MACHINE_READY)) {
> +        error_setg(errp, "The command is permitted only before"
> +                         " machine is ready");
>          return;
>      }
>      phase_until(PHASE_MACHINE_READY, errp);
> @@ -2707,9 +2708,6 @@ void qmp_x_exit_preconfig(Error **errp)
>
>  static void qemu_phase_ready(Error **errp)
>  {
> -    qemu_init_board();
> -    /* phase is now PHASE_MACHINE_INITIALIZED. */
> -    qemu_create_cli_devices();
>      cxl_fixed_memory_window_link_targets(errp);
>      qemu_machine_creation_done();
>      /* Phase is now PHASE_MACHINE_READY. */
> @@ -2749,6 +2747,24 @@ bool phase_until(MachineInitPhase phase, Error
> **errp)
>
>          switch (cur_phase) {
>          case PHASE_ACCEL_CREATED:
> +            qemu_init_board();
> +            /* Phase is now PHASE_MACHINE_INITIALIZED. */
> +            /*
> +             * Handle CLI devices now in order leave this case in a state
> +             * where we can cold plug devices with QMP. The following call
> +             * handles the CLI options:
> +             * + -fw_cfg (has side effects on device cold plug)
> +             * + -device
> +             */
> +            qemu_create_cli_devices();
> +            /*
> +             * At this point all CLI options are handled apart:
> +             * + -S (autostart)
> +             * + -incoming
> +             */
> +            break;
> +
> +        case PHASE_MACHINE_INITIALIZED:
>              qemu_phase_ready(errp);
>              break;
>
> --
> 2.36.1
>
>
>

[-- Attachment #2: Type: text/html, Size: 3728 bytes --]

  reply	other threads:[~2022-05-24 20:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 15:33 [PATCH v5 0/6] QAPI support for device cold-plug Damien Hedde
2022-05-19 15:33 ` [PATCH v5 1/6] machine: add phase_get() and document phase_check()/advance() Damien Hedde
2022-05-24 19:56   ` Jim Shu
2022-05-19 15:33 ` [PATCH v5 2/6] machine&vl: introduce phase_until() to handle phase transitions Damien Hedde
2022-05-24 19:56   ` Jim Shu
2022-05-19 15:33 ` [PATCH v5 3/6] vl: support machine-initialized target in phase_until() Damien Hedde
2022-05-24 19:56   ` Jim Shu [this message]
2022-05-19 15:34 ` [PATCH v5 4/6] qapi/device_add: compute is_hotplug flag Damien Hedde
2022-05-24 19:57   ` Jim Shu
2022-05-19 15:34 ` [PATCH v5 5/6] RFC qapi/device_add: handle the rom_order_override when cold-plugging Damien Hedde
2022-05-19 15:34 ` [PATCH v5 6/6] qapi/device_add: Allow execution in machine initialized phase Damien Hedde
2022-05-24 19:58   ` Jim Shu

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=CALw707oTgZ-pJHjFq6wX4+EeeTiQQEuBsjebQJ4jvD_kcWvW+g@mail.gmail.com \
    --to=jim.shu@sifive.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgari@xilinx.com \
    --cc=f4bug@amsat.org \
    --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.