[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added p
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable |
Date: |
Sun, 15 Dec 2013 12:23:17 +0200 |
On Tue, Dec 03, 2013 at 02:19:34PM +0100, Andreas Färber wrote:
> Am 03.12.2013 07:59, schrieb Peter Crosthwaite:
> > Currently the uintXX property adders make a read only property. This
> > is not useful for devices that want to create board (or container)
> > configurable dynamic device properties. Fix by trivially adding property
> > setters to object_property_add_uintXX.
> >
> > Signed-off-by: Peter Crosthwaite <address@hidden>
> > ---
> > changed since v2:
> > msg typo: "trivially"
>
> Not sure if I've asked already, but these functions were added by mst
> (so let's CC him) for accessing read-only constants in ACPI code.
Yes - for ACPI we used these for properties which users shouldn't
be able to change.
> Your
> change seems to make them writable - can anything go wrong when the
> setters are used via QMP?
Guest won't boot.
> I fear we may need two separate sets of
> functions, one read-only, one read-write.
>
> Andreas
I think so, yes.
> >
> > qom/object.c | 44 ++++++++++++++++++++++++++++++++++++++++----
> > 1 file changed, 40 insertions(+), 4 deletions(-)
> >
> > diff --git a/qom/object.c b/qom/object.c
> > index fc19cf6..07b454b 100644
> > --- a/qom/object.c
> > +++ b/qom/object.c
> > @@ -1353,6 +1353,15 @@ static void property_get_uint8_ptr(Object *obj,
> > Visitor *v,
> > visit_type_uint8(v, &value, name, errp);
> > }
> >
> > +static void property_set_uint8_ptr(Object *obj, Visitor *v,
> > + void *opaque, const char *name,
> > + Error **errp)
> > +{
> > + uint8_t value;
> > + visit_type_uint8(v, &value, name, errp);
> > + *(uint8_t *)opaque = value;
> > +}
> > +
> > static void property_get_uint16_ptr(Object *obj, Visitor *v,
> > void *opaque, const char *name,
> > Error **errp)
> > @@ -1361,6 +1370,15 @@ static void property_get_uint16_ptr(Object *obj,
> > Visitor *v,
> > visit_type_uint16(v, &value, name, errp);
> > }
> >
> > +static void property_set_uint16_ptr(Object *obj, Visitor *v,
> > + void *opaque, const char *name,
> > + Error **errp)
> > +{
> > + uint16_t value;
> > + visit_type_uint16(v, &value, name, errp);
> > + *(uint16_t *)opaque = value;
> > +}
> > +
> > static void property_get_uint32_ptr(Object *obj, Visitor *v,
> > void *opaque, const char *name,
> > Error **errp)
> > @@ -1369,6 +1387,15 @@ static void property_get_uint32_ptr(Object *obj,
> > Visitor *v,
> > visit_type_uint32(v, &value, name, errp);
> > }
> >
> > +static void property_set_uint32_ptr(Object *obj, Visitor *v,
> > + void *opaque, const char *name,
> > + Error **errp)
> > +{
> > + uint32_t value;
> > + visit_type_uint32(v, &value, name, errp);
> > + *(uint32_t *)opaque = value;
> > +}
> > +
> > static void property_get_uint64_ptr(Object *obj, Visitor *v,
> > void *opaque, const char *name,
> > Error **errp)
> > @@ -1377,32 +1404,41 @@ static void property_get_uint64_ptr(Object *obj,
> > Visitor *v,
> > visit_type_uint64(v, &value, name, errp);
> > }
> >
> > +static void property_set_uint64_ptr(Object *obj, Visitor *v,
> > + void *opaque, const char *name,
> > + Error **errp)
> > +{
> > + uint64_t value;
> > + visit_type_uint64(v, &value, name, errp);
> > + *(uint64_t *)opaque = value;
> > +}
> > +
> > void object_property_add_uint8_ptr(Object *obj, const char *name,
> > const uint8_t *v, Error **errp)
> > {
> > object_property_add(obj, name, "uint8", property_get_uint8_ptr,
> > - NULL, NULL, (void *)v, errp);
> > + property_set_uint8_ptr, NULL, (void *)v, errp);
> > }
> >
> > void object_property_add_uint16_ptr(Object *obj, const char *name,
> > const uint16_t *v, Error **errp)
> > {
> > object_property_add(obj, name, "uint16", property_get_uint16_ptr,
> > - NULL, NULL, (void *)v, errp);
> > + property_set_uint16_ptr, NULL, (void *)v, errp);
> > }
> >
> > void object_property_add_uint32_ptr(Object *obj, const char *name,
> > const uint32_t *v, Error **errp)
> > {
> > object_property_add(obj, name, "uint32", property_get_uint32_ptr,
> > - NULL, NULL, (void *)v, errp);
> > + property_set_uint32_ptr, NULL, (void *)v, errp);
> > }
> >
> > void object_property_add_uint64_ptr(Object *obj, const char *name,
> > const uint64_t *v, Error **errp)
> > {
> > object_property_add(obj, name, "uint64", property_get_uint64_ptr,
> > - NULL, NULL, (void *)v, errp);
> > + property_set_uint64_ptr, NULL, (void *)v, errp);
> > }
> >
> > static void object_instance_init(Object *obj)
> >
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- [Qemu-devel] [PATCH arm-devs v3 0/9] Fix Support for ARM A9 CBAR, Peter Crosthwaite, 2013/12/03
- [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Peter Crosthwaite, 2013/12/03
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Andreas Färber, 2013/12/03
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Peter Maydell, 2013/12/06
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Peter Crosthwaite, 2013/12/15
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Andreas Färber, 2013/12/15
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Michael S. Tsirkin, 2013/12/15
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Peter Crosthwaite, 2013/12/15
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Peter Crosthwaite, 2013/12/15
- Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable,
Michael S. Tsirkin <=
Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable, Andreas Färber, 2013/12/03
[Qemu-devel] [PATCH arm-devs v3 2/9] target-arm/helper.c: Allow cp15.c15 dummy override, Peter Crosthwaite, 2013/12/03
[Qemu-devel] [PATCH arm-devs v3 3/9] target-arm: Define and use ARM_FEATURE_CBAR, Peter Crosthwaite, 2013/12/03
[Qemu-devel] [PATCH arm-devs v3 4/9] target-arm/cpu: Convert reset CBAR to a property, Peter Crosthwaite, 2013/12/03