On Thu, Mar 06, 2025 at 02:45:52PM +0100, BALATON Zoltan wrote:
> On Thu, 6 Mar 2025, Daniel P. Berrangé wrote:
> > On Thu, Mar 06, 2025 at 12:34:13PM +0100, Paolo Bonzini wrote:
> > > Il gio 6 mar 2025, 10:27 Philippe Mathieu-Daudé <phi...@linaro.org> ha
> > > scritto:
> > > 
> > > > This API is to allow refactoring code for heterogeneous emulation,
> > > > without changing user-facing behavior of current qemu-system binaries,
> > > > which I now consider as 'legacy'.
> > > > 
> > > > Once all current restrictions removed, the new qemu-system-heterogeneous
> > > > binary is expected to run any combination of targets.
> > > > 
> > > > qemu-system-$target will be a call to qemu-system-heterogeneous with
> > > > a restricted subset, possibly in the form of:
> > > > 
> > > >   $ qemu-system-heterogeneous --target aarch64-softmmu
> > > > 
> > > 
> > > Or just qemu-system I guess.
> > > 
> > >     ^ equivalent of today's qemu-system-aarch64
> > > > 
> > > > If you don't like 'qemu_legacy_binary_' prefix, I can use
> > > > 'qemu_single_binary_' instead.
> > > > 
> > > 
> > > Still there is a problem with renaming binaries (both the "qemu-kvm" case
> > > and the good/bad case that Richard pointed out).
> > 
> > We could special case the '-kvm' suffix, because by its nature it
> > implies the current binary build target.
> > 
> > > 
> > > I think you should try creating two versions of system/arch_init.c, so 
> > > that
> > > it has a separate implementation for heterogeneous vs. single-target
> > > binaries. Then you can keep separate linking steps for single-target
> > > binaries and you naturally get the right target info from either the
> > > target-specific arch_init-single.c, or the --target option for
> > > arch_init-multi.c.
> > > 
> > > (Is --target even necessary? As long as you have a way disambiguate
> > > same-named machines like -M virt, and have no default machine in the
> > > multi-target binary, you shouldn't need it).
> > 
> > If we did 'query-machines' on qemu-system-heterogeneous, it would
> > return all machines from all targets. To disambiguate naming there
> > are various options
> > 
> >  * The query-machines command would have to gain a new 'target'
> >    field and we would have to document that uniqness is across
> >    the tuple (name, target), not merely name. That's a semantic
> >    change.
> > 
> >    We would still need a way to express the 'target' when asking
> >    to instantiate a machine
> > 
> >  * The query-machines command would have to gain a new 'target'
> >    paramter so callers can restrict the data they receive back
> > 
> >    We would still need a way to express the 'target' when asking
> >    to instantiate a machine
> > 
> >  * Rename all machine types so they are '<target>-<machine>'
> >    The query-machines command doesn't change. Apps would have
> >    to "parse" the machine name to see what 'target' each is
> >    associated with, or we include an explicit 'target' field
> >    in the returned data. Instianting a machine would not need
> >    changing
> 
> I think -machine m68k:virt could work, -M help would list machines like:
> 
> arm:raspi
> i386:pc
> etc.
> 
> Management apps could easily find : to separate arch but those that don't
> care about arch would just work and list more possible machines. Some
> machines like pc or mac99 that may appear differently in different single
> arch binary might need to get resolved first. Maybe need a way to search
> machine list by pattern e.g. as -machine x86_64:help.

...except that custom structures/formats in command line args is
something we've tried very hard to eliminate in Qemu, and instead
model everything as a distinct fields, using QAPI, so...

.. if you're meaning "arm:raspi" as a short hand for "target:machine"
   that would be a design anti-pattern, b

...if you're meaning that "arm:raspi" is the full machine name, to be
   strictly treated as an opaque string that would be acceptable.

I rather think the latter would not end up being treated as an opaque
string though - the tempetation to parse it & assign semantics to the
pieces is just too great. So I'm not a fan of that approach.

>From a QAPI design best pratice POV, the requirement would be for

 -machine target=arm,name=raspi


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to