On 04/10/18 11:34, Daniel P. Berrangé wrote:
On Tue, Apr 10, 2018 at 11:16:01AM +0200, Laszlo Ersek wrote:
> On 04/10/18 08:27, Gerd Hoffmann wrote:
>> Hi,
>>
>>> - I considered adding wildcards (say, blacklist "all" i440fx
machtypes,
>>> present and future, for SMM-requiring OVMF builds), but then you get
>>> into version sorting and similar mess. I considered fnmatch() --
>>> basically simple ? and * wildcards -- but that's not expressive enough.
>>
>> I'd suggest whitelist with wildcards. So the smm builds would get
>> "pc-q35-*".
>>
>> libvirt knows about aliases, so it should be able to handle the "q35"
>> shortcut like "pc-q35-${latest}".
>>
>> Or do you see another issue?
>
> Well, one issue I see is version sorting; I should say "Q35 but no
> earlier than 2.4", and lexicographically, "2.11" sorts before
"2.4".
>
> Anyway (also asking for Thomas's input here): if we run with your idea
> to refer to exact mapping methods / firmware *implementation* types that
> we know libvirt implements / supports as a "white box", do we still deem
> machine type identification necessary? Because, libvirt already knows
> (for example) that "ovmf_smm" requires pc-q35-2.4 or later. So we just
> have to make a *reference* to that knowledge in the JSON file.
BTW, that's not quite correct - when libvirt handles the "smm" arg it
checks if machine type == q35, and QEMU version >= 2.4.
It is *not* checking the version of the machine type. ie it will happily
use smm with pc-q35-2.0, as long as QEMU version is 2.4. Perhaps this is
not quite right,
(it's not)
but we don't try to parse the version number out of the
machine type, because we can't assume a specific format for the machine
type version part. eg version can be "2.4", or it can be
"rhel-7.0.0"
or something else again on Ubuntu.
Indeed, that's exactly why I'm troubled about expressing a "minimum"
machine type version.
IMHO it would be valid to just keep life simple and only record the base
machine type name that can use the firmware ie "pc", "q35", and
ignore
the fact that in some cases the firmware might require a specific version
of the machine type.
Esp. with regard to SMM, there have been quite big jumps in usability /
stability across Q35 machtype versions. But, if it works for you, it
works for me.
(I double-checked Thomas's recent example about U-Boot, and he mentioned
the "ppce500" and "sam460ex" machine types, not machine type
versions.)
Thanks,
Laszlo