qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] s390x: use generic cpu_model parsing


From: David Hildenbrand
Subject: Re: [Qemu-devel] [PATCH] s390x: use generic cpu_model parsing
Date: Thu, 21 Sep 2017 14:34:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 21.09.2017 12:53, Igor Mammedov wrote:
> define default CPU type in generic way in machine class_init
> and let common machine code to handle cpu_model parsing.
> 
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
> tested under TCG booting debian kernel,
> and compile tested on s390 host

Hotplugging checks (mixed CPU models) still seem to work fine.

Also parameters get applied and the model name is properly parsed.

>                       "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,9 @@ 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 overrriden with 'host' cpu type when accel=kvm

s/overrriden/overridden/

... with 'host' cpu *in kvm_arch_init*. ?

> +     * i.e. when kvm_arch_init() is executed */
> +    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;
> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
> index 5169379..0bf7e14 100644
> --- a/target/s390x/cpu_models.c
> +++ b/target/s390x/cpu_models.c
> @@ -1207,9 +1207,6 @@ static void s390_qemu_cpu_model_class_init(ObjectClass 
> *oc, void *data)
>                                  qemu_hw_version());
>  }


Reviewed-by: David Hildenbrand <address@hidden>

-- 

Thanks,

David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]