qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Sriram Yagnaraman" <sriram.yagnaraman@ericsson.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Keith Busch" <kbusch@kernel.org>,
	"Klaus Jensen" <its@irrelevant.dk>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH v2 0/4] hw/pci: Convert rom_bar into OnOffAuto
Date: Wed, 31 Jul 2024 10:32:19 +0200	[thread overview]
Message-ID: <87a5hyj71o.fsf@pond.sub.org> (raw)
In-Reply-To: <20240714-rombar-v2-0-af1504ef55de@daynix.com> (Akihiko Odaki's message of "Sun, 14 Jul 2024 16:48:30 +0900")

Akihiko Odaki <akihiko.odaki@daynix.com> writes:

> rom_bar is tristate but was defined as uint32_t so convert it into
> OnOffAuto to clarify that. For compatibility, a uint32 value set via
> QOM will be converted into OnOffAuto.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

I agree making property "rombar" an integer was a design mistake.  I
further agree that vfio_pci_size_rom() peeking into dev->opts to
distinguish "user didn't set a value" from "user set the default value")
is an unadvisable hack.

However, ...

> ---
> Changes in v2:
> - Documented in docs/about/deprecated.rst (Daniel P. Berrangé)
> - Link to v1: https://lore.kernel.org/r/20240706-rombar-v1-0-802daef2aec1@daynix.com
>
> ---
> Akihiko Odaki (4):
>       qapi: Add visit_type_str_preserving()
>       qapi: Do not consume a value when visit_type_enum() fails
>       hw/pci: Convert rom_bar into OnOffAuto
>       hw/qdev: Remove opts member
>
>  docs/about/deprecated.rst         |  7 +++++
>  docs/igd-assign.txt               |  2 +-
>  include/hw/pci/pci_device.h       |  2 +-
>  include/hw/qdev-core.h            |  4 ---
>  include/qapi/visitor-impl.h       |  3 ++-
>  include/qapi/visitor.h            | 25 +++++++++++++----
>  hw/core/qdev.c                    |  1 -
>  hw/pci/pci.c                      | 57 +++++++++++++++++++++++++++++++++++++--
>  hw/vfio/pci-quirks.c              |  2 +-
>  hw/vfio/pci.c                     | 11 ++++----
>  hw/xen/xen_pt_load_rom.c          |  4 +--
>  qapi/opts-visitor.c               | 12 ++++-----
>  qapi/qapi-clone-visitor.c         |  2 +-
>  qapi/qapi-dealloc-visitor.c       |  4 +--
>  qapi/qapi-forward-visitor.c       |  4 ++-
>  qapi/qapi-visit-core.c            | 21 ++++++++++++---
>  qapi/qobject-input-visitor.c      | 23 ++++++++--------
>  qapi/qobject-output-visitor.c     |  2 +-
>  qapi/string-input-visitor.c       |  2 +-
>  qapi/string-output-visitor.c      |  2 +-
>  system/qdev-monitor.c             | 12 +++++----
>  tests/qtest/virtio-net-failover.c | 32 +++++++++++-----------
>  22 files changed, 161 insertions(+), 73 deletions(-)
> ---
> base-commit: f2cb4026fccfe073f84a4b440e41d3ed0c3134f6
> change-id: 20240704-rombar-1a4ba2890d6c
>
> Best regards,

... this is an awful lot of QAPI visitor infrastructure.  Infrastructure
that will likely only ever be used for this one property.

Moreover, the property setter rom_bar_set() is a hack: it first tries to
parse the value as enum, and if that fails, as uint32_t.  QAPI already
provides a way to express "either this type or that type": alternate.
Like this:

    { 'alternate': 'OnOffAutoUint32',
      'data': { 'sym': 'OnOffAuto',
                'uint': 'uint32' } }

Unfortunately, such alternates don't work on the command line due to
keyval visitor restrictions.  These cannot be lifted entirely, but we
might be able to lift them sufficiently to make this alternate work.

Whether it would be worth your trouble and mine just to clean up
"rombar" seems highly dubious, though.



  parent reply	other threads:[~2024-07-31  8:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-14  7:48 [PATCH v2 0/4] hw/pci: Convert rom_bar into OnOffAuto Akihiko Odaki
2024-07-14  7:48 ` [PATCH v2 1/4] qapi: Add visit_type_str_preserving() Akihiko Odaki
2024-07-14  7:48 ` [PATCH v2 2/4] qapi: Do not consume a value when visit_type_enum() fails Akihiko Odaki
2024-07-14  7:48 ` [PATCH v2 3/4] hw/pci: Convert rom_bar into OnOffAuto Akihiko Odaki
2024-07-14  7:48 ` [PATCH v2 4/4] hw/qdev: Remove opts member Akihiko Odaki
2024-07-31  8:32 ` Markus Armbruster [this message]
2024-07-31  8:40   ` [PATCH v2 0/4] hw/pci: Convert rom_bar into OnOffAuto Michael S. Tsirkin
2024-08-01  7:01   ` Akihiko Odaki
2024-08-01  7:52     ` Michael S. Tsirkin
2024-08-01  8:39       ` Akihiko Odaki
2024-08-01 11:05         ` Markus Armbruster
2024-08-01 10:59     ` Markus Armbruster
2024-08-01 12:22       ` Michael S. Tsirkin

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=87a5hyj71o.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=alex.williamson@redhat.com \
    --cc=berrange@redhat.com \
    --cc=clg@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=its@irrelevant.dk \
    --cc=jasowang@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sriram.yagnaraman@ericsson.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).