On Tue, 17 Jan 2017 18:43:40 +0100 David Hildenbrand <[email protected]> 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 <[email protected]> > 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 <[email protected]> > --- > 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.
