qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, "Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	virtio-fs@redhat.com,
	"Erik Schilling" <erik.schilling@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Mathieu Poirier" <mathieu.poirier@linaro.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [PATCH 08/12] qom: allow for properties to become "fixed"
Date: Mon, 17 Apr 2023 12:26:31 +0100	[thread overview]
Message-ID: <878req9211.fsf@linaro.org> (raw)
In-Reply-To: <87bkjmddxi.fsf@pond.sub.org>


Markus Armbruster <armbru@redhat.com> writes:

> Alex Bennée <alex.bennee@linaro.org> writes:
>
>> When specialising general purpose objects it is sometimes useful to
>> "fix" some of the properties that were configurable by the base
>> classes. We will use this facility when specialising
>> vhost-user-device.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  qapi/qom.json           |  2 ++
>>  include/qom/object.h    | 16 +++++++++++++++-
>>  qom/object.c            | 14 ++++++++++++++
>>  qom/object_interfaces.c |  9 ++++++---
>>  qom/qom-qmp-cmds.c      |  1 +
>>  softmmu/qdev-monitor.c  |  1 +
>>  6 files changed, 39 insertions(+), 4 deletions(-)
>>
>> diff --git a/qapi/qom.json b/qapi/qom.json
>> index a877b879b9..4cda191f00 100644
>> --- a/qapi/qom.json
>> +++ b/qapi/qom.json
>> @@ -33,12 +33,14 @@
>>  # @description: if specified, the description of the property.
>>  #
>>  # @default-value: the default value, if any (since 5.0)
>> +# @fixed: if specified if value has been fixed (since 8.1)
>
> Wat?
>
>>  #
>>  # Since: 1.2
>>  ##
>>  { 'struct': 'ObjectPropertyInfo',
>>    'data': { 'name': 'str',
>>              'type': 'str',
>> +            'fixed': 'bool',
>>              '*description': 'str',
>>              '*default-value': 'any' } }
>>  
>
> qom-list and qom-list-properties return a list of this.  Use cases for
> the new member?

The use-case is this whole series. Basically I want to have a generic
device (vhost-user-device) which has a bunch of control knobs the user
can fiddle with (e.g. virtio id, num_vqs and the like). However for the
specialised versions of this device (e.g. vhost-user-gpio) some of these
values (e.g. virtio id) need to be fixed.

Mark suggested maybe just duplicating the properties in a similar way to
DEFINE_AUDIO_PROPERTIES but that doesn't really address the problem
wanting to "fix" some of the values for the subclasses and preventing
the user from changing things.

I appreciate this is possibly a horrible hack so I'm open to the QOM
experts showing me the correct way to model this sort of behaviour.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-04-17 11:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 16:04 [PATCH 00/12] virtio: add vhost-user-generic and reduce copy and paste Alex Bennée
2023-04-14 16:04 ` [PATCH 01/12] hw/virtio: fix typo in VIRTIO_CONFIG_IRQ_IDX comments Alex Bennée
2023-04-14 16:04 ` [PATCH 02/12] include/hw/virtio: document virtio_notify_config Alex Bennée
2023-04-14 16:04 ` [PATCH 03/12] include/hw/virtio: add kerneldoc for virtio_init Alex Bennée
2023-04-14 16:04 ` [PATCH 04/12] include/hw/virtio: document some more usage of notifiers Alex Bennée
2023-04-14 16:04 ` [PATCH 05/12] virtio: add generic vhost-user-device Alex Bennée
2023-04-14 16:04 ` [PATCH 06/12] virtio: add PCI stub for vhost-user-device Alex Bennée
2023-04-18  8:28   ` Erik Schilling
2023-04-14 16:04 ` [PATCH 07/12] include: attempt to document device_class_set_props Alex Bennée
2023-04-14 16:04 ` [PATCH 08/12] qom: allow for properties to become "fixed" Alex Bennée
2023-04-17 10:02   ` Markus Armbruster
2023-04-17 11:26     ` Alex Bennée [this message]
2023-04-17 12:04       ` Peter Maydell
2023-04-14 16:04 ` [PATCH 09/12] hw/virtio: derive vhost-user-rng from vhost-user-device Alex Bennée
2023-04-14 16:04 ` [PATCH 10/12] hw/virtio: add config support to vhost-user-device Alex Bennée
2023-04-14 16:04 ` [PATCH 11/12] hw/virtio: derive vhost-user-gpio from vhost-user-device (!BROKEN) Alex Bennée
2023-04-14 16:04 ` [PATCH 12/12] docs/system: add a basic enumeration of vhost-user devices Alex Bennée
2023-04-17  4:26 ` [PATCH 00/12] virtio: add vhost-user-generic and reduce copy and paste Viresh Kumar
2023-04-17  8:42   ` Alex Bennée
2023-04-17 12:32 ` Stefan Hajnoczi
2023-04-17 16:14   ` Alex Bennée
2023-04-18 16:04     ` Stefan Hajnoczi

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=878req9211.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=erik.schilling@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=viresh.kumar@linaro.org \
    --cc=virtio-fs@redhat.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 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).