qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: mark.langsdorf@calxeda.com, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable
Date: Tue, 03 Dec 2013 14:19:34 +0100	[thread overview]
Message-ID: <529DDA66.2030504@suse.de> (raw)
In-Reply-To: <10d4ecd00bfd9f76e2668fda2e9b2214865e1ceb.1386053678.git.peter.crosthwaite@xilinx.com>

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 <peter.crosthwaite@xilinx.com>
> ---
> 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. Your
change seems to make them writable - can anything go wrong when the
setters are used via QMP? I fear we may need two separate sets of
functions, one read-only, one read-write.

Andreas

> 
>  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

  reply	other threads:[~2013-12-03 13:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03  6:58 [Qemu-devel] [PATCH arm-devs v3 0/9] Fix Support for ARM A9 CBAR Peter Crosthwaite
2013-12-03  6:59 ` [Qemu-devel] [PATCH arm-devs v3 1/9] qom/object: Make uintXX added properties writable Peter Crosthwaite
2013-12-03 13:19   ` Andreas Färber [this message]
2013-12-06 14:49     ` Peter Maydell
2013-12-15  5:59       ` Peter Crosthwaite
2013-12-15 17:56         ` Andreas Färber
2013-12-15 18:07           ` Michael S. Tsirkin
2013-12-16  2:39             ` Peter Crosthwaite
2013-12-16  2:37           ` Peter Crosthwaite
2013-12-15 10:23     ` Michael S. Tsirkin
2013-12-03 13:26   ` Andreas Färber
2013-12-03  7:00 ` [Qemu-devel] [PATCH arm-devs v3 2/9] target-arm/helper.c: Allow cp15.c15 dummy override Peter Crosthwaite
2013-12-06 14:36   ` Peter Maydell
2013-12-03  7:00 ` [Qemu-devel] [PATCH arm-devs v3 3/9] target-arm: Define and use ARM_FEATURE_CBAR Peter Crosthwaite
2013-12-06 14:12   ` Peter Maydell
2013-12-11  0:57     ` Peter Crosthwaite
2013-12-03  7:01 ` [Qemu-devel] [PATCH arm-devs v3 4/9] target-arm/cpu: Convert reset CBAR to a property Peter Crosthwaite
2013-12-06 14:41   ` Peter Maydell
2013-12-11  1:03     ` Peter Crosthwaite
2013-12-16  1:32     ` Peter Crosthwaite
2013-12-03  7:01 ` [Qemu-devel] [PATCH arm-devs v3 5/9] arm/highbank: Use object_new() rather than cpu_arm_init() Peter Crosthwaite
2013-12-06 14:42   ` Peter Maydell
2013-12-03  7:02 ` [Qemu-devel] [PATCH arm-devs v3 6/9] arm/highbank: Fix CBAR initialisation Peter Crosthwaite
2013-12-06 14:43   ` Peter Maydell
2013-12-03  7:02 ` [Qemu-devel] [PATCH arm-devs v3 7/9] arm/xilinx_zynq: Use object_new() rather than cpu_arm_init() Peter Crosthwaite
2013-12-06 14:43   ` Peter Maydell
2013-12-03  7:03 ` [Qemu-devel] [PATCH arm-devs v3 8/9] arm/xilinx_zynq: Implement CBAR initialisation Peter Crosthwaite
2013-12-06 14:44   ` Peter Maydell
2013-12-03  7:04 ` [Qemu-devel] [PATCH arm-devs v3 9/9] arm/highbank.c: Fix MPCore periphbase name Peter Crosthwaite
2013-12-06 14:47   ` 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=529DDA66.2030504@suse.de \
    --to=afaerber@suse.de \
    --cc=mark.langsdorf@calxeda.com \
    --cc=mst@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@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 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).