On Thu, Nov 12, 2026 at 11:08:02PM +0800, Yonggang Luo wrote:
> On Thu, Nov 12, 2026 at 9:31 PM Daniel P. Berrangé <[email protected]> 
> wrote:
> >
> > When building a multi-target binary, QOM types from multiple targets
> > will be linked together. QOM types are required to have unique names
> > when registered, so linking multiple targets in turn requires QOM type
> > names to be unique across the QEMU codebase.
> >
> > Global QOM type name uniqueness is a desirable property for QEMU
> > regardless of multi-target work, so that QEMU presents a non-ambiguous
> > object model to applications regardless of context.
> >
> > In a multi-target binary, it is desirable to applications are able to
> > introspect all types linked into QEMU, when launching with '-machine
> > none'. Dynamic filtering of registered classes at runtime, to resolving
> > QOM naming conflicts is undesirable, as it requires introspection
> > to be repeated for each available target in order to discover the full
> > set of available types in a binary.
> >
> > Introspection is a fairly heavy weight process due to QEMU's vast size,
> > so enabling introspection to be done once only for all targets will be a
> > very significant benefit for management applications with a multi-target
> > binary.
> >
> > The glaring problem is that our historical design has led to multiple
> > targets all providing a 'virt' machine type, which leads to multiple QOM
> > types call 'virt-machine' which are all different.
> >
> > Having a common short name "virt" is a useful characteristic for users,
> > but this does not imply we need to use that as the basis for primary QOM
> > typename. It is sufficient to have an alias called 'virt'.
> >
> > In terms of implementation there are two core pieces
> >
> >  * An 'Aliased' interface which can be implemented by QOM types which
> >    want to support type aliases.
> >
> >  * A 'TargetSpecific' interface which can be implemented by QOM types
> >    which want to declare  they can only be used with a subset of targets.
> >
> > With those foundational pieces
> >
> >  * Machine implements Aliased and TargetSpecific
> >
> >  * query-machines reports multiple aliases and declared supported
> >    targets per machine for introspection
> >
> >  * All the 'virt' machines are renamed to $target-virt, and aliases
> >    added for the shorter 'virt' names to retain compatibility and
> >    convenience when a target is selected
> >
> >  * All the machines which have 'is_available' set now report their
> >    targets via the TargetSpecific  interface
> >
> >  * Creating machines validates declared targets from TargetSpecific
> >
> > An apparent design mistake in TYPE_ACCEL_CPU is resolved which allows
> 
> Target independent TYPE_ACCEL_CPU  is my first choice, if the QOM name is
> do not have to be kept, I think this is better.

TYPE_ACCEL_CPU is a name of an internal abstract class, so we
are free to change that.  IIUC, in this particular case even
the sub-classes are internal only.

Only the leaf-node classes which are used with public QMP or
command line args are formal public ABI.

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 :|


Reply via email to