From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com,
richard.henderson@linaro.org, eduardo@habkost.net
Subject: Re: [PATCH 1/2] qdev: change qdev_prop_set_globals() to use Object*
Date: Wed, 3 Jul 2024 12:04:18 +0100 [thread overview]
Message-ID: <ZoUwMr1X170aQNDS@redhat.com> (raw)
In-Reply-To: <20240703094626.1704990-2-dbarboza@ventanamicro.com>
On Wed, Jul 03, 2024 at 06:46:25AM -0300, Daniel Henrique Barboza wrote:
> Next patch will add Accel globals support and will use
> qdev_prop_set_globals().
>
> At this moment this function is hardwired to be used with DeviceState.
> dev->hotplugged is checked to determine if object_apply_global_props()
> will receive a NULL or an &error_fatal errp.
>
> Change qdev_prop_set_globals() to receive an Object and an errp. The
> logic using dev->hotplugged is moved to the caller, device_post_init().
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> hw/core/qdev-properties.c | 5 ++---
> hw/core/qdev.c | 2 +-
> include/hw/qdev-properties.h | 2 +-
> 3 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 86a583574d..4867d7dd9e 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -920,10 +920,9 @@ int qdev_prop_check_globals(void)
> return ret;
> }
>
> -void qdev_prop_set_globals(DeviceState *dev)
> +void qdev_prop_set_globals(Object *obj, Error **errp)
> {
> - object_apply_global_props(OBJECT(dev), global_props(),
> - dev->hotplugged ? NULL : &error_fatal);
> + object_apply_global_props(obj, global_props(), errp);
> }
If you're going to make this work on Object, instead fo merely
DeviceState, then all this globals functionality should be
moved into qom/object.c, and the methods renamed, as it is no
longer qdev logic.
>
> /* --- 64bit unsigned int 'size' type --- */
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index f3a996f57d..923f9ca74c 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -673,7 +673,7 @@ static void device_post_init(Object *obj)
> * precedence.
> */
> object_apply_compat_props(obj);
> - qdev_prop_set_globals(DEVICE(obj));
> + qdev_prop_set_globals(obj, DEVICE(obj)->hotplugged ? NULL : &error_fatal);
> }
>
> /* Unlink device from bus and free the structure. */
> diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
> index 09aa04ca1e..a1737bf4d8 100644
> --- a/include/hw/qdev-properties.h
> +++ b/include/hw/qdev-properties.h
> @@ -210,7 +210,7 @@ void qdev_prop_register_global(GlobalProperty *prop);
> const GlobalProperty *qdev_find_global_prop(Object *obj,
> const char *name);
> int qdev_prop_check_globals(void);
> -void qdev_prop_set_globals(DeviceState *dev);
> +void qdev_prop_set_globals(Object *obj, Error **errp);
> void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
> const char *name, const char *value);
>
> --
> 2.45.2
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2024-07-03 11:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 9:46 [PATCH 0/2] qdev,accel-system: allow Accel type globals Daniel Henrique Barboza
2024-07-03 9:46 ` [PATCH 1/2] qdev: change qdev_prop_set_globals() to use Object* Daniel Henrique Barboza
2024-07-03 11:04 ` Daniel P. Berrangé [this message]
2024-07-03 9:46 ` [PATCH 2/2] qdev, accel-system: add support to Accel globals Daniel Henrique Barboza
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=ZoUwMr1X170aQNDS@redhat.com \
--to=berrange@redhat.com \
--cc=dbarboza@ventanamicro.com \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@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).