mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-14 05:57:26 +03:00
cpu_x86: Introduce <check> element for CPU models
CPU models in the CPU map may be marked with <check partial="compat"/> to indicate a backward compatible partial check (comparing our definition of the model with the host CPU) should be performed. Other models will be checked using just runnability info from QEMU. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0cf9039071
commit
f8ade72c2b
@ -150,6 +150,7 @@ struct _virCPUx86Model {
|
|||||||
char *name;
|
char *name;
|
||||||
bool decodeHost;
|
bool decodeHost;
|
||||||
bool decodeGuest;
|
bool decodeGuest;
|
||||||
|
bool compatCheck;
|
||||||
virCPUx86Vendor *vendor;
|
virCPUx86Vendor *vendor;
|
||||||
virCPUx86Signatures *signatures;
|
virCPUx86Signatures *signatures;
|
||||||
virCPUx86Data data;
|
virCPUx86Data data;
|
||||||
@ -1463,6 +1464,36 @@ x86ModelCompare(virCPUx86Model *model1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
x86ModelParseCheck(virCPUx86Model *model,
|
||||||
|
xmlXPathContextPtr ctxt)
|
||||||
|
{
|
||||||
|
g_autofree char *check = NULL;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if ((rc = virXPathBoolean("boolean(./check)", ctxt)) <= 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
check = virXPathString("string(./check/@partial)", ctxt);
|
||||||
|
if (!check) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Missing check/@partial in CPU model %1$s"),
|
||||||
|
model->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (STRNEQ(check, "compat")) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Invalid check/@partial value '%1$s' in CPU model %2$s"),
|
||||||
|
check, model->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
model->compatCheck = true;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
x86ModelParseDecode(virCPUx86Model *model,
|
x86ModelParseDecode(virCPUx86Model *model,
|
||||||
xmlXPathContextPtr ctxt)
|
xmlXPathContextPtr ctxt)
|
||||||
@ -1693,6 +1724,9 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
|||||||
model = g_new0(virCPUx86Model, 1);
|
model = g_new0(virCPUx86Model, 1);
|
||||||
model->name = g_strdup(name);
|
model->name = g_strdup(name);
|
||||||
|
|
||||||
|
if (x86ModelParseCheck(model, ctxt) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (x86ModelParseDecode(model, ctxt) < 0)
|
if (x86ModelParseDecode(model, ctxt) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user