qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] i386: Support "-cpu host" on TCG too


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH] i386: Support "-cpu host" on TCG too
Date: Thu, 19 Jan 2017 15:52:50 +0100

On Tue, 17 Jan 2017 18:43:40 +0100
David Hildenbrand <address@hidden> wrote:

> Uncompiled and untested.

@Jason: have you given this a try?

> @Conny and Christian, feel free to pick up and modify if this makes
> sense
> 
>  From 4a2af1ca47421b68eb7677cd91af350dd9be4e0e Mon Sep 17 00:00:00 2001
> From: David Hildenbrand <address@hidden>
> Date: Tue, 17 Jan 2017 18:34:45 +0100
> Subject: [PATCH] s390x/cpumodel: allow the "host" model also for tcg
> 
> Let's also allow the host model for tcg, therefore meaning
> "enable all features supported by the selected accelerator in the current
> host".
> 
> Signed-off-by: David Hildenbrand <address@hidden>
> ---
>   qapi-schema.json          |  4 ++--
>   target/s390x/cpu-qom.h    |  1 -
>   target/s390x/cpu_models.c | 34 ++++++++--------------------------
>   3 files changed, 10 insertions(+), 29 deletions(-)

(...)

> -#ifdef CONFIG_KVM
>   static void s390_host_cpu_model_initfn(Object *obj)
>   {
> +    S390CPUModel *max_model;
>       S390CPU *cpu = S390_CPU(obj);
>       Error *err = NULL;
> 
> -    if (!kvm_enabled() || !kvm_s390_cpu_models_supported()) {
> +    if (kvm_enabled() && !kvm_s390_cpu_models_supported()) {
>           return;
>       }
> 
> -    cpu->model = g_malloc0(sizeof(*cpu->model));
> -    kvm_s390_get_host_cpu_model(cpu->model, &err);
> -    if (err) {
> +    max_model = get_max_cpu_model(&err);
> +    if (err || !max_model) {

I think checking for !max_model is enough.

>           error_report_err(err);
> -        g_free(cpu->model);
>           /* fallback to unsupported cpu models */
> -        cpu->model = NULL;
> +        return;
>       }
> +    /* copy the host model so it can be modified */
> +    cpu->model = g_memdup(max_model, sizeof(*cpu->model));
>   }
> -#endif

(...)

This gives us the same as before on kvm and z900 for tcg, so this seems
reasonable to me.




reply via email to

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