From: Zhao Liu <zhao1.liu@intel.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
"Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Peter Xu" <peterx@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH 5/5] hw/core: Remove transitional infrastructure from BusClass
Date: Wed, 31 Jan 2024 11:58:16 +0800 [thread overview]
Message-ID: <ZbnFWB1vJjW0CmzX@intel.com> (raw)
In-Reply-To: <20240119163512.3810301-6-peter.maydell@linaro.org>
On Fri, Jan 19, 2024 at 04:35:12PM +0000, Peter Maydell wrote:
> Date: Fri, 19 Jan 2024 16:35:12 +0000
> From: Peter Maydell <peter.maydell@linaro.org>
> Subject: [PATCH 5/5] hw/core: Remove transitional infrastructure from
> BusClass
> X-Mailer: git-send-email 2.34.1
>
> BusClass currently has transitional infrastructure to support
> subclasses which implement the legacy BusClass::reset method rather
> than the Resettable interface. We have now removed all the users of
> BusClass::reset in the tree, so we can remove the transitional
> infrastructure.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> include/hw/qdev-core.h | 2 --
> hw/core/bus.c | 67 ------------------------------------------
> 2 files changed, 69 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
It seems the similar cleanup for DeviceClass needs a lot of effort.
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 151d9682380..986c924fa55 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -329,8 +329,6 @@ struct BusClass {
> */
> char *(*get_fw_dev_path)(DeviceState *dev);
>
> - void (*reset)(BusState *bus);
> -
> /*
> * Return whether the device can be added to @bus,
> * based on the address that was set (via device properties)
> diff --git a/hw/core/bus.c b/hw/core/bus.c
> index c7831b5293b..b9d89495cdf 100644
> --- a/hw/core/bus.c
> +++ b/hw/core/bus.c
> @@ -232,57 +232,6 @@ static char *default_bus_get_fw_dev_path(DeviceState *dev)
> return g_strdup(object_get_typename(OBJECT(dev)));
> }
>
> -/**
> - * bus_phases_reset:
> - * Transition reset method for buses to allow moving
> - * smoothly from legacy reset method to multi-phases
> - */
> -static void bus_phases_reset(BusState *bus)
> -{
> - ResettableClass *rc = RESETTABLE_GET_CLASS(bus);
> -
> - if (rc->phases.enter) {
> - rc->phases.enter(OBJECT(bus), RESET_TYPE_COLD);
> - }
> - if (rc->phases.hold) {
> - rc->phases.hold(OBJECT(bus));
> - }
> - if (rc->phases.exit) {
> - rc->phases.exit(OBJECT(bus));
> - }
> -}
> -
> -static void bus_transitional_reset(Object *obj)
> -{
> - BusClass *bc = BUS_GET_CLASS(obj);
> -
> - /*
> - * This will call either @bus_phases_reset (for multi-phases transitioned
> - * buses) or a bus's specific method for not-yet transitioned buses.
> - * In both case, it does not reset children.
> - */
> - if (bc->reset) {
> - bc->reset(BUS(obj));
> - }
> -}
> -
> -/**
> - * bus_get_transitional_reset:
> - * check if the bus's class is ready for multi-phase
> - */
> -static ResettableTrFunction bus_get_transitional_reset(Object *obj)
> -{
> - BusClass *dc = BUS_GET_CLASS(obj);
> - if (dc->reset != bus_phases_reset) {
> - /*
> - * dc->reset has been overridden by a subclass,
> - * the bus is not ready for multi phase yet.
> - */
> - return bus_transitional_reset;
> - }
> - return NULL;
> -}
> -
> static void bus_class_init(ObjectClass *class, void *data)
> {
> BusClass *bc = BUS_CLASS(class);
> @@ -293,22 +242,6 @@ static void bus_class_init(ObjectClass *class, void *data)
>
> rc->get_state = bus_get_reset_state;
> rc->child_foreach = bus_reset_child_foreach;
> -
> - /*
> - * @bus_phases_reset is put as the default reset method below, allowing
> - * to do the multi-phase transition from base classes to leaf classes. It
> - * allows a legacy-reset Bus class to extend a multi-phases-reset
> - * Bus class for the following reason:
> - * + If a base class B has been moved to multi-phase, then it does not
> - * override this default reset method and may have defined phase methods.
> - * + A child class C (extending class B) which uses
> - * bus_class_set_parent_reset() (or similar means) to override the
> - * reset method will still work as expected. @bus_phases_reset function
> - * will be registered as the parent reset method and effectively call
> - * parent reset phases.
> - */
> - bc->reset = bus_phases_reset;
> - rc->get_transitional_function = bus_get_transitional_reset;
> }
>
> static void qbus_finalize(Object *obj)
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2024-01-31 3:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 16:35 [PATCH 0/5] buses: switch to 3-phase-reset Peter Maydell
2024-01-19 16:35 ` [PATCH 1/5] pci: Switch bus reset " Peter Maydell
2024-01-31 3:52 ` Zhao Liu
2024-01-19 16:35 ` [PATCH 2/5] vmbus: " Peter Maydell
2024-01-22 14:30 ` Maciej S. Szmigiero
2024-01-31 3:53 ` Zhao Liu
2024-01-19 16:35 ` [PATCH 3/5] adb: " Peter Maydell
2024-01-29 21:42 ` Mark Cave-Ayland
2024-01-31 3:53 ` Zhao Liu
2024-01-19 16:35 ` [PATCH 4/5] hw/s390x/css-bridge: switch virtual-css bus " Peter Maydell
2024-01-22 9:18 ` Halil Pasic
2024-01-22 21:49 ` Eric Farman
2024-01-31 3:54 ` Zhao Liu
2024-01-19 16:35 ` [PATCH 5/5] hw/core: Remove transitional infrastructure from BusClass Peter Maydell
2024-01-31 3:58 ` Zhao Liu [this message]
2024-02-01 13:31 ` Peter Maydell
2024-01-21 11:37 ` [PATCH 0/5] buses: switch to 3-phase-reset Michael S. Tsirkin
2024-01-22 2:06 ` Peter Xu
2024-01-22 14:19 ` Cédric Le Goater
2024-01-31 17:36 ` Cédric Le Goater
2024-02-01 13:20 ` Peter Maydell
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=ZbnFWB1vJjW0CmzX@intel.com \
--to=zhao1.liu@intel.com \
--cc=borntraeger@linux.ibm.com \
--cc=farman@linux.ibm.com \
--cc=maciej.szmigiero@oracle.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--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.