From d2ef598bb59e613ce4a8b969ab9836604bd72727 Mon Sep 17 00:00:00 2001
Message-Id: <d2ef598bb59e613ce4a8b969ab9836604bd72727@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 21 Jun 2019 09:25:54 +0200
Subject: [PATCH] qemu: Probe host CPU after capabilities
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The way we call query-cpu-model-expansion will rely on some capabilities
bits. Let's make sure all capabilities are set before probing host CPU.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 6f6401fbae384c66ce6043ced30591050729a4ac)
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
Conflicts:
src/qemu/qemu_capabilities.c
- various refactors were not backported
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
- QMP message IDs are different
tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies
- missing
tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
- QMP message IDs are different
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <cea249ba54be2d9dca6f523a14b0af608163323f.1561068591.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_capabilities.c | 8 +++-
.../caps_2.12.0.x86_64.replies | 44 +++++++++----------
.../caps_3.0.0.x86_64.replies | 40 ++++++++---------
.../caps_4.1.0.x86_64.replies | 40 ++++++++---------
4 files changed, 68 insertions(+), 64 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index beec9d1497..fb260eae96 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4343,8 +4343,6 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_QMP_SCHEMA) &&
virQEMUCapsProbeQMPSchemaCapabilities(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon, false) < 0)
- goto cleanup;
/* 'intel-iommu' shows up as a device since 2.2.0, but can
* not be used with -device until 2.7.0. Before that it
@@ -4394,6 +4392,12 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST);
}
+ /* The following probes rely on other previously probed capabilities.
+ * No capabilities bits should be set below this point. */
+
+ if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon, false) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
return ret;
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
index 66a5577e5e..ecfe3386c4 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
@@ -19521,6 +19521,21 @@
"id": "libvirt-50"
}
+{
+ "execute": "query-sev-capabilities",
+ "id": "libvirt-51"
+}
+
+{
+ "return": {
+ "reduced-phys-bits": 1,
+ "cbitpos": 47,
+ "cert-chain": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA",
+ "pdh": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA"
+ },
+ "id": "libvirt-51"
+}
+
{
"execute": "query-cpu-model-expansion",
"arguments": {
@@ -19529,7 +19544,7 @@
"name": "host"
}
},
- "id": "libvirt-51"
+ "id": "libvirt-52"
}
{
@@ -19719,7 +19734,7 @@
}
}
},
- "id": "libvirt-51"
+ "id": "libvirt-52"
}
{
@@ -19911,7 +19926,7 @@
}
}
},
- "id": "libvirt-52"
+ "id": "libvirt-53"
}
{
@@ -20166,7 +20181,7 @@
}
}
},
- "id": "libvirt-52"
+ "id": "libvirt-53"
}
{
@@ -20180,7 +20195,7 @@
}
}
},
- "id": "libvirt-53"
+ "id": "libvirt-54"
}
{
@@ -20370,7 +20385,7 @@
}
}
},
- "id": "libvirt-53"
+ "id": "libvirt-54"
}
{
@@ -20562,7 +20577,7 @@
}
}
},
- "id": "libvirt-54"
+ "id": "libvirt-55"
}
{
@@ -20817,21 +20832,6 @@
}
}
},
- "id": "libvirt-54"
-}
-
-{
- "execute": "query-sev-capabilities",
- "id": "libvirt-55"
-}
-
-{
- "return": {
- "reduced-phys-bits": 1,
- "cbitpos": 47,
- "cert-chain": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA",
- "pdh": "AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA"
- },
"id": "libvirt-55"
}
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
index 9f44eb4fae..7fea8587fd 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
@@ -20490,6 +20490,19 @@
"id": "libvirt-50"
}
+{
+ "execute": "query-sev-capabilities",
+ "id": "libvirt-51"
+}
+
+{
+ "id": "libvirt-51",
+ "error": {
+ "class": "GenericError",
+ "desc": "SEV feature is not available"
+ }
+}
+
{
"execute": "query-cpu-model-expansion",
"arguments": {
@@ -20498,7 +20511,7 @@
"name": "host"
}
},
- "id": "libvirt-51"
+ "id": "libvirt-52"
}
{
@@ -20691,7 +20704,7 @@
}
}
},
- "id": "libvirt-51"
+ "id": "libvirt-52"
}
{
@@ -20886,7 +20899,7 @@
}
}
},
- "id": "libvirt-52"
+ "id": "libvirt-53"
}
{
@@ -21148,7 +21161,7 @@
}
}
},
- "id": "libvirt-52"
+ "id": "libvirt-53"
}
{
@@ -21162,7 +21175,7 @@
}
}
},
- "id": "libvirt-53"
+ "id": "libvirt-54"
}
{
@@ -21355,7 +21368,7 @@
}
}
},
- "id": "libvirt-53"
+ "id": "libvirt-54"
}
{
@@ -21550,7 +21563,7 @@
}
}
},
- "id": "libvirt-54"
+ "id": "libvirt-55"
}
{
@@ -21812,22 +21825,9 @@
}
}
},
- "id": "libvirt-54"
-}
-
-{
- "execute": "query-sev-capabilities",
"id": "libvirt-55"
}
-{
- "id": "libvirt-55",
- "error": {
- "class": "GenericError",
- "desc": "SEV feature is not available"
- }
-}
-
{
"execute": "qmp_capabilities",
"id": "libvirt-1"
diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
index 82b320b1d0..5b4d7a8484 100644
--- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.replies
@@ -21315,6 +21315,19 @@
"id": "libvirt-50"
}
+{
+ "execute": "query-sev-capabilities",
+ "id": "libvirt-51"
+}
+
+{
+ "id": "libvirt-51",
+ "error": {
+ "class": "GenericError",
+ "desc": "SEV feature is not available"
+ }
+}
+
{
"execute": "query-cpu-model-expansion",
"arguments": {
@@ -21323,7 +21336,7 @@
"name": "host"
}
},
- "id": "libvirt-51"
+ "id": "libvirt-52"
}
{
@@ -21529,7 +21542,7 @@
}
}
},
- "id": "libvirt-51"
+ "id": "libvirt-52"
}
{
@@ -21737,7 +21750,7 @@
}
}
},
- "id": "libvirt-52"
+ "id": "libvirt-53"
}
{
@@ -22018,7 +22031,7 @@
}
}
},
- "id": "libvirt-52"
+ "id": "libvirt-53"
}
{
@@ -22032,7 +22045,7 @@
}
}
},
- "id": "libvirt-53"
+ "id": "libvirt-54"
}
{
@@ -22238,7 +22251,7 @@
}
}
},
- "id": "libvirt-53"
+ "id": "libvirt-54"
}
{
@@ -22446,7 +22459,7 @@
}
}
},
- "id": "libvirt-54"
+ "id": "libvirt-55"
}
{
@@ -22727,22 +22740,9 @@
}
}
},
- "id": "libvirt-54"
-}
-
-{
- "execute": "query-sev-capabilities",
"id": "libvirt-55"
}
-{
- "id": "libvirt-55",
- "error": {
- "class": "GenericError",
- "desc": "SEV feature is not available"
- }
-}
-
{
"execute": "qmp_capabilities",
"id": "libvirt-1"
--
2.22.0