Allow expansion of the new KVM-only named CPU models through the cpu-model-expansion QMP query.
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 5fbdca3253..0940285af1 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -36,6 +36,7 @@ #include <linux/kvm.h> #include "system/kvm.h" #include "cpu.h" +#include "cpu-models.h" static GICCapability *gic_cap_new(int version) { @@ -96,6 +97,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, Object *obj; const char *name; int fdarray[3]; + bool named_model = (arm_find_model(model->name) != NULL); int i; if (type != CPU_MODEL_EXPANSION_TYPE_FULL) { @@ -108,6 +110,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", @@ -121,6 +128,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
