qemu: Make qemuMonitorGetGuestCPU usable on x86 only

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>
This commit is contained in:
Jiri Denemark 2019-06-17 16:56:32 +02:00
parent a3f2c802d2
commit 055f8f6bb9
6 changed files with 36 additions and 53 deletions

View File

@ -4080,9 +4080,8 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon,
/** /**
* qemuMonitorJSONGetGuestCPU: * qemuMonitorJSONGetGuestCPUx86:
* @mon: Pointer to the monitor * @mon: Pointer to the monitor
* @arch: arch of the guest
* @data: returns the cpu data * @data: returns the cpu data
* @disabled: returns the CPU data for features which were disabled by QEMU * @disabled: returns the CPU data for features which were disabled by QEMU
* *
@ -4092,13 +4091,11 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon,
* -1 on other errors. * -1 on other errors.
*/ */
int int
qemuMonitorGetGuestCPU(qemuMonitorPtr mon, qemuMonitorGetGuestCPUx86(qemuMonitorPtr mon,
virArch arch, virCPUDataPtr *data,
virCPUDataPtr *data, virCPUDataPtr *disabled)
virCPUDataPtr *disabled)
{ {
VIR_DEBUG("arch=%s data=%p disabled=%p", VIR_DEBUG("data=%p disabled=%p", data, disabled);
virArchToString(arch), data, disabled);
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
@ -4106,7 +4103,7 @@ qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
if (disabled) if (disabled)
*disabled = NULL; *disabled = NULL;
return qemuMonitorJSONGetGuestCPU(mon, arch, data, disabled); return qemuMonitorJSONGetGuestCPUx86(mon, data, disabled);
} }

View File

@ -1149,10 +1149,9 @@ void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
void *opaque, void *opaque,
virFreeCallback destroy); virFreeCallback destroy);
int qemuMonitorGetGuestCPU(qemuMonitorPtr mon, int qemuMonitorGetGuestCPUx86(qemuMonitorPtr mon,
virArch arch, virCPUDataPtr *data,
virCPUDataPtr *data, virCPUDataPtr *disabled);
virCPUDataPtr *disabled);
int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon); int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);

View File

@ -7319,9 +7319,8 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon)
/** /**
* qemuMonitorJSONGetGuestCPU: * qemuMonitorJSONGetGuestCPUx86:
* @mon: Pointer to the monitor * @mon: Pointer to the monitor
* @arch: arch of the guest
* @data: returns the cpu data of the guest * @data: returns the cpu data of the guest
* @disabled: returns the CPU data for features which were disabled by QEMU * @disabled: returns the CPU data for features which were disabled by QEMU
* *
@ -7331,40 +7330,32 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon)
* -1 on other errors. * -1 on other errors.
*/ */
int int
qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon, qemuMonitorJSONGetGuestCPUx86(qemuMonitorPtr mon,
virArch arch, virCPUDataPtr *data,
virCPUDataPtr *data, virCPUDataPtr *disabled)
virCPUDataPtr *disabled)
{ {
virCPUDataPtr cpuEnabled = NULL; virCPUDataPtr cpuEnabled = NULL;
virCPUDataPtr cpuDisabled = NULL; virCPUDataPtr cpuDisabled = NULL;
int rc; int rc;
if (ARCH_IS_X86(arch)) { if ((rc = qemuMonitorJSONCheckCPUx86(mon)) < 0)
if ((rc = qemuMonitorJSONCheckCPUx86(mon)) < 0) return -1;
return -1; else if (!rc)
else if (!rc) return -2;
return -2;
if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words", if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words",
&cpuEnabled) < 0) &cpuEnabled) < 0)
goto error; goto error;
if (disabled && if (disabled &&
qemuMonitorJSONGetCPUx86Data(mon, "filtered-features", qemuMonitorJSONGetCPUx86Data(mon, "filtered-features",
&cpuDisabled) < 0) &cpuDisabled) < 0)
goto error; goto error;
*data = cpuEnabled; *data = cpuEnabled;
if (disabled) if (disabled)
*disabled = cpuDisabled; *disabled = cpuDisabled;
return 0; return 0;
}
virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU definition retrieval isn't supported for '%s'"),
virArchToString(arch));
return -1;
error: error:
virCPUDataFree(cpuEnabled); virCPUDataFree(cpuEnabled);

View File

@ -488,10 +488,9 @@ int qemuMonitorJSONGetCPUx86Data(qemuMonitorPtr mon,
const char *property, const char *property,
virCPUDataPtr *cpudata); virCPUDataPtr *cpudata);
int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon, int qemuMonitorJSONGetGuestCPUx86(qemuMonitorPtr mon,
virArch arch, virCPUDataPtr *data,
virCPUDataPtr *data, virCPUDataPtr *disabled);
virCPUDataPtr *disabled);
int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon); int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon);

View File

@ -4149,8 +4149,7 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto error; goto error;
rc = qemuMonitorGetGuestCPU(priv->mon, vm->def->os.arch, rc = qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisabled);
&dataEnabled, &dataDisabled);
if (qemuDomainObjExitMonitor(driver, vm) < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto error; goto error;

View File

@ -2487,9 +2487,8 @@ testQemuMonitorJSONGetCPUData(const void *opaque)
if (qemuMonitorTestAddItem(test, "qom-get", jsonStr) < 0) if (qemuMonitorTestAddItem(test, "qom-get", jsonStr) < 0)
goto cleanup; goto cleanup;
if (qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test), if (qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test),
VIR_ARCH_X86_64, &cpuData, NULL) < 0)
&cpuData, NULL) < 0)
goto cleanup; goto cleanup;
if (!(actual = virCPUDataFormat(cpuData))) if (!(actual = virCPUDataFormat(cpuData)))
@ -2530,9 +2529,8 @@ testQemuMonitorJSONGetNonExistingCPUData(const void *opaque)
"}") < 0) "}") < 0)
goto cleanup; goto cleanup;
rv = qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test), rv = qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test),
VIR_ARCH_X86_64, &cpuData, NULL);
&cpuData, NULL);
if (rv != -2) { if (rv != -2) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected return value %d, expecting -2", rv); "Unexpected return value %d, expecting -2", rv);