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 08/11] hw/core: deprecate old reset functions and introduce new ones
Date: Sat, 18 Jan 2020 07:47:31 +0100 [thread overview]
Message-ID: <2976a5cc-142c-7a53-119b-9dc8c9e4d366@redhat.com> (raw)
In-Reply-To: <20200115123620.250132-9-damien.hedde@greensocs.com>
On 1/15/20 1:36 PM, Damien Hedde wrote:
> Deprecate device_legacy_reset(), qdev_reset_all() and
> qbus_reset_all() to be replaced by new functions
> device_cold_reset() and bus_cold_reset() which uses resettable API.
>
> Also introduce resettable_cold_reset_fn() which may be used as a
> replacement for qdev_reset_all_fn and qbus_reset_all_fn().
>
> Following patches will be needed to look at legacy reset call sites
> and switch to resettable api. The legacy functions will be removed
> when unused.
>
> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> include/hw/qdev-core.h | 27 +++++++++++++++++++++++++++
> include/hw/resettable.h | 9 +++++++++
> hw/core/bus.c | 5 +++++
> hw/core/qdev.c | 5 +++++
> hw/core/resettable.c | 5 +++++
> 5 files changed, 51 insertions(+)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 1b4b420617..b84fcc32bf 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -406,6 +406,13 @@ int qdev_walk_children(DeviceState *dev,
> qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn,
> void *opaque);
>
> +/**
> + * @qdev_reset_all:
> + * Reset @dev. See @qbus_reset_all() for more details.
> + *
> + * Note: This function is deprecated and will be removed when it becomes unused.
> + * Please use device_cold_reset() now.
> + */
> void qdev_reset_all(DeviceState *dev);
> void qdev_reset_all_fn(void *opaque);
>
> @@ -418,10 +425,28 @@ void qdev_reset_all_fn(void *opaque);
> * hard reset means that qbus_reset_all will reset all state of the device.
> * For PCI devices, for example, this will include the base address registers
> * or configuration space.
> + *
> + * Note: This function is deprecated and will be removed when it becomes unused.
> + * Please use bus_cold_reset() now.
> */
> void qbus_reset_all(BusState *bus);
> void qbus_reset_all_fn(void *opaque);
>
> +/**
> + * device_cold_reset:
> + * Reset device @dev and perform a recursive processing using the resettable
> + * interface. It triggers a RESET_TYPE_COLD.
> + */
> +void device_cold_reset(DeviceState *dev);
> +
> +/**
> + * bus_cold_reset:
> + *
> + * Reset bus @bus and perform a recursive processing using the resettable
> + * interface. It triggers a RESET_TYPE_COLD.
> + */
> +void bus_cold_reset(BusState *bus);
> +
> /**
> * device_is_in_reset:
> * Return true if the device @dev is currently being reset.
> @@ -452,6 +477,8 @@ void qdev_machine_init(void);
> * device_legacy_reset:
> *
> * Reset a single device (by calling the reset method).
> + * Note: This function is deprecated and will be removed when it becomes unused.
> + * Please use device_cold_reset() now.
> */
> void device_legacy_reset(DeviceState *dev);
>
> diff --git a/include/hw/resettable.h b/include/hw/resettable.h
> index 3f90da5b5b..0c1adf49ee 100644
> --- a/include/hw/resettable.h
> +++ b/include/hw/resettable.h
> @@ -221,6 +221,15 @@ bool resettable_is_in_reset(Object *obj);
> */
> void resettable_change_parent(Object *obj, Object *newp, Object *oldp);
>
> +/**
> + * resettable_cold_reset_fn:
> + * Helper to call resettable_reset((Object *) opaque, RESET_TYPE_COLD).
> + *
> + * This function is typically useful to register a reset handler with
> + * qemu_register_reset.
> + */
> +void resettable_cold_reset_fn(void *opaque);
> +
> /**
> * resettable_class_set_parent_phases:
> *
> diff --git a/hw/core/bus.c b/hw/core/bus.c
> index 2698f715bd..3dc0a825f0 100644
> --- a/hw/core/bus.c
> +++ b/hw/core/bus.c
> @@ -68,6 +68,11 @@ int qbus_walk_children(BusState *bus,
> return 0;
> }
>
> +void bus_cold_reset(BusState *bus)
> +{
> + resettable_reset(OBJECT(bus), RESET_TYPE_COLD);
> +}
> +
> bool bus_is_in_reset(BusState *bus)
> {
> return resettable_is_in_reset(OBJECT(bus));
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 5fac4cd8fc..a7a7abe569 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -361,6 +361,11 @@ void qbus_reset_all_fn(void *opaque)
> qbus_reset_all(bus);
> }
>
> +void device_cold_reset(DeviceState *dev)
> +{
> + resettable_reset(OBJECT(dev), RESET_TYPE_COLD);
> +}
> +
> bool device_is_in_reset(DeviceState *dev)
> {
> return resettable_is_in_reset(OBJECT(dev));
> diff --git a/hw/core/resettable.c b/hw/core/resettable.c
> index e99bb30058..7647ef6863 100644
> --- a/hw/core/resettable.c
> +++ b/hw/core/resettable.c
> @@ -264,6 +264,11 @@ void resettable_change_parent(Object *obj, Object *newp, Object *oldp)
> }
> }
>
> +void resettable_cold_reset_fn(void *opaque)
> +{
> + resettable_reset((Object *) opaque, RESET_TYPE_COLD);
> +}
> +
> void resettable_class_set_parent_phases(ResettableClass *rc,
> ResettableEnterPhase enter,
> ResettableHoldPhase hold,
>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2020-01-18 6:48 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é [this message]
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é
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=2976a5cc-142c-7a53-119b-9dc8c9e4d366@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).