[libvirt] [PATCH 15/24] qemu_command: Use canonical names of CPU features

Ján Tomko jtomko at redhat.com
Wed Jun 19 12:08:58 UTC 2019


On Wed, Jun 19, 2019 at 11:38:12AM +0200, Jiri Denemark wrote:
>When building QEMU command line, we should use the preferred spelling of
>each CPU feature without relying on compatibility aliases (which may be
>removed at some point).
>
>The "unavailable-features" CPU property is used as a witness for the
>correct names of the features in our translation table.
>
>Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
>---
> src/qemu/qemu_capabilities.c                              | 8 +++++++-
> src/qemu/qemu_capabilities.h                              | 1 +
> src/qemu/qemu_command.c                                   | 2 ++
> tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml          | 1 +
> tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args | 6 +++---
> tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args    | 2 +-
> tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args     | 2 +-
> .../kvmclock+eoi-disabled.x86_64-latest.args              | 2 +-
> .../pv-spinlock-disabled.x86_64-latest.args               | 2 +-
> .../pv-spinlock-enabled.x86_64-latest.args                | 2 +-
> 10 files changed, 19 insertions(+), 9 deletions(-)
>
>diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>index 3af6923e6f..c742838383 100644
>--- a/src/qemu/qemu_capabilities.c
>+++ b/src/qemu/qemu_capabilities.c
>@@ -532,6 +532,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
>               "nbd-bitmap",
>               "x86-max-cpu",
>               "cpu-unavailable-features",
>+              "canonical-cpu-features",
>     );
>
>
>@@ -2892,7 +2893,9 @@ virQEMUCapsCPUFeatureTranslate(virQEMUCapsPtr qemuCaps,
>     if (ARCH_IS_X86(qemuCaps->arch))
>         table = virQEMUCapsCPUFeaturesX86;
>
>-    if (!table || !feature)
>+    if (!table ||
>+        !feature ||
>+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
>         return feature;
>
>     for (entry = table; entry->libvirt; entry++) {
>@@ -4398,6 +4401,9 @@ virQEMUCapsInitProcessCaps(virQEMUCapsPtr qemuCaps)
>      * we are able to pass the custom 'device_id' for SCSI disks and cdroms. */
>     if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_DEVICE_ID))
>         virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV);
>+
>+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES))
>+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES);
> }

Do we need an alias for the QEMU_CAPS_CPU_UNAVAILABLE_FEATURES
capability?

I think virQEMUCapsCPUFeatureTranslate can use QEMU_CAPS_CPU_UNAVAILABLE_FEATURES directly

>
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190619/6e96d6b3/attachment-0001.sig>


More information about the libvir-list mailing list