From: Laszlo Ersek <lersek@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Peter Krempa" <pkrempa@redhat.com>,
"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
libvir-list@redhat.com, "Michal Privoznik" <mprivozn@redhat.com>,
qemu-devel@nongnu.org, "Alexander Graf" <agraf@suse.de>,
"Gary Ching-Pang Lin" <glin@suse.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"David Gibson" <dgibson@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [libvirt] [qemu RFC v2] qapi: add "firmware.json"
Date: Fri, 20 Apr 2018 18:04:59 +0200 [thread overview]
Message-ID: <8fc9f287-c0c1-45c1-b46c-64f479b12723@redhat.com> (raw)
In-Reply-To: <87muxyyr82.fsf@dusky.pond.sub.org>
On 04/20/18 14:53, Markus Armbruster wrote:
> Laszlo Ersek <lersek@redhat.com> writes:
[snip]
>> The targets with softmmu are: aarch64, alpha, arm, cris, hppa, i386,
>> lm32, m68k, microblaze, microblazeel, mips, mips64, mips64el, mipsel,
>> moxie, nios2, or1k, ppc, ppc64, ppcemb, riscv32, riscv64, s390x, sh4,
>> sh4eb, sparc, sparc64, tricore, unicore32, x86_64, xtensa, xtensaeb.
>>
>> That is, at least the following constants in CpuInfoArch have no
>> corresponding (identical) mapping -- I'll state to the right of the
>> arrow the emulation targets which I know or presume to be associated
>> with the CpuInfoArch constant:
>> - x86 -> i386, x86_64
>> - sparc -> sparc, sparc64
>> - ppc -> ppc, ppc64, ppcemb
>> - mips -> mips, mips64, mips64el, mipsel
>> - s390 -> s390x
>> - riscv -> riscv32, riscv64
>>
>> The only constant that seems to have a 1:1 mapping is "tricore", but I
>> could perfectly well be thinking even that just because I have no clue
>> about "tricore".
>>
>> So, I don't think CpuInfoArch can be updated so that it both remains
>> compatible with current QMP clients, and serves "firmware.json". In the
>> firmware schema we don't just need CPU architecture, but actual emulator
>> names (and board / machine types).
>
> The completely orthodox fix for CpuInfo would be:
>
> * Keep @arch unchanged. In particular, keep "other" for all targets
> other than 'x86', 'sparc', 'ppc', 'mips', 'tricore'.
>
> * Add a new member @target of new enum type Target, whose values match
> configures idea of targets exactly.
>
> * Make the new member the union tag.
>
> It's too late for complete orthodoxy; we already changed @arch.
>
> A common enum type Target makes sense anyway, I think.
>
> Using it in CpuInfo as described above may make sense, too. Could be
> left to a follow-up patch.
>
>> I grepped 'qapi/*json' for the whole word "x86_64", and the only thing
>> that remotely matches is the @TargetInfo structure, in which the @arch
>> field is a string, coming with the example "x86_64". The example also
>> names "i386" separately.
>
> Well spotted.
>
> TargetInfo member @arch is set to TARGET_NAME, which matches configure's
> idea of the target. If we add enum Target, we should change @arch's
> type from str to Target.
>
>> So what might make sense is to introduce a separate enum in
>> "qapi/misc.json" with all the softmmu targets I listed above, and change
>> the type of @TargetInfo.@arch to that enum.
>
> I arrived at this conclusion, too.
>
>> In parallel,
>> qmp_query_target() would have to be updated to look up the enum value
>> matching TARGET_NAME. (I do think we can ignore linux-user etc emulators
>> for collecting the relevant arches here: @TargetInfo is only used in the
>> "query-target" QMP command, and Markus said above that QMP is only used
>> with system emulation.)
>>
>> Should I do this?
>
> Yes, please.
OK, so here's my understanding:
(1) I'll introduce a new @Target enum in misc.json. I'll inherit /
include it in firmware.json. This is compatible with what Dan said.
(2) I'll change @TargetInfo.@arch to the new type. I believe this will
break the compilation of qmp_query_target(); I'll hack on that until it
builds again, with the lookup. :)
(3) Regarding the addition of @target to CpuInfo (accompanying @arch)
doesn't look hard; what *does* look hard is changing the union
discriminator from @arch to @target. @target has many more values, and I
would have to map all of them to the (fewer) @arch values that currently
do *not* select @CpuInfoOther. Here's an example:
- Both @i386 and @x86_64 from @target mean @x86 in @arch,
- because @x86 currently selects @CpuInfoX86, not @CpuInfoOther,
both @i386 and @x86_64 must be assigned @CpuInfoX86.
This depends on the knowledge that "x86" actually *means* "i386 plus
x86_64", and I totally don't have that knowledge for the rest of the
arches / targets.
So, the modification of @CpuInfo I would indeed like to pass off to
someone else. (Well, if all the architecture maintainers follow up and
tell me what emulators exactly fall under the umbrella of each
individual @arch value, I can post the patch.) BTW... I wonder how
compatibility would be affected if we just added @target to @CpuInfo,
even without making it the new discriminator.
... Anyway, I think I've gotten a huge amount of useful and actionable
feedback; thanks everyone, let me work on RFCv3 and post it soon. :)
Thanks!
Laszlo
next prev parent reply other threads:[~2018-04-20 16:05 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 22:40 [Qemu-devel] [qemu RFC v2] qapi: add "firmware.json" Laszlo Ersek
2018-04-18 6:02 ` Gerd Hoffmann
2018-04-18 8:32 ` Laszlo Ersek
2018-04-18 9:04 ` Gerd Hoffmann
2018-04-18 11:48 ` Laszlo Ersek
2018-04-18 11:57 ` Daniel P. Berrangé
2018-04-18 12:30 ` Gerd Hoffmann
2018-04-18 12:32 ` Daniel P. Berrangé
2018-04-18 12:57 ` Laszlo Ersek
2018-04-18 12:23 ` Gerd Hoffmann
2018-04-18 12:56 ` Laszlo Ersek
2018-04-18 13:06 ` Gerd Hoffmann
2018-04-18 13:30 ` Laszlo Ersek
2018-04-18 13:53 ` Daniel P. Berrangé
2018-04-18 14:03 ` Laszlo Ersek
2018-04-18 14:06 ` Daniel P. Berrangé
2018-04-18 14:45 ` Laszlo Ersek
2018-04-19 0:09 ` David Gibson
2018-04-19 8:09 ` Laszlo Ersek
2018-04-20 1:03 ` David Gibson
2018-04-20 8:47 ` Paolo Bonzini
2018-04-20 9:01 ` Laszlo Ersek
2018-04-19 8:45 ` Thomas Huth
2018-04-18 8:47 ` Markus Armbruster
2018-04-18 11:35 ` Laszlo Ersek
2018-04-19 7:48 ` Markus Armbruster
2018-04-19 7:56 ` [Qemu-devel] [libvirt] " Daniel P. Berrangé
2018-04-19 8:39 ` Laszlo Ersek
2018-04-19 9:12 ` Daniel P. Berrangé
2018-04-20 8:11 ` Laszlo Ersek
2018-04-20 9:34 ` Daniel P. Berrangé
2018-04-20 9:46 ` Gerd Hoffmann
2018-04-20 9:50 ` Daniel P. Berrangé
2018-04-20 10:41 ` Gerd Hoffmann
2018-04-20 15:45 ` Laszlo Ersek
2018-04-20 15:39 ` Laszlo Ersek
2018-04-23 0:10 ` David Gibson
2018-04-23 9:39 ` Daniel P. Berrangé
2018-04-20 12:53 ` Markus Armbruster
2018-04-20 16:04 ` Laszlo Ersek [this message]
2018-04-20 16:37 ` Markus Armbruster
2018-04-20 23:25 ` Laszlo Ersek
2018-04-18 9:43 ` [Qemu-devel] " Paolo Bonzini
2018-04-18 11:52 ` Laszlo Ersek
2018-04-18 12:03 ` Daniel P. Berrangé
2018-04-18 12:36 ` Gerd Hoffmann
2018-04-18 12:40 ` Laszlo Ersek
2018-04-18 15:17 ` Eric Blake
2018-04-18 15:27 ` Laszlo Ersek
2018-04-18 15:28 ` Daniel P. Berrangé
2018-04-18 15:30 ` Laszlo Ersek
2018-04-19 8:57 ` Thomas Huth
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=8fc9f287-c0c1-45c1-b46c-64f479b12723@redhat.com \
--to=lersek@redhat.com \
--cc=agraf@suse.de \
--cc=ard.biesheuvel@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgibson@redhat.com \
--cc=glin@suse.com \
--cc=kraxel@redhat.com \
--cc=libvir-list@redhat.com \
--cc=mprivozn@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pkrempa@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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).