]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Make qemuMonitorGetGuestCPU usable on x86 only
authorJiri Denemark <jdenemar@redhat.com>
Mon, 17 Jun 2019 14:56:32 +0000 (16:56 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 19 Jun 2019 22:22:39 +0000 (00:22 +0200)
It was never implemented or used for anything else anyway. Mainly
because it uses CPUID features bits. The function is renamed as
qemuMonitorGetGuestCPUx86 to make this explicit.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
src/qemu/qemu_process.c
tests/qemumonitorjsontest.c

index d9d076633d27ad658d86de1317050310f99bdb59..344aac09f02e5c36410a995702f8d8cb0ee77080 100644 (file)
@@ -4080,9 +4080,8 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon,
 
 
 /**
- * qemuMonitorJSONGetGuestCPU:
+ * qemuMonitorJSONGetGuestCPUx86:
  * @mon: Pointer to the monitor
- * @arch: arch of the guest
  * @data: returns the cpu data
  * @disabled: returns the CPU data for features which were disabled by QEMU
  *
@@ -4092,13 +4091,11 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon,
  * -1 on other errors.
  */
 int
-qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
-                       virArch arch,
-                       virCPUDataPtr *data,
-                       virCPUDataPtr *disabled)
+qemuMonitorGetGuestCPUx86(qemuMonitorPtr mon,
+                          virCPUDataPtr *data,
+                          virCPUDataPtr *disabled)
 {
-    VIR_DEBUG("arch=%s data=%p disabled=%p",
-              virArchToString(arch), data, disabled);
+    VIR_DEBUG("data=%p disabled=%p", data, disabled);
 
     QEMU_CHECK_MONITOR(mon);
 
@@ -4106,7 +4103,7 @@ qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
     if (disabled)
         *disabled = NULL;
 
-    return qemuMonitorJSONGetGuestCPU(mon, arch, data, disabled);
+    return qemuMonitorJSONGetGuestCPUx86(mon, data, disabled);
 }
 
 
index 8def4c7311182ecd2e14026281d2b990283bd30b..f166f5f949464422e9a47d1e6fbfe2af246e561d 100644 (file)
@@ -1149,10 +1149,9 @@ void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
                              void *opaque,
                              virFreeCallback destroy);
 
-int qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
-                           virArch arch,
-                           virCPUDataPtr *data,
-                           virCPUDataPtr *disabled);
+int qemuMonitorGetGuestCPUx86(qemuMonitorPtr mon,
+                              virCPUDataPtr *data,
+                              virCPUDataPtr *disabled);
 
 int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);
 
index 2dcd65d86f48d83c02d1ba17652ce3c1abdfd891..ffa1fb5d57ee339b247ff88d6da976fcc79d7918 100644 (file)
@@ -7319,9 +7319,8 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon)
 
 
 /**
- * qemuMonitorJSONGetGuestCPU:
+ * qemuMonitorJSONGetGuestCPUx86:
  * @mon: Pointer to the monitor
- * @arch: arch of the guest
  * @data: returns the cpu data of the guest
  * @disabled: returns the CPU data for features which were disabled by QEMU
  *
@@ -7331,40 +7330,32 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon)
  * -1 on other errors.
  */
 int
-qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
-                           virArch arch,
-                           virCPUDataPtr *data,
-                           virCPUDataPtr *disabled)
+qemuMonitorJSONGetGuestCPUx86(qemuMonitorPtr mon,
+                              virCPUDataPtr *data,
+                              virCPUDataPtr *disabled)
 {
     virCPUDataPtr cpuEnabled = NULL;
     virCPUDataPtr cpuDisabled = NULL;
     int rc;
 
-    if (ARCH_IS_X86(arch)) {
-        if ((rc = qemuMonitorJSONCheckCPUx86(mon)) < 0)
-            return -1;
-        else if (!rc)
-            return -2;
-
-        if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words",
-                                         &cpuEnabled) < 0)
-            goto error;
+    if ((rc = qemuMonitorJSONCheckCPUx86(mon)) < 0)
+        return -1;
+    else if (!rc)
+        return -2;
 
-        if (disabled &&
-            qemuMonitorJSONGetCPUx86Data(mon, "filtered-features",
-                                         &cpuDisabled) < 0)
-            goto error;
+    if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words",
+                                     &cpuEnabled) < 0)
+        goto error;
 
-        *data = cpuEnabled;
-        if (disabled)
-            *disabled = cpuDisabled;
-        return 0;
-    }
+    if (disabled &&
+        qemuMonitorJSONGetCPUx86Data(mon, "filtered-features",
+                                     &cpuDisabled) < 0)
+        goto error;
 
-    virReportError(VIR_ERR_INTERNAL_ERROR,
-                   _("CPU definition retrieval isn't supported for '%s'"),
-                   virArchToString(arch));
-    return -1;
+    *data = cpuEnabled;
+    if (disabled)
+        *disabled = cpuDisabled;
+    return 0;
 
  error:
     virCPUDataFree(cpuEnabled);
index 78fe97ab18c6098dc15935869c6d29b968d9aaed..1bc1df0e3bcc6e658b3c9dd83fc660e09a19542b 100644 (file)
@@ -488,10 +488,9 @@ int qemuMonitorJSONGetCPUx86Data(qemuMonitorPtr mon,
                                  const char *property,
                                  virCPUDataPtr *cpudata);
 
-int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
-                               virArch arch,
-                               virCPUDataPtr *data,
-                               virCPUDataPtr *disabled);
+int qemuMonitorJSONGetGuestCPUx86(qemuMonitorPtr mon,
+                                  virCPUDataPtr *data,
+                                  virCPUDataPtr *disabled);
 
 int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon);
 
index 47e84e5ef093c42cc5bf8b15438c64af875ba6f7..db940b02a8f82b610c6bd52565440adecb138130 100644 (file)
@@ -4149,8 +4149,7 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver,
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         goto error;
 
-    rc = qemuMonitorGetGuestCPU(priv->mon, vm->def->os.arch,
-                                &dataEnabled, &dataDisabled);
+    rc = qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisabled);
 
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         goto error;
index e087d1c256b3a1821c55c5b9d92e7a2ffdc7c22b..2ed9133c06dc664b28e9f01994d01ae6a7a764b6 100644 (file)
@@ -2487,9 +2487,8 @@ testQemuMonitorJSONGetCPUData(const void *opaque)
     if (qemuMonitorTestAddItem(test, "qom-get", jsonStr) < 0)
         goto cleanup;
 
-    if (qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test),
-                                   VIR_ARCH_X86_64,
-                                   &cpuData, NULL) < 0)
+    if (qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test),
+                                      &cpuData, NULL) < 0)
         goto cleanup;
 
     if (!(actual = virCPUDataFormat(cpuData)))
@@ -2530,9 +2529,8 @@ testQemuMonitorJSONGetNonExistingCPUData(const void *opaque)
                                "}") < 0)
         goto cleanup;
 
-    rv = qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test),
-                                   VIR_ARCH_X86_64,
-                                   &cpuData, NULL);
+    rv = qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test),
+                                       &cpuData, NULL);
     if (rv != -2) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "Unexpected return value %d, expecting -2", rv);