From b6805e127c6b7815ea3abc6516b461a18d9c4d3d Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 21 Sep 2017 14:59:08 +0200 Subject: s390x: use generic cpu_model parsing Define default CPU type in generic way in machine class_init and let common machine code handle cpu_model parsing. Signed-off-by: Igor Mammedov Reviewed-by: David Hildenbrand Message-Id: <1505998749-269631-1-git-send-email-imammedo@redhat.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'hw/s390x') diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index fafbc6d..1bcb700 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -55,15 +55,8 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) static void s390_init_cpus(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); - const char *typename; - gchar **model_pieces; - ObjectClass *oc; - CPUClass *cc; int i; - if (machine->cpu_model == NULL) { - machine->cpu_model = s390_default_cpu_model_name(); - } if (tcg_enabled() && max_cpus > 1) { error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " "supported by TCG (1) on s390x", max_cpus); @@ -73,25 +66,8 @@ static void s390_init_cpus(MachineState *machine) /* initialize possible_cpus */ mc->possible_cpu_arch_ids(machine); - model_pieces = g_strsplit(machine->cpu_model, ",", 2); - if (!model_pieces[0]) { - error_report("Invalid/empty CPU model name"); - exit(1); - } - - oc = cpu_class_by_name(TYPE_S390_CPU, model_pieces[0]); - if (!oc) { - error_report("Unable to find CPU definition: %s", model_pieces[0]); - exit(1); - } - typename = object_class_get_name(oc); - cc = CPU_CLASS(oc); - /* after parsing, properties will be applied to all *typename* instances */ - cc->parse_features(typename, model_pieces[1], &error_fatal); - g_strfreev(model_pieces); - for (i = 0; i < smp_cpus; i++) { - s390x_new_cpu(typename, i, &error_fatal); + s390x_new_cpu(machine->cpu_type, i, &error_fatal); } } @@ -446,6 +422,8 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) mc->get_hotplug_handler = s390_get_hotplug_handler; mc->cpu_index_to_instance_props = s390_cpu_index_to_props; mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids; + /* it is overridden with 'host' cpu *in kvm_arch_init* */ + mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu"); hc->plug = s390_machine_device_plug; hc->unplug_request = s390_machine_device_unplug_request; nc->nmi_monitor_handler = s390_nmi; -- cgit v1.1