提交 79d72011 编写于 作者: J Jason J. Herne 提交者: Jiri Denemark

s390: Cpu driver support for update and compare

Implement compare for s390. Required to test the guest against the host for
guest cpu model runnability checking. We always return IDENTICAL to bypass
Libvirt's checking. s390 will rely on Qemu to perform the runnability checking.

Implement update for s390. required to support use of cpu "host-model" mode.
Signed-off-by: NJason J. Herne <jjherne@linux.vnet.ibm.com>
Acked-by: NJiri Denemark <jdenemar@redhat.com>
上级 c1140eb9
......@@ -46,6 +46,7 @@ src/cpu/cpu.c
src/cpu/cpu_arm.c
src/cpu/cpu_map.c
src/cpu/cpu_ppc64.c
src/cpu/cpu_s390.c
src/cpu/cpu_x86.c
src/datatypes.c
src/driver.c
......
......@@ -71,15 +71,84 @@ s390DataFree(virCPUDataPtr data)
VIR_FREE(data);
}
static virCPUCompareResult
virCPUs390Compare(virCPUDefPtr host ATTRIBUTE_UNUSED,
virCPUDefPtr cpu ATTRIBUTE_UNUSED,
bool failMessages ATTRIBUTE_UNUSED)
{
/* s390 relies on Qemu to perform all runability checking. Return
* VIR_CPU_COMPARE_IDENTICAL to bypass Libvirt checking.
*/
return VIR_CPU_COMPARE_IDENTICAL;
}
static int
virCPUs390Update(virCPUDefPtr guest,
const virCPUDef *host)
{
virCPUDefPtr updated = NULL;
int ret = -1;
size_t i;
if (guest->match == VIR_CPU_MATCH_MINIMUM) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("match mode %s not supported"),
virCPUMatchTypeToString(guest->match));
goto cleanup;
}
if (guest->mode != VIR_CPU_MODE_HOST_MODEL) {
ret = 0;
goto cleanup;
}
if (!host) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unknown host CPU model"));
goto cleanup;
}
if (!(updated = virCPUDefCopyWithoutModel(guest)))
goto cleanup;
updated->mode = VIR_CPU_MODE_CUSTOM;
if (virCPUDefCopyModel(updated, host, true) < 0)
goto cleanup;
for (i = 0; i < guest->nfeatures; i++) {
if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("only cpu feature policies 'require' and "
"'disable' are supported for %s"),
guest->features[i].name);
goto cleanup;
}
if (virCPUDefUpdateFeature(updated,
guest->features[i].name,
guest->features[i].policy) < 0)
goto cleanup;
}
virCPUDefStealModel(guest, updated, false);
guest->mode = VIR_CPU_MODE_CUSTOM;
guest->match = VIR_CPU_MATCH_EXACT;
ret = 0;
cleanup:
virCPUDefFree(updated);
return ret;
}
struct cpuArchDriver cpuDriverS390 = {
.name = "s390",
.arch = archs,
.narch = ARRAY_CARDINALITY(archs),
.compare = NULL,
.compare = virCPUs390Compare,
.decode = s390Decode,
.encode = NULL,
.free = s390DataFree,
.nodeData = s390NodeData,
.baseline = NULL,
.update = NULL,
.update = virCPUs390Update,
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册