[RFC PATCH v3 13/19] target/arm/qmp: add named models and properties to cpu-model-expansion
Khushit Shah <[email protected]>
| Newsgroups | org.nongnu.qemu-arm,dev.linux.lists.kvmarm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Allow expansion of the new named CPU models. Signed-off-by: Khushit Shah <[email protected]> --- target/arm/arm-qmp-cmds.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index edcfc82a25..bdf46c823a 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -33,6 +33,7 @@ #include "qobject/qdict.h" #include "qom/qom-qobject.h" #include "cpu.h" +#include "arm-cpu-models.h" static GICCapability *gic_cap_new(int version) { @@ -92,6 +93,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, ObjectClass *oc; Object *obj; const char *name; + bool named_model = (arm_find_model(model->name) != NULL); int i; if (type != CPU_MODEL_EXPANSION_TYPE_FULL) { @@ -104,6 +106,11 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, return NULL; } + if (!kvm_enabled() && named_model) { + error_setg(errp, "The CPU type '%s' requires KVM", model->name); + return NULL; + } + oc = cpu_class_by_name(TYPE_ARM_CPU, model->name); if (!oc) { error_setg(errp, "The CPU type '%s' is not a recognized ARM CPU type", @@ -117,6 +124,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, if (!strcmp(model->name, "host") || !strcmp(model->name, "max")) { /* These are kvmarm's recommended cpu types */ supported = true; + } else if (named_model) { + supported = true; } else if (current_machine->cpu_type) { const char *cpu_type = current_machine->cpu_type; int len = strlen(cpu_type) - strlen(ARM_CPU_TYPE_SUFFIX); -- 2.52.0