All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: "Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	qemu-devel@nongnu.org, "Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
	"Bernhard Beschow" <shentey@gmail.com>,
	"Anton Johansson" <anjo@rev.ng>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Alistair Francis" <alistair.francis@wdc.com>
Subject: Re: [PATCH 01/27] include/qemu/target-info-qom.h: declare TYPE_TARGET_SPECIFIC interface
Date: Thu, 27 Aug 2026 13:22:27 +0100	[thread overview]
Message-ID: <apAsA2gg58ctdtwL@redhat.com> (raw)
In-Reply-To: <9292ce2a-6493-41f9-85a0-b6d90f1fdab0@linaro.org>

On Wed, Aug 26, 2026 at 04:07:22PM -0700, Richard Henderson wrote:
> On 8/21/26 16:53, Pierrick Bouvier wrote:
> > > > > > > > > Based on this, I'm much more in favor or 1. The fact availability
> > > > > > > > > information is in the same location than type definition is the biggest
> > > > > > > > > advantage for me.
> > > > > > > > > 
> > > > > > > > > On example given above, this would give something like this:
> > > > > > > > > static const TypeInfo emulated_card_info = {
> > > > > > > > >       .name          = TYPE_EMULATED_CCID,
> > > > > > > > >       .parent        = TYPE_CCID_CARD,
> > > > > > > > >       .instance_size = sizeof(EmulatedState),
> > > > > > > > >       .class_init    = emulated_class_initfn,
> > > > > > > > >       .is_available  = target_config_X,
> > > > > > > > > };
> > > > > > > > > 
> > > > > > > > > Would that work for you?
> > > > > > > > > Do you have a 3rd way to offer to solve the problem we have?
> > > > > > > > In the case of user creatable objects, we represented a classes'
> > > > > > > > conditional availablity in QAPI schema. For example:
> > > > > > > > 
> > > > > > > >    { 'struct': 'InputLinuxProperties',
> > > > > > > >      'data': { 'evdev': 'str',
> > > > > > > >                '*grab_all': 'bool',
> > > > > > > >                '*repeat': 'bool',
> > > > > > > >                '*grab-toggle': 'GrabToggleKeys' },
> > > > > > > >      'if': 'CONFIG_LINUX' }
> > > > > > > > 
> > > > > > > > Now this isn't quite a match for what we want, as QAPI schema is
> > > > > > > > common to all targets and used to control the code generator to
> > > > > > > > turn off output. Thus the permitted CONFIG_xxx are only those in
> > > > > > > > config-host.mak, not any from $TARGET-softmmu-config-devices.mak
> > > > > > > > 
> > > > > > > > The other scenario in QAPI is the concept of features:
> > > > > > > > 
> > > > > > > > { 'struct': 'SevCommonProperties',
> > > > > > > >    'data': { '*sev-device': 'str',
> > > > > > > >              '*cbitpos': 'uint32',
> > > > > > > >              'reduced-phys-bits': 'uint32',
> > > > > > > >              '*kernel-hashes': 'bool' },
> > > > > > > >    'features': ['confidential-guest-reset']}
> > > > > > > > 
> > > > > > > > where again we just have a list of named strings. Features are fully
> > > > > > > > dynamic, and crucially they are introspectable so applications can
> > > > > > > > query at runtime what is available.
> > > > > > > > 
> > > > > > > > The introspection concept is something that is highly likely to be
> > > > > > > > relevant to our use cases here. If we have a single binary with all
> > > > > > > > types, it would be very valuable to be able to query it once to
> > > > > > > > discover everything in one go, instead of havnig to query it over
> > > > > > > > and over again for each target. That implies the application doing
> > > > > > > > the query needs to be told about per-target usage restrictions on
> > > > > > > > types it is querying.
> 
> Having read through Pierrick's v2, I'm not a fan of inventing a new
> enumeration, creating a switch, calling exactly the functions we could have
> registered directly.
> 
> I think the misunderstanding here, Dan, is that the filter is for the
> non-heterogeneous '-target foo' case.  In the target-foo case, the
> introspection is not highly likely, because we don't have it now.  The only
> point is to have, at the end of registration, exactly the same set of
> classes as we have now.

That's not what this code gives us though.  At the end of registration
we have the union of all classes from all targets - qom-list-type lists
everything. Instead when querying classes, the consumers have to apply
filtering which IMHO is too late.

My suggestion was to take an approach that filters at the time of
registration, so we never register classes that are irrelevant for
the target and thus don't need filtering by consumers.

Having looked at Yonggang's add-on series though that actually
introduces 'qemu-system', I think we should not do filtering at
all, neither at registration or by consumers.

The filtering is only needed if we want 'qemu-system -target aarch64'
to be a perfect match for 'qemu-system-aarch64'. I think that is a
mistaken goal, and is creating uneccessary work.

Instead declare that 'qemu-system' always reports everything that
was built into it and avoid having to create this filtering logic
entirely.

> The introspection case is perhaps probable in the heterogeneous case, where
> the filtering will not apply.  In the heterogeneous case we just register
> *everything* and let the magic runtime defined machine pick and choose. 
> Thus incorporating the filter into the introspection is pointless.  That
> said, I *suspect* there will be very little in the way of introspection at
> all -- I suspect that users will simply create their machine description,
> attempt to instantiate, and error out if there are missing classes.

Introspection remains important, but I do now agree that filtering is
pointless - both for introspection and more generally.

  "qemu-system --machine help"

should list *everything* for all targets that are built in to it
without filtering too.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  parent reply	other threads:[~2026-08-27 12:22 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  0:09 [PATCH 00/27] single-binary: implement dynamic filtering for machine types Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 01/27] include/qemu/target-info-qom.h: declare TYPE_TARGET_SPECIFIC interface Pierrick Bouvier
2026-07-24  6:21   ` Philippe Mathieu-Daudé
2026-07-24 16:54     ` Pierrick Bouvier
2026-08-05 14:05   ` Daniel P. Berrangé
2026-08-05 16:16     ` Pierrick Bouvier
2026-08-05 16:53       ` Daniel P. Berrangé
2026-08-05 19:10         ` Pierrick Bouvier
2026-08-06 10:21           ` Daniel P. Berrangé
2026-08-06 14:52             ` Philippe Mathieu-Daudé
2026-08-06 16:38               ` Pierrick Bouvier
2026-08-06 18:15                 ` Daniel P. Berrangé
2026-08-06 21:04                   ` Pierrick Bouvier
2026-08-10 22:26                   ` Pierrick Bouvier
2026-08-12 10:52                     ` Daniel P. Berrangé
2026-08-12 12:54                       ` Pierrick Bouvier
2026-08-12 13:03                         ` Daniel P. Berrangé
2026-08-12 14:09                           ` Pierrick Bouvier
2026-08-12 14:26                             ` Daniel P. Berrangé
2026-08-12 15:52                               ` Pierrick Bouvier
2026-08-21 23:53                                 ` Pierrick Bouvier
2026-08-26 23:07                                   ` Richard Henderson
2026-08-26 23:29                                     ` Pierrick Bouvier
2026-08-26 23:31                                       ` Richard Henderson
2026-08-28 23:07                                         ` Pierrick Bouvier
2026-08-27 12:22                                     ` Daniel P. Berrangé [this message]
2026-08-06 16:52               ` Daniel P. Berrangé
2026-08-06 20:21                 ` Pierrick Bouvier
2026-08-10 15:56                   ` Daniel P. Berrangé
2026-08-10 16:11                     ` Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 02/27] hw/arm: implement TYPE_TARGET_SPECIFIC Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 03/27] target-info: add target_riscv32 and target_base_riscv Pierrick Bouvier
2026-07-24  6:09   ` Philippe Mathieu-Daudé
2026-08-31 14:07   ` Yonggang Luo
2026-08-31 18:18     ` Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 04/27] hw/riscv: implement TYPE_TARGET_SPECIFIC Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 05/27] target-info: add target_config_multiprocess Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 06/27] hw/remote/machine: remove unsupported arm target Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 07/27] hw/remote/machine: implement TYPE_TARGET_SPECIFIC Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 08/27] target-info: add target_config_xen Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 09/27] hw/arm/xen-pvh: implement TYPE_TARGET_SPECIFIC Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 10/27] hw/xenpv/xen_machine_pv: " Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 11/27] target-info: add target_config_nitro Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 12/27] hw/nitro/machine: implement TYPE_TARGET_SPECIFIC Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 13/27] target-info-qom: implement new machine filtering per target Pierrick Bouvier
2026-07-24  6:12   ` Philippe Mathieu-Daudé
2026-07-24  0:09 ` [PATCH 14/27] target-info-qom: use TYPE_MACHINE instead of target_machine_typename Pierrick Bouvier
2026-07-24  6:12   ` Philippe Mathieu-Daudé
2026-07-24  0:09 ` [PATCH 15/27] target-info: remove target_machine_typename Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 16/27] target-info-qom: add type_target_specific Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 17/27] hw/arm: remove TYPE_TARGET_{AARCH64,ARM}_MACHINE Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 18/27] hw/arm: remove {arm, arm_aarch64, aarch64}_machine_interfaces Pierrick Bouvier via qemu development
2026-07-24  0:09 ` [PATCH 19/27] include/hw/core/boards.h: add DEFINE_MACHINE_TARGET_SPECIFIC Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 20/27] hw/arm: remove DEFINE_MACHINE_{AARCH64,ARM} Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 21/27] hw/arm: remove machines-qom.h Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 22/27] hw/riscv: remove TYPE_TARGET_{RISCV32,RISCV64}_MACHINE Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 23/27] hw/riscv: remove {riscv32, riscv32_64, riscv64}_machine_interfaces Pierrick Bouvier via qemu development
2026-07-24  0:09 ` [PATCH 24/27] hw/riscv: remove DEFINE_MACHINE_{RISCV32,RISCV64} Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 25/27] hw/riscv: remove machines-qom.h Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 26/27] configs/targets: remove target info definitions Pierrick Bouvier
2026-07-24  0:09 ` [PATCH 27/27] target-info: rename target-info-stub.c in target-info-def.c Pierrick Bouvier
2026-07-30 17:33 ` [PATCH 00/27] single-binary: implement dynamic filtering for machine types Pierrick Bouvier
2026-08-05 13:30   ` Yonggang Luo
2026-08-05 16:20     ` Pierrick Bouvier
2026-08-06 20:29       ` Daniel Henrique Barboza
2026-08-10 15:46 ` Peter Maydell
2026-08-10 15:55   ` Pierrick Bouvier
2026-08-10 16:00     ` Peter Maydell
2026-08-10 16:14       ` Pierrick Bouvier
2026-08-10 16:42         ` Daniel P. Berrangé
2026-08-28  9:51 ` Yonggang Luo
2026-08-28 17:10   ` Pierrick Bouvier
2026-08-28 17:54     ` Yonggang Luo
2026-08-28 17:59       ` Pierrick Bouvier

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=apAsA2gg58ctdtwL@redhat.com \
    --to=berrange@redhat.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair@alistair23.me \
    --cc=anjo@rev.ng \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=npiggin@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shentey@gmail.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.