diff options
author | Igor Mammedov <imammedo@redhat.com> | 2017-09-21 14:59:08 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2017-10-06 10:53:01 +0200 |
commit | b6805e127c6b7815ea3abc6516b461a18d9c4d3d (patch) | |
tree | bb85e715e5e95b9f5e3473270cdb6b55508b146e /target/s390x | |
parent | 7705c75048cab58ca9c4e25ed5880b20598777cf (diff) | |
download | qemu-b6805e127c6b7815ea3abc6516b461a18d9c4d3d.zip qemu-b6805e127c6b7815ea3abc6516b461a18d9c4d3d.tar.gz qemu-b6805e127c6b7815ea3abc6516b461a18d9c4d3d.tar.bz2 |
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 <imammedo@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <1505998749-269631-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x')
-rw-r--r-- | target/s390x/cpu.h | 6 | ||||
-rw-r--r-- | target/s390x/cpu_models.c | 11 | ||||
-rw-r--r-- | target/s390x/kvm.c | 3 |
3 files changed, 7 insertions, 13 deletions
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 4414485..5e2504d 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -686,12 +686,14 @@ static inline unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) /* cpu_models.c */ void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf); #define cpu_list s390_cpu_list -const char *s390_default_cpu_model_name(void); - /* helper.c */ #define cpu_init(cpu_model) cpu_generic_init(TYPE_S390_CPU, cpu_model) S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp); + +#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU +#define S390_CPU_TYPE_NAME(name) (name S390_CPU_TYPE_SUFFIX) + /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 1051a16..48dd7be 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -1211,9 +1211,6 @@ static void s390_qemu_cpu_model_class_init(ObjectClass *oc, void *data) qemu_hw_version()); } -#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU -#define S390_CPU_TYPE_NAME(name) (name S390_CPU_TYPE_SUFFIX) - /* Generate type name for a cpu model. Caller has to free the string. */ static char *s390_cpu_type_name(const char *model_name) { @@ -1236,14 +1233,6 @@ ObjectClass *s390_cpu_class_by_name(const char *name) return oc; } -const char *s390_default_cpu_model_name(void) -{ - if (kvm_enabled()) { - return "host"; - } - return "qemu"; -} - static const TypeInfo qemu_s390_cpu_type_info = { .name = S390_CPU_TYPE_NAME("qemu"), .parent = TYPE_S390_CPU, diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ebb75ca..c65d76f 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -287,6 +287,9 @@ void kvm_s390_crypto_reset(void) int kvm_arch_init(MachineState *ms, KVMState *s) { + MachineClass *mc = MACHINE_GET_CLASS(ms); + + mc->default_cpu_type = S390_CPU_TYPE_NAME("host"); cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS); cap_async_pf = kvm_check_extension(s, KVM_CAP_ASYNC_PF); cap_mem_op = kvm_check_extension(s, KVM_CAP_S390_MEM_OP); |