All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Zhao Liu <zhao1.liu@intel.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
	devel@lists.libvirt.org
Subject: Re: [RFC 07/10] hw/core/qdev-properties: Allow to mark qdev property as deprecated
Date: Fri, 2 Jan 2026 13:27:17 +0100	[thread overview]
Message-ID: <20260102132717.1211737f@imammedo-mac> (raw)
In-Reply-To: <20251202170502.3228625-8-zhao1.liu@intel.com>

On Wed,  3 Dec 2025 01:04:59 +0800
Zhao Liu <zhao1.liu@intel.com> wrote:

> With deprecation flag, make qdev property interfaces to accept
> ObjectPropertyFlags, and provide the boolean and uint8_t macro variants
> to help on deprecation as examples.
> 
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>  hw/core/qdev-properties.c    | 24 +++++++++++++-----------
>  include/hw/qdev-properties.h | 18 ++++++++++++++++++
>  2 files changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 422a486969c8..2cd7de5cec2d 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -1069,11 +1069,12 @@ void qdev_property_add_static(DeviceState *dev, const Property *prop)
>  
>      assert(!prop->info->create);
>  
> -    op = object_property_add(obj, prop->name, prop->info->type,
> -                             field_prop_getter(prop->info),
> -                             field_prop_setter(prop->info),
> -                             prop->info->release,
> -                             (Property *)prop);
> +    op = object_property_try_add_full(obj, prop->name, prop->info->type,
> +                                      field_prop_getter(prop->info),
> +                                      field_prop_setter(prop->info),
> +                                      prop->info->release,
> +                                      prop->flags, (Property *)prop,
> +                                      &error_abort);
>  
>      object_property_set_description(obj, prop->name,
>                                      prop->info->description);
> @@ -1095,12 +1096,13 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name,
>      if (prop->info->create) {
>          op = prop->info->create(oc, name, prop);
>      } else {
> -        op = object_class_property_add(oc,
> -                                       name, prop->info->type,
> -                                       field_prop_getter(prop->info),
> -                                       field_prop_setter(prop->info),
> -                                       prop->info->release,
> -                                       (Property *)prop);
> +        op = object_class_property_add_full(oc,
> +                                            name, prop->info->type,
> +                                            field_prop_getter(prop->info),
> +                                            field_prop_setter(prop->info),
> +                                            prop->info->release,
> +                                            prop->flags,
> +                                            (Property *)prop);
>      }
>      if (prop->set_default) {
>          prop->info->set_default_value(op, prop);
> diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
> index 60b81330097d..383f3f54f0ab 100644
> --- a/include/hw/qdev-properties.h
> +++ b/include/hw/qdev-properties.h
> @@ -11,6 +11,7 @@
>   *     and the field retains whatever value it was given by instance_init).
>   * @defval: default value for the property. This is used only if @set_default
>   *     is true.
> + * @flags: property flags to control uses.
>   */
>  struct Property {
>      const char   *name;
> @@ -27,6 +28,7 @@ struct Property {
>      int          arrayfieldsize;
>      uint8_t      bitnr;
>      bool         set_default;
> +    uint8_t      flags;
>  };
>  
>  struct PropertyInfo {
> @@ -102,6 +104,13 @@ extern const PropertyInfo qdev_prop_link;
>                  .set_default = true,                                       \
>                  .defval.u  = (_type)_defval)
>  
> +#define DEFINE_PROP_UNSIGNED_DEPRECATED(_name, _state, _field, \
> +                                        _defval, _prop, _type) \
> +    DEFINE_PROP(_name, _state, _field, _prop, _type,           \
> +                .set_default = true,                           \
> +                .defval.u    = (_type)_defval,                 \
> +                .flags       = OBJECT_PROPERTY_DEPRECATED)
> +
>  #define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \

adding flags to the end of the names, basicaly spawns a lot of vartions of the same macro,

perhaps it's time to just add flags field and consoladate existing 'flag named' variants,
the one won't need to introduce DEFINE_PROP_UNSIGNED_DEPRECATED at all,
just use appropriate flag(s) when decaring property.

>      DEFINE_PROP(_name, _state, _field, _prop, _type)
>  
> @@ -123,6 +132,12 @@ extern const PropertyInfo qdev_prop_link;
>                  .set_default = true,                         \
>                  .defval.u    = (bool)_defval)
>  
> +#define DEFINE_PROP_BOOL_DEPRECATED(_name, _state, _field, _defval)     \
> +    DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool,            \
> +                .set_default = true,                                    \
> +                .defval.u    = (bool)_defval,                           \
> +                .flags       = OBJECT_PROPERTY_DEPRECATED)
> +
>  /**
>   * The DEFINE_PROP_UINT64_CHECKMASK macro checks a user-supplied value
>   * against corresponding bitmask, rejects the value if it violates.
> @@ -189,6 +204,9 @@ extern const PropertyInfo qdev_prop_link;
>  #define DEFINE_PROP_SIZE32(_n, _s, _f, _d)                       \
>      DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t)
>  
> +#define DEFINE_PROP_UINT8_DEPRECATED(_n, _s, _f, _d)                       \
> +    DEFINE_PROP_UNSIGNED_DEPRECATED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t)
> +
>  /*
>   * Set properties between creation and realization.
>   *



  reply	other threads:[~2026-01-02 12:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 17:04 [RFC 00/10] qom: Support marking object properties as deprecated Zhao Liu
2025-12-02 17:04 ` [RFC 01/10] qom: Rename ObjectPropertyFlags to ObjectPropertyAccessorFlags Zhao Liu
2026-01-02 12:12   ` Igor Mammedov
2026-01-05  7:54     ` Zhao Liu
2026-01-05 12:28       ` Igor Mammedov
2026-01-06  2:14         ` Zhao Liu
2025-12-02 17:04 ` [RFC 02/10] qom: Add basic object property deprecation hint support Zhao Liu
2026-01-02 12:06   ` Igor Mammedov
2026-01-05  9:06     ` Zhao Liu
2025-12-02 17:04 ` [RFC 03/10] qom: Check property deprecation flag for global property Zhao Liu
2025-12-02 17:04 ` [RFC 04/10] qom: Check property deprecation flag for properities from qdict Zhao Liu
2025-12-02 17:04 ` [RFC 05/10] system/vl: Check property deprecation flag for properities of accelerator Zhao Liu
2025-12-02 17:04 ` [RFC 06/10] qom/qom-hmp-cmd: Check property deprecation flag for "qom-set" command Zhao Liu
2025-12-02 17:04 ` [RFC 07/10] hw/core/qdev-properties: Allow to mark qdev property as deprecated Zhao Liu
2026-01-02 12:27   ` Igor Mammedov [this message]
2026-01-05  8:34     ` Zhao Liu
2025-12-02 17:05 ` [RFC 08/10] target/i386: Deprecate fill-mtrr-mask property Zhao Liu
2025-12-02 17:05 ` [RFC 09/10] target/i386: Deprecate cpuid-0xb property Zhao Liu
2025-12-02 17:05 ` [RFC 10/10] hw/intc/ioapic: Deprecate version property Zhao Liu

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=20260102132717.1211737f@imammedo-mac \
    --to=imammedo@redhat.com \
    --cc=armbru@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=devel@lists.libvirt.org \
    --cc=eduardo@habkost.net \
    --cc=mark.caveayland@nutanix.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=zhao1.liu@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.