提交 77c9c4f1 编写于 作者: J Jiri Denemark

qemu: Ask QEMU for filtered CPU features

qemuMonitorGetGuestCPU can now optionally create CPU data from
filtered-features in addition to feature-words.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 253db85e
......@@ -4026,6 +4026,7 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon,
* @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
*
* Retrieve the definition of the guest CPU from a running qemu instance.
*
......@@ -4035,15 +4036,19 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon,
int
qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
virArch arch,
virCPUDataPtr *data)
virCPUDataPtr *data,
virCPUDataPtr *disabled)
{
VIR_DEBUG("arch='%s' data='%p'", virArchToString(arch), data);
VIR_DEBUG("arch=%s data=%p disabled=%p",
virArchToString(arch), data, disabled);
QEMU_CHECK_MONITOR_JSON(mon);
*data = NULL;
if (disabled)
*disabled = NULL;
return qemuMonitorJSONGetGuestCPU(mon, arch, data);
return qemuMonitorJSONGetGuestCPU(mon, arch, data, disabled);
}
......
......@@ -1021,7 +1021,8 @@ void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
int qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
virArch arch,
virCPUDataPtr *data);
virCPUDataPtr *data,
virCPUDataPtr *disabled);
int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);
......
......@@ -6728,6 +6728,7 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon)
* @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
*
* Retrieve the definition of the guest CPU from a running qemu instance.
*
......@@ -6737,8 +6738,11 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon)
int
qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
virArch arch,
virCPUDataPtr *data)
virCPUDataPtr *data,
virCPUDataPtr *disabled)
{
virCPUDataPtr cpuEnabled = NULL;
virCPUDataPtr cpuDisabled = NULL;
int rc;
if (ARCH_IS_X86(arch)) {
......@@ -6747,13 +6751,30 @@ qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
else if (!rc)
return -2;
return qemuMonitorJSONGetCPUx86Data(mon, "feature-words", data);
if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words",
&cpuEnabled) < 0)
goto error;
if (disabled &&
qemuMonitorJSONGetCPUx86Data(mon, "filtered-features",
&cpuDisabled) < 0)
goto error;
*data = cpuEnabled;
if (disabled)
*disabled = cpuDisabled;
return 0;
}
virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU definition retrieval isn't supported for '%s'"),
virArchToString(arch));
return -1;
error:
virCPUDataFree(cpuEnabled);
virCPUDataFree(cpuDisabled);
return -1;
}
int
......
......@@ -475,7 +475,8 @@ int qemuMonitorJSONGetCPUx86Data(qemuMonitorPtr mon,
int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
virArch arch,
virCPUDataPtr *data);
virCPUDataPtr *data,
virCPUDataPtr *disabled);
int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon);
......
......@@ -3854,7 +3854,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
rc = qemuMonitorGetGuestCPU(priv->mon, def->os.arch, &cpu);
rc = qemuMonitorGetGuestCPU(priv->mon, def->os.arch, &cpu, NULL);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
......
......@@ -2395,7 +2395,7 @@ testQemuMonitorJSONGetCPUData(const void *opaque)
if (qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test),
VIR_ARCH_X86_64,
&cpuData) < 0)
&cpuData, NULL) < 0)
goto cleanup;
if (!(actual = virCPUDataFormat(cpuData)))
......@@ -2438,7 +2438,7 @@ testQemuMonitorJSONGetNonExistingCPUData(const void *opaque)
rv = qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test),
VIR_ARCH_X86_64,
&cpuData);
&cpuData, NULL);
if (rv != -2) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected return value %d, expecting -2", rv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册