On Wed, Jun 19, 2019 at 14:08:58 +0200, Ján Tomko wrote:
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(a)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
Both virQEMUCapsProbeQMPHostCPU and virQEMUCapsCPUFeatureTranslate could
use QEMU_CAPS_CPU_UNAVAILABLE_FEATURES directly, but I felt the alias
will make it clear what's going on in there since "unavailable-features"
property serves just as a witness and we'd likely need to add a comment
about this to every usage which is not doing anything with the new
property.
Jirka