[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-3.2 v5 07/19] hw: apply accel compat propert
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH for-3.2 v5 07/19] hw: apply accel compat properties without touching globals |
Date: |
Mon, 10 Dec 2018 17:54:41 +0100 |
On Mon, 10 Dec 2018 17:45:22 +0100
Igor Mammedov <address@hidden> wrote:
> On Tue, 4 Dec 2018 18:20:11 +0400
> Marc-André Lureau <address@hidden> wrote:
>
> > Instead of registering compat properties as globals, let's keep them
> > in their own array, to avoid mixing with user globals.
> >
> > Introduce object_apply_global_props() function, to apply compatibility
> > properties from a GPtrArray.
> >
> > Signed-off-by: Marc-André Lureau <address@hidden>
> > ---
> > include/hw/qdev-core.h | 10 ++++++++++
> > include/qom/object.h | 3 +++
> > include/sysemu/accel.h | 4 +---
> > accel/accel.c | 12 ------------
> > hw/core/qdev.c | 9 +++++++++
> > hw/xen/xen-common.c | 9 ++++++---
> > qom/object.c | 25 +++++++++++++++++++++++++
> > vl.c | 1 -
> > 8 files changed, 54 insertions(+), 19 deletions(-)
> >
> [...]
> > diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
> > index 6ec14c73ca..4532aa8632 100644
> > --- a/hw/xen/xen-common.c
> > +++ b/hw/xen/xen-common.c
> > @@ -174,18 +174,21 @@ static GlobalProperty xen_compat_props[] = {
> > .driver = "migration",
> > .property = "send-section-footer",
> > .value = "off",
> > - },
> > - { /* end of list */ },
> > + }
> > };
> >
> > static void xen_accel_class_init(ObjectClass *oc, void *data)
> > {
> > AccelClass *ac = ACCEL_CLASS(oc);
> > +
> > ac->name = "Xen";
> > ac->init_machine = xen_init;
> > ac->setup_post = xen_setup_post;
> > ac->allowed = &xen_allowed;
> > - ac->global_props = xen_compat_props;
> > + ac->compat_props = g_ptr_array_new();
> where is matching free for that?
can we at least annotate it somehow so that valgrind won't complain about this
leak?
>
> > +
> > + compat_props_add(ac->compat_props,
> > + xen_compat_props, G_N_ELEMENTS(xen_compat_props));
> > }
> >
> > #define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
> > diff --git a/qom/object.c b/qom/object.c
> > index 17921c0a71..dbdab0aead 100644
> > --- a/qom/object.c
> > +++ b/qom/object.c
> > @@ -370,6 +370,31 @@ static void object_post_init_with_type(Object *obj,
> > TypeImpl *ti)
> > }
> > }
> >
> > +void object_apply_global_props(Object *obj, const GPtrArray *props, Error
> > **errp)
> > +{
> > + Error *err = NULL;
> > + int i;
> > +
> > + if (!props) {
> > + return;
> > + }
> > +
> > + for (i = 0; i < props->len; i++) {
> > + GlobalProperty *p = g_ptr_array_index(props, i);
> > +
> > + if (object_dynamic_cast(obj, p->driver) == NULL) {
> > + continue;
> > + }
> > + p->used = true;
> > + object_property_parse(obj, p->value, p->property, &err);
> > + if (err != NULL) {
> > + error_prepend(&err, "can't apply global %s.%s=%s: ",
> > + p->driver, p->property, p->value);
> > + error_propagate(errp, err);
> > + }
> > + }
> > +}
> > +
> > static void object_initialize_with_type(void *data, size_t size, TypeImpl
> > *type)
> > {
> > Object *obj = data;
> > diff --git a/vl.c b/vl.c
> > index a5ae5f23d2..88ba658572 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -2968,7 +2968,6 @@ static void user_register_global_props(void)
> > */
> > static void register_global_properties(MachineState *ms)
> > {
> > - accel_register_compat_props(ms->accelerator);
> > machine_register_compat_props(ms);
> > user_register_global_props();
> > }
>
>
- [Qemu-devel] [PATCH for-3.2 v5 00/19] Generalize machine compatibility properties, Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 01/19] tests: qdev_prop_check_globals() doesn't return "all_used", Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 03/19] qom: make user_creatable_complete() specific to UserCreatable, Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 02/19] qom: make interface types abstract, Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 04/19] accel: register global_props like machine globals, Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 05/19] qdev: move qdev_prop_register_global_list() to tests, Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 06/19] qom: remove unimplemented class_finalize, Marc-André Lureau, 2018/12/04
- [Qemu-devel] [PATCH for-3.2 v5 07/19] hw: apply accel compat properties without touching globals, Marc-André Lureau, 2018/12/04
- Re: [Qemu-devel] [PATCH for-3.2 v5 07/19] hw: apply accel compat properties without touching globals, Igor Mammedov, 2018/12/11
[Qemu-devel] [PATCH for-3.2 v5 09/19] hw: remove SET_MACHINE_COMPAT, Marc-André Lureau, 2018/12/04
[Qemu-devel] [PATCH for-3.2 v5 10/19] qdev: make a separate helper function to apply compat properties, Marc-André Lureau, 2018/12/04
[Qemu-devel] [PATCH for-3.2 v5 11/19] qdev: all globals are now user-provided, Marc-André Lureau, 2018/12/04
[Qemu-devel] [PATCH for-3.2 v5 12/19] qdev-props: convert global_props to GPtrArray, Marc-André Lureau, 2018/12/04