All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: marcandre.lureau@redhat.com
Cc: Markus Armbruster <armbru@redhat.com>,
	 qemu-devel@nongnu.org, pbonzini@redhat.com,
	 berrange@redhat.com
Subject: Re: [PATCH 1/2] qdev: Convert array properties to QAPI-aware registration
Date: Thu, 05 Nov 2026 07:47:05 +0100	[thread overview]
Message-ID: <87cxsjepw6.fsf@pond.sub.org> (raw)
In-Reply-To: <179378802492.1846855.7084872407822363552.b4-review@b4> (marcandre lureau's message of "Wed, 04 Nov 2026 14:27:04 +0400")

marcandre.lureau@redhat.com writes:

>> Add element_info and element_size fields to PropertyInfo.
>> 
>> Add typed array PropertyInfo definitions. Each one knows its element
>> type at compile time through the new element_info and element_size
>> fields of PropertyInfo.
>> 
>> Update DEFINE_PROP_ARRAY() to use them instead of the generic
>> qdev_prop_array.
>> 
>> Use PropertyInfo fields element_info and element_size instead of
>> Property fields arrayinfo and arrayfieldsize.  Remove arrayinfo and
>> arrayfieldsize.
>> 
>> Infrastructure changes:
>> - Make get_prop_array, set_prop_array, release_prop_array, and
>>   default_prop_array non-static so they can be used by
>>   DEFINE_PROP_ARRAY_INFO in other translation units
>> - Add DEFINE_PROP_ARRAY_INFO macro in qdev-prop-internal.h
>> 
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> Message-ID: <20261104083816.1120306-2-armbru@redhat.com>

[...]

>> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
>> index e2ea8945956c..7a7d4f9d7910 100644
>> --- a/hw/core/qdev-properties.c
>> +++ b/hw/core/qdev-properties.c

[...]

>> @@ -854,18 +860,24 @@ out_obj:
>>      }
>>  }
>>  
>> -static void default_prop_array(ObjectProperty *op, const Property *prop)
>> +void default_prop_array(ObjectProperty *op, const Property *prop)
>>  {
>>      object_property_set_default_list(op);
>>  }
>>  
>> -const PropertyInfo qdev_prop_array = {
>> -    .type = "list",
>> -    .get = get_prop_array,
>> -    .set = set_prop_array,
>> -    .release = release_prop_array,
>> -    .set_default_value = default_prop_array,
>> -};
>> +const PropertyInfo qdev_prop_uint8_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint8, uint8_t, &uint8List_type_info);
>> +const PropertyInfo qdev_prop_uint16_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint16, uint16_t, &uint16List_type_info);
>> +const PropertyInfo qdev_prop_uint32_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint32, uint32_t, &uint32List_type_info);
>> +const PropertyInfo qdev_prop_uint64_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_uint64, uint64_t, &uint64List_type_info);
>> +const PropertyInfo qdev_prop_string_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_string, char *, &strList_type_info);
>> +
>> +const PropertyInfo qdev_prop_link_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_link, void *, NULL);
>
> It could use &strList_type_info, since qdev_prop_link uses
> &str_type_info and serialize as object-path strings.

Point.

>>  /* --- public helpers --- */
>>  
>> diff --git a/hw/display/apple-gfx.h b/hw/display/apple-gfx.h
>> index 3197bd853dab..652f158223c0 100644
>> --- a/hw/display/apple-gfx.h
>> +++ b/hw/display/apple-gfx.h
>> @@ -69,6 +69,7 @@ void *apple_gfx_host_ptr_for_gpa_range(uint64_t guest_physical,
>>                                         MemoryRegion **mapping_in_region);
>>  
>>  extern const PropertyInfo qdev_prop_apple_gfx_display_mode;
>> +extern const PropertyInfo qdev_prop_apple_gfx_display_mode_array;
>>  
>>  #endif
>>  
>> diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m
>> index 4db80f0b107e..f800f84aa2b5 100644
>> --- a/hw/display/apple-gfx.m
>> +++ b/hw/display/apple-gfx.m
>> @@ -16,6 +16,7 @@
>>  #include "qemu/cutils.h"
>>  #include "qemu/log.h"
>>  #include "qapi/qapi-builtin-type-infos.h"
>> +#include "hw/core/qdev-prop-internal.h"
>>  #include "qapi/visitor.h"
>>  #include "qapi/error.h"
>>  #include "qemu/aio-wait.h"
>> @@ -880,3 +881,8 @@ static void apple_gfx_set_display_mode(Object *obj, Visitor *v,
>>      .get   = apple_gfx_get_display_mode,
>>      .set   = apple_gfx_set_display_mode,
>>  };
>> +
>> +const PropertyInfo qdev_prop_apple_gfx_display_mode_array =
>> +    DEFINE_PROP_ARRAY_INFO(qdev_prop_apple_gfx_display_mode,
>> +			   AppleGFXDisplayMode,
>> +			   &strList_type_info);
>
> indented with tabs

Oops.

Thank you!



  reply	other threads:[~2026-11-05  6:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  8:38 [PATCH 0/2] qdev: Typed array properties for better QOM introspection Markus Armbruster
2026-11-04  8:38 ` [PATCH 1/2] qdev: Convert array properties to QAPI-aware registration Markus Armbruster
2026-11-04 10:27   ` marcandre.lureau
2026-11-05  6:47     ` Markus Armbruster [this message]
2026-11-05  7:35       ` Markus Armbruster
2026-11-04  8:38 ` [PATCH 2/2] qdev: Remove unused DEFINE_PROP_ARRAY parameter _arraytype Markus Armbruster
2026-11-04  8:40 ` [PATCH 0/2] qdev: Typed array properties for better QOM introspection Markus Armbruster

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=87cxsjepw6.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --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 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.