qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Damien Hedde <damien.hedde@greensocs.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, berrange@redhat.com,
	ehabkost@redhat.com,
	Richard Henderson <richard.henderson@linaro.org>,
	cohuck@redhat.com, mark.burton@greensocs.com,
	qemu-s390x@nongnu.org, edgari@xilinx.com, pbonzini@redhat.com,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH v7 10/11] vl: replace deprecated qbus_reset_all registration
Date: Thu, 16 Jan 2020 00:44:43 +0100	[thread overview]
Message-ID: <0cc5fa09-6014-e5aa-a7e4-de0c940a7e0b@redhat.com> (raw)
In-Reply-To: <20200115123620.250132-11-damien.hedde@greensocs.com>

On 1/15/20 1:36 PM, Damien Hedde wrote:
> Replace deprecated qbus_reset_all by resettable_cold_reset_fn for
> the sysbus reset registration.
> 
> Apart for the raspi machines, this does not impact the behavior
> because:
> + at this point resettable just calls the old reset methods of devices
>    and buses in the same order as qdev/qbus.
> + resettable handlers registered with qemu_register_reset are
>    serialized; there is no interleaving.
> + eventual explicit calls to legacy reset API (device_reset or
>    qdev/qbus_reset) inside this reset handler will not be masked out
>    by resettable mechanism; they do not go through resettable api.
> 
> For the raspi machines, during the sysbus reset the sd-card is not
> reset twice anymore but only once. This is a consequence of switching
> both sysbus reset and changing parent to resettable; it detects the
> second reset is not needed. This has no impact on the state after
> reset; the sd-card reset method only reset local state and query
> information from the block backend.
> 
> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> 
> The raspi reset change can be observed by using the following command
> (reset will occurs, then do Ctrl-C to end qemu; no firmware is
> given here).
> qemu-system-aarch64 -M raspi3 \
>      -trace resettable_phase_hold_exec \
>      -trace qdev_update_parent_bus \
>      -trace resettable_change_parent \
>      -trace qdev_reset -trace qbus_reset
> 
> Before the patch, the qdev/qbus_reset traces show when reset method are
> called. After the patch, the resettable_phase_hold_exec show when reset
> method are called.
> 
> The traced reset order of the raspi3 is listed below. I've added empty
> lines and the tree structure.
> 
>   +->bcm2835-peripherals reset
>   |
>   |       +->sd-card reset
>   |   +->sd-bus reset
>   +->bcm2835_gpio reset
>   |      -> dev_update_parent_bus (move the sd-card on the sdhci-bus)
>   |      -> resettable_change_parent
>   |
>   +->bcm2835-dma reset
>   |
>   |   +->bcm2835-sdhost-bus reset
>   +->bcm2835-sdhost reset
>   |
>   |       +->sd-card (reset ONLY BEFORE BEFORE THE PATCH)
>   |   +->sdhci-bus reset
>   +->generic-sdhci reset
>   |
>   +->bcm2835-rng reset
>   +->bcm2835-property reset
>   +->bcm2835-fb reset
>   +->bcm2835-mbox reset
>   +->bcm2835-aux reset
>   +->pl011 reset
>   +->bcm2835-ic reset
>   +->bcm2836-control reset
> System reset
> 
> In both case, the sd-card is reset (being on bcm2835_gpio/sd-bus) then moved
> to generic-sdhci/sdhci-bus by the bcm2835_gpio reset method.
> 
> Before the patch, it is then reset again being part of generic-sdhci/sdhci-bus.
> After the patch, it considered again for reset but its reset method is not
> called because it is already flagged as reset.

I find this information helpful, have you considered including it in the 
description?

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   vl.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index 751401214c..e5a537d4f9 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4362,7 +4362,15 @@ int main(int argc, char **argv, char **envp)
>   
>       /* TODO: once all bus devices are qdevified, this should be done
>        * when bus is created by qdev.c */
> -    qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
> +    /*
> +     * TODO: If we had a main 'reset container' that the whole system
> +     * lived in, we could reset that using the multi-phase reset
> +     * APIs. For the moment, we just reset the sysbus, which will cause
> +     * all devices hanging off it (and all their child buses, recursively)
> +     * to be reset. Note that this will *not* reset any Device objects
> +     * which are not attached to some part of the qbus tree!
> +     */
> +    qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default());
>       qemu_run_machine_init_done_notifiers();
>   
>       if (rom_check_and_register_reset() != 0) {
> 



  reply	other threads:[~2020-01-15 23:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 12:36 [PATCH v7 00/11] Multi-phase reset mechanism Damien Hedde
2020-01-15 12:36 ` [PATCH v7 01/11] add device_legacy_reset function to prepare for reset api change Damien Hedde
2020-01-18  6:48   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 02/11] hw/core/qdev: add trace events to help with resettable transition Damien Hedde
2020-01-16  2:04   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 03/11] hw/core: create Resettable QOM interface Damien Hedde
2020-01-16  1:59   ` Philippe Mathieu-Daudé
2020-01-16  2:12     ` Philippe Mathieu-Daudé
2020-01-16  8:53     ` Damien Hedde
2020-01-16  8:57       ` Philippe Mathieu-Daudé
2020-01-18  6:35   ` Philippe Mathieu-Daudé
2020-01-20  8:50     ` Damien Hedde
2020-01-18  6:42   ` Philippe Mathieu-Daudé
2020-01-20  9:08     ` Damien Hedde
2020-01-20  9:18       ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 04/11] hw/core: add Resettable support to BusClass and DeviceClass Damien Hedde
2020-01-16  2:02   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 05/11] hw/core/resettable: add support for changing parent Damien Hedde
2020-01-18  6:45   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 06/11] hw/core/qdev: handle parent bus change regarding resettable Damien Hedde
2020-01-16  2:05   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 07/11] hw/core/qdev: update hotplug reset " Damien Hedde
2020-01-18  6:47   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 08/11] hw/core: deprecate old reset functions and introduce new ones Damien Hedde
2020-01-18  6:47   ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 09/11] docs/devel/reset.rst: add doc about Resettable interface Damien Hedde
2020-01-15 12:36 ` [PATCH v7 10/11] vl: replace deprecated qbus_reset_all registration Damien Hedde
2020-01-15 23:44   ` Philippe Mathieu-Daudé [this message]
2020-01-16  8:57     ` Damien Hedde
2020-01-15 12:36 ` [PATCH v7 11/11] hw/s390x/ipl: replace deprecated qdev_reset_all registration Damien Hedde

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=0cc5fa09-6014-e5aa-a7e4-de0c940a7e0b@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgari@xilinx.com \
    --cc=ehabkost@redhat.com \
    --cc=mark.burton@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).