Message ID | 20240703094626.1704990-2-dbarboza@ventanamicro.com |
---|---|
State | New |
Headers | show |
Series | qdev,accel-system: allow Accel type globals | expand |
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
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); } /* --- 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);
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(-)