From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935433810613.4804545250952; Mon, 2 Oct 2017 02:10:33 -0700 (PDT) Received: from localhost ([::1]:51262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywk7-0003EV-09 for importer@patchew.org; Mon, 02 Oct 2017 05:10:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiC-0001wo-P3 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywi8-0005wI-NN for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywi8-0005vk-HO for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B650080464; Mon, 2 Oct 2017 09:08:23 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF43A60621; Mon, 2 Oct 2017 09:08:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B650080464 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:43 +0200 Message-Id: <1506935300-132598-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 02 Oct 2017 09:08:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 01/38] qom: add helper type_init_from_array() X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , ehabkost@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it will help to remove code duplication in places that currently open code registration of several types. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- I'm going to use it for CPU types in followup patches CC: ehabkost@redhat.com --- include/qemu/module.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/qemu/module.h b/include/qemu/module.h index 56dd218..29f9089 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -52,6 +52,16 @@ typedef enum { #define type_init(function) module_init(function, MODULE_INIT_QOM) #define trace_init(function) module_init(function, MODULE_INIT_TRACE) =20 +#define type_init_from_array(array) = \ +static void do_qemu_init_ ## array(void) = \ +{ = \ + int i; = \ + for (i =3D 0; i < ARRAY_SIZE(array); i++) { = \ + type_register_static(&array[i]); = \ + } = \ +} = \ +module_init(do_qemu_init_ ## array, MODULE_INIT_QOM) + #define block_module_load_one(lib) module_load_one("block-", lib) =20 void register_module_init(void (*fn)(void), module_init_type type); --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935598755785.0358558923293; Mon, 2 Oct 2017 02:13:18 -0700 (PDT) Received: from localhost ([::1]:51276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywmh-0005jQ-Lh for importer@patchew.org; Mon, 02 Oct 2017 05:13:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiC-0001wn-OA for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiA-0005xo-0k for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywi9-0005ws-Oh for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCF585AFED; Mon, 2 Oct 2017 09:08:24 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09E8C60A9D; Mon, 2 Oct 2017 09:08:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DCF585AFED Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:44 +0200 Message-Id: <1506935300-132598-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 02 Oct 2017 09:08:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 02/38] alpha: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Introduce ALPHA_CPU_TYPE_NAME macro to replace rather ununique TYPE macro that alpha uses. With new macro it will follow the same naming convention as other targets. While at it put scattered TypeInfo into one array which places type desriptions at one place and reduces code a bit. Signed-off-by: Igor Mammedov Acked-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: rth@twiddle.net --- target/alpha/cpu.h | 3 ++ target/alpha/cpu.c | 107 +++++++++++++++++--------------------------------= ---- 2 files changed, 37 insertions(+), 73 deletions(-) diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index 6ae2409..0a9ad35 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -470,6 +470,9 @@ void alpha_translate_init(void); =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_ALPHA_CPU, cpu_model) =20 +#define ALPHA_CPU_TYPE_SUFFIX "-" TYPE_ALPHA_CPU +#define ALPHA_CPU_TYPE_NAME(model) model ALPHA_CPU_TYPE_SUFFIX + void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf); /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index b8a21f4..81a39c4 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -108,21 +108,18 @@ void alpha_cpu_list(FILE *f, fprintf_function cpu_fpr= intf) } =20 /* Models */ - -#define TYPE(model) model "-" TYPE_ALPHA_CPU - typedef struct AlphaCPUAlias { const char *alias; const char *typename; } AlphaCPUAlias; =20 static const AlphaCPUAlias alpha_cpu_aliases[] =3D { - { "21064", TYPE("ev4") }, - { "21164", TYPE("ev5") }, - { "21164a", TYPE("ev56") }, - { "21164pc", TYPE("pca56") }, - { "21264", TYPE("ev6") }, - { "21264a", TYPE("ev67") }, + { "21064", ALPHA_CPU_TYPE_NAME("ev4") }, + { "21164", ALPHA_CPU_TYPE_NAME("ev5") }, + { "21164a", ALPHA_CPU_TYPE_NAME("ev56") }, + { "21164pc", ALPHA_CPU_TYPE_NAME("pca56") }, + { "21264", ALPHA_CPU_TYPE_NAME("ev6") }, + { "21264a", ALPHA_CPU_TYPE_NAME("ev67") }, }; =20 static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) @@ -145,7 +142,7 @@ static ObjectClass *alpha_cpu_class_by_name(const char = *cpu_model) } } =20 - typename =3D g_strdup_printf("%s-" TYPE_ALPHA_CPU, cpu_model); + typename =3D g_strdup_printf(ALPHA_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && object_class_is_abstract(oc)) { @@ -155,7 +152,7 @@ static ObjectClass *alpha_cpu_class_by_name(const char = *cpu_model) /* TODO: remove match everything nonsense */ /* Default to ev67; no reason not to emulate insns by default. */ if (!oc) { - oc =3D object_class_by_name(TYPE("ev67")); + oc =3D object_class_by_name(ALPHA_CPU_TYPE_NAME("ev67")); } =20 return oc; @@ -169,12 +166,6 @@ static void ev4_cpu_initfn(Object *obj) env->implver =3D IMPLVER_2106x; } =20 -static const TypeInfo ev4_cpu_type_info =3D { - .name =3D TYPE("ev4"), - .parent =3D TYPE_ALPHA_CPU, - .instance_init =3D ev4_cpu_initfn, -}; - static void ev5_cpu_initfn(Object *obj) { AlphaCPU *cpu =3D ALPHA_CPU(obj); @@ -183,12 +174,6 @@ static void ev5_cpu_initfn(Object *obj) env->implver =3D IMPLVER_21164; } =20 -static const TypeInfo ev5_cpu_type_info =3D { - .name =3D TYPE("ev5"), - .parent =3D TYPE_ALPHA_CPU, - .instance_init =3D ev5_cpu_initfn, -}; - static void ev56_cpu_initfn(Object *obj) { AlphaCPU *cpu =3D ALPHA_CPU(obj); @@ -197,12 +182,6 @@ static void ev56_cpu_initfn(Object *obj) env->amask |=3D AMASK_BWX; } =20 -static const TypeInfo ev56_cpu_type_info =3D { - .name =3D TYPE("ev56"), - .parent =3D TYPE("ev5"), - .instance_init =3D ev56_cpu_initfn, -}; - static void pca56_cpu_initfn(Object *obj) { AlphaCPU *cpu =3D ALPHA_CPU(obj); @@ -211,12 +190,6 @@ static void pca56_cpu_initfn(Object *obj) env->amask |=3D AMASK_MVI; } =20 -static const TypeInfo pca56_cpu_type_info =3D { - .name =3D TYPE("pca56"), - .parent =3D TYPE("ev56"), - .instance_init =3D pca56_cpu_initfn, -}; - static void ev6_cpu_initfn(Object *obj) { AlphaCPU *cpu =3D ALPHA_CPU(obj); @@ -226,12 +199,6 @@ static void ev6_cpu_initfn(Object *obj) env->amask =3D AMASK_BWX | AMASK_FIX | AMASK_MVI | AMASK_TRAP; } =20 -static const TypeInfo ev6_cpu_type_info =3D { - .name =3D TYPE("ev6"), - .parent =3D TYPE_ALPHA_CPU, - .instance_init =3D ev6_cpu_initfn, -}; - static void ev67_cpu_initfn(Object *obj) { AlphaCPU *cpu =3D ALPHA_CPU(obj); @@ -240,17 +207,6 @@ static void ev67_cpu_initfn(Object *obj) env->amask |=3D AMASK_CIX | AMASK_PREFETCH; } =20 -static const TypeInfo ev67_cpu_type_info =3D { - .name =3D TYPE("ev67"), - .parent =3D TYPE("ev6"), - .instance_init =3D ev67_cpu_initfn, -}; - -static const TypeInfo ev68_cpu_type_info =3D { - .name =3D TYPE("ev68"), - .parent =3D TYPE("ev67"), -}; - static void alpha_cpu_initfn(Object *obj) { CPUState *cs =3D CPU(obj); @@ -303,26 +259,31 @@ static void alpha_cpu_class_init(ObjectClass *oc, voi= d *data) cc->gdb_num_core_regs =3D 67; } =20 -static const TypeInfo alpha_cpu_type_info =3D { - .name =3D TYPE_ALPHA_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(AlphaCPU), - .instance_init =3D alpha_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(AlphaCPUClass), - .class_init =3D alpha_cpu_class_init, +#define DEFINE_ALPHA_CPU_TYPE(base_type, cpu_model, initfn) \ + { \ + .parent =3D base_type, \ + .instance_init =3D initfn, \ + .name =3D ALPHA_CPU_TYPE_NAME(cpu_model), \ + } + +static const TypeInfo alpha_cpu_type_infos[] =3D { + { + .name =3D TYPE_ALPHA_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(AlphaCPU), + .instance_init =3D alpha_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(AlphaCPUClass), + .class_init =3D alpha_cpu_class_init, + }, + DEFINE_ALPHA_CPU_TYPE(TYPE_ALPHA_CPU, "ev4", ev4_cpu_initfn), + DEFINE_ALPHA_CPU_TYPE(TYPE_ALPHA_CPU, "ev5", ev5_cpu_initfn), + DEFINE_ALPHA_CPU_TYPE(ALPHA_CPU_TYPE_NAME("ev5"), "ev56", ev56_cpu_ini= tfn), + DEFINE_ALPHA_CPU_TYPE(ALPHA_CPU_TYPE_NAME("ev56"), "pca56", + pca56_cpu_initfn), + DEFINE_ALPHA_CPU_TYPE(TYPE_ALPHA_CPU, "ev6", ev6_cpu_initfn), + DEFINE_ALPHA_CPU_TYPE(ALPHA_CPU_TYPE_NAME("ev6"), "ev67", ev67_cpu_ini= tfn), + DEFINE_ALPHA_CPU_TYPE(ALPHA_CPU_TYPE_NAME("ev67"), "ev68", NULL), }; =20 -static void alpha_cpu_register_types(void) -{ - type_register_static(&alpha_cpu_type_info); - type_register_static(&ev4_cpu_type_info); - type_register_static(&ev5_cpu_type_info); - type_register_static(&ev56_cpu_type_info); - type_register_static(&pca56_cpu_type_info); - type_register_static(&ev6_cpu_type_info); - type_register_static(&ev67_cpu_type_info); - type_register_static(&ev68_cpu_type_info); -} - -type_init(alpha_cpu_register_types) +type_init_from_array(alpha_cpu_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935908171648.2855720886764; Mon, 2 Oct 2017 02:18:28 -0700 (PDT) Received: from localhost ([::1]:51299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywrr-0001xf-Bp for importer@patchew.org; Mon, 02 Oct 2017 05:18:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiE-0001x6-Vb for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiB-0005yq-3W for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40270) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiA-0005y6-TD for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 074C0C04AC5F; Mon, 2 Oct 2017 09:08:26 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3154360A9D; Mon, 2 Oct 2017 09:08:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 074C0C04AC5F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:45 +0200 Message-Id: <1506935300-132598-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Oct 2017 09:08:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 03/38] alpha: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Acked-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: rth@twiddle.net --- hw/alpha/dp264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 1b12130..babd6ea 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -51,7 +51,6 @@ static int clipper_pci_map_irq(PCIDevice *d, int irq_num) static void clipper_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model ? machine->cpu_model : "e= v67"; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -67,7 +66,7 @@ static void clipper_init(MachineState *machine) /* Create up to 4 cpus. */ memset(cpus, 0, sizeof(cpus)); for (i =3D 0; i < smp_cpus; ++i) { - cpus[i] =3D ALPHA_CPU(cpu_generic_init(TYPE_ALPHA_CPU, cpu_model)); + cpus[i] =3D ALPHA_CPU(cpu_create(machine->cpu_type)); } =20 cpus[0]->env.trap_arg0 =3D ram_size; @@ -179,6 +178,7 @@ static void clipper_machine_init(MachineClass *mc) mc->block_default_type =3D IF_IDE; mc->max_cpus =3D 4; mc->is_default =3D 1; + mc->default_cpu_type =3D ALPHA_CPU_TYPE_NAME("ev67"); } =20 DEFINE_MACHINE("clipper", clipper_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935439804127.03068549703403; Mon, 2 Oct 2017 02:10:39 -0700 (PDT) Received: from localhost ([::1]:51265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywkC-0003JR-DC for importer@patchew.org; Mon, 02 Oct 2017 05:10:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiH-0001yN-0g for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiC-0005za-6l for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45710) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiB-0005zB-V9 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29BAAC0587E9; Mon, 2 Oct 2017 09:08:27 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50F5860A9D; Mon, 2 Oct 2017 09:08:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 29BAAC0587E9 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:46 +0200 Message-Id: <1506935300-132598-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 09:08:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 04/38] cris: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" replace ambiguous TYPE macro with a new CRIS_CPU_TYPE_NAME and use it consistently in the code. Signed-off-by: Igor Mammedov --- CC: edgar.iglesias@gmail.com --- target/cris/cpu.h | 3 ++ target/cris/cpu.c | 93 +++++++++++++++++++++++----------------------------= ---- 2 files changed, 42 insertions(+), 54 deletions(-) diff --git a/target/cris/cpu.h b/target/cris/cpu.h index 5d822de..b64fa35 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -269,6 +269,9 @@ enum { =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_CRIS_CPU, cpu_model) =20 +#define CRIS_CPU_TYPE_SUFFIX "-" TYPE_CRIS_CPU +#define CRIS_CPU_TYPE_NAME(name) (name CRIS_CPU_TYPE_SUFFIX) + #define cpu_signal_handler cpu_cris_signal_handler =20 /* MMU modes definitions */ diff --git a/target/cris/cpu.c b/target/cris/cpu.c index 88d93f2..8681c84 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -71,11 +71,11 @@ static ObjectClass *cris_cpu_class_by_name(const char *= cpu_model) =20 #if defined(CONFIG_USER_ONLY) if (strcasecmp(cpu_model, "any") =3D=3D 0) { - return object_class_by_name("crisv32-" TYPE_CRIS_CPU); + return object_class_by_name(CRIS_CPU_TYPE_NAME("crisv32")); } #endif =20 - typename =3D g_strdup_printf("%s-" TYPE_CRIS_CPU, cpu_model); + typename =3D g_strdup_printf(CRIS_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_CRIS_CPU) || @@ -108,7 +108,7 @@ static void cris_cpu_list_entry(gpointer data, gpointer= user_data) const char *typename =3D object_class_get_name(oc); char *name; =20 - name =3D g_strndup(typename, strlen(typename) - strlen("-" TYPE_CRIS_C= PU)); + name =3D g_strndup(typename, strlen(typename) - strlen(CRIS_CPU_TYPE_S= UFFIX)); (*s->cpu_fprintf)(s->file, " %s\n", name); g_free(name); } @@ -259,38 +259,6 @@ static void crisv32_cpu_class_init(ObjectClass *oc, vo= id *data) ccc->vr =3D 32; } =20 -#define TYPE(model) model "-" TYPE_CRIS_CPU - -static const TypeInfo cris_cpu_model_type_infos[] =3D { - { - .name =3D TYPE("crisv8"), - .parent =3D TYPE_CRIS_CPU, - .class_init =3D crisv8_cpu_class_init, - }, { - .name =3D TYPE("crisv9"), - .parent =3D TYPE_CRIS_CPU, - .class_init =3D crisv9_cpu_class_init, - }, { - .name =3D TYPE("crisv10"), - .parent =3D TYPE_CRIS_CPU, - .class_init =3D crisv10_cpu_class_init, - }, { - .name =3D TYPE("crisv11"), - .parent =3D TYPE_CRIS_CPU, - .class_init =3D crisv11_cpu_class_init, - }, { - .name =3D TYPE("crisv17"), - .parent =3D TYPE_CRIS_CPU, - .class_init =3D crisv17_cpu_class_init, - }, { - .name =3D TYPE("crisv32"), - .parent =3D TYPE_CRIS_CPU, - .class_init =3D crisv32_cpu_class_init, - } -}; - -#undef TYPE - static void cris_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -324,24 +292,41 @@ static void cris_cpu_class_init(ObjectClass *oc, void= *data) cc->disas_set_info =3D cris_disas_set_info; } =20 -static const TypeInfo cris_cpu_type_info =3D { - .name =3D TYPE_CRIS_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(CRISCPU), - .instance_init =3D cris_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(CRISCPUClass), - .class_init =3D cris_cpu_class_init, -}; - -static void cris_cpu_register_types(void) -{ - int i; - - type_register_static(&cris_cpu_type_info); - for (i =3D 0; i < ARRAY_SIZE(cris_cpu_model_type_infos); i++) { - type_register_static(&cris_cpu_model_type_infos[i]); +static const TypeInfo cris_cpu_model_type_infos[] =3D { + { + .name =3D TYPE_CRIS_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(CRISCPU), + .instance_init =3D cris_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(CRISCPUClass), + .class_init =3D cris_cpu_class_init, + }, + { + .name =3D CRIS_CPU_TYPE_NAME("crisv8"), + .parent =3D TYPE_CRIS_CPU, + .class_init =3D crisv8_cpu_class_init, + }, { + .name =3D CRIS_CPU_TYPE_NAME("crisv9"), + .parent =3D TYPE_CRIS_CPU, + .class_init =3D crisv9_cpu_class_init, + }, { + .name =3D CRIS_CPU_TYPE_NAME("crisv10"), + .parent =3D TYPE_CRIS_CPU, + .class_init =3D crisv10_cpu_class_init, + }, { + .name =3D CRIS_CPU_TYPE_NAME("crisv11"), + .parent =3D TYPE_CRIS_CPU, + .class_init =3D crisv11_cpu_class_init, + }, { + .name =3D CRIS_CPU_TYPE_NAME("crisv17"), + .parent =3D TYPE_CRIS_CPU, + .class_init =3D crisv17_cpu_class_init, + }, { + .name =3D CRIS_CPU_TYPE_NAME("crisv32"), + .parent =3D TYPE_CRIS_CPU, + .class_init =3D crisv32_cpu_class_init, } -} +}; =20 -type_init(cris_cpu_register_types) +type_init_from_array(cris_cpu_model_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935588711901.5050754044731; Mon, 2 Oct 2017 02:13:08 -0700 (PDT) Received: from localhost ([::1]:51277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywmh-0005jW-U7 for importer@patchew.org; Mon, 02 Oct 2017 05:13:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiE-0001ww-9B for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiD-00060K-Az for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiD-0005zl-4u for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47F8E85550; Mon, 2 Oct 2017 09:08:28 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7078860621; Mon, 2 Oct 2017 09:08:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 47F8E85550 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:47 +0200 Message-Id: <1506935300-132598-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 02 Oct 2017 09:08:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 05/38] cris: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: edgar.iglesias@gmail.com --- hw/cris/axis_dev88.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index 5eb552b..9ccc435 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -251,7 +251,6 @@ static void axisdev88_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; CRISCPU *cpu; @@ -268,10 +267,7 @@ void axisdev88_init(MachineState *machine) MemoryRegion *phys_intmem =3D g_new(MemoryRegion, 1); =20 /* init CPUs */ - if (cpu_model =3D=3D NULL) { - cpu_model =3D "crisv32"; - } - cpu =3D CRIS_CPU(cpu_generic_init(TYPE_CRIS_CPU, cpu_model)); + cpu =3D CRIS_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 /* allocate RAM */ @@ -359,6 +355,7 @@ static void axisdev88_machine_init(MachineClass *mc) mc->desc =3D "AXIS devboard 88"; mc->init =3D axisdev88_init; mc->is_default =3D 1; + mc->default_cpu_type =3D CRIS_CPU_TYPE_NAME("crisv32"); } =20 DEFINE_MACHINE("axis-dev88", axisdev88_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935761136623.6031042086668; Mon, 2 Oct 2017 02:16:01 -0700 (PDT) Received: from localhost ([::1]:51291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywpA-0008CD-4y for importer@patchew.org; Mon, 02 Oct 2017 05:15:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiG-0001xO-0a for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiE-00061O-S5 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45864) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiE-00060k-KB for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 967AAC0587E3; Mon, 2 Oct 2017 09:08:29 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91DBC60A9D; Mon, 2 Oct 2017 09:08:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 967AAC0587E3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:48 +0200 Message-Id: <1506935300-132598-7-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 09:08:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 06/38] lm32: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michael@walle.cc, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" introduce LM32_CPU_TYPE_NAME macro and consistently use it to construct cpu type names. While at it replace dynamic cpu type name composition with static data. Signed-off-by: Igor Mammedov Acked-by: Michael Walle Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: michael@walle.cc --- target/lm32/cpu.h | 3 +++ target/lm32/cpu.c | 74 +++++++++++++++++----------------------------------= ---- 2 files changed, 25 insertions(+), 52 deletions(-) diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index de265b5..2279594 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -257,6 +257,9 @@ bool lm32_cpu_do_semihosting(CPUState *cs); =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_LM32_CPU, cpu_model) =20 +#define LM32_CPU_TYPE_SUFFIX "-" TYPE_LM32_CPU +#define LM32_CPU_TYPE_NAME(model) model LM32_CPU_TYPE_SUFFIX + #define cpu_list lm32_cpu_list #define cpu_signal_handler cpu_lm32_signal_handler =20 diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index bf081f5..4d0da50 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -51,7 +51,7 @@ static void lm32_cpu_list_entry(gpointer data, gpointer u= ser_data) const char *typename =3D object_class_get_name(oc); char *name; =20 - name =3D g_strndup(typename, strlen(typename) - strlen("-" TYPE_LM32_C= PU)); + name =3D g_strndup(typename, strlen(typename) - strlen(LM32_CPU_TYPE_S= UFFIX)); (*s->cpu_fprintf)(s->file, " %s\n", name); g_free(name); } @@ -221,32 +221,12 @@ static void lm32_full_cpu_initfn(Object *obj) | LM32_FEATURE_CYCLE_COUNT; } =20 -typedef struct LM32CPUInfo { - const char *name; - void (*initfn)(Object *obj); -} LM32CPUInfo; - -static const LM32CPUInfo lm32_cpus[] =3D { - { - .name =3D "lm32-basic", - .initfn =3D lm32_basic_cpu_initfn, - }, - { - .name =3D "lm32-standard", - .initfn =3D lm32_standard_cpu_initfn, - }, - { - .name =3D "lm32-full", - .initfn =3D lm32_full_cpu_initfn, - }, -}; - static ObjectClass *lm32_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_LM32_CPU, cpu_model); + typename =3D g_strdup_printf(LM32_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_LM32_CPU) || @@ -288,36 +268,26 @@ static void lm32_cpu_class_init(ObjectClass *oc, void= *data) cc->disas_set_info =3D lm32_cpu_disas_set_info; } =20 -static void lm32_register_cpu_type(const LM32CPUInfo *info) -{ - TypeInfo type_info =3D { - .parent =3D TYPE_LM32_CPU, - .instance_init =3D info->initfn, - }; - - type_info.name =3D g_strdup_printf("%s-" TYPE_LM32_CPU, info->name); - type_register(&type_info); - g_free((void *)type_info.name); -} +#define DEFINE_LM32_CPU_TYPE(cpu_model, initfn) \ + { \ + .parent =3D TYPE_LM32_CPU, \ + .name =3D LM32_CPU_TYPE_NAME(cpu_model), \ + .instance_init =3D initfn, \ + } =20 -static const TypeInfo lm32_cpu_type_info =3D { - .name =3D TYPE_LM32_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(LM32CPU), - .instance_init =3D lm32_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(LM32CPUClass), - .class_init =3D lm32_cpu_class_init, +static const TypeInfo lm32_cpus_type_infos[] =3D { + { /* base class should be registered first */ + .name =3D TYPE_LM32_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(LM32CPU), + .instance_init =3D lm32_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(LM32CPUClass), + .class_init =3D lm32_cpu_class_init, + }, + DEFINE_LM32_CPU_TYPE("lm32-basic", lm32_basic_cpu_initfn), + DEFINE_LM32_CPU_TYPE("lm32-standard", lm32_standard_cpu_initfn), + DEFINE_LM32_CPU_TYPE("lm32-full", lm32_full_cpu_initfn), }; =20 -static void lm32_cpu_register_types(void) -{ - int i; - - type_register_static(&lm32_cpu_type_info); - for (i =3D 0; i < ARRAY_SIZE(lm32_cpus); i++) { - lm32_register_cpu_type(&lm32_cpus[i]); - } -} - -type_init(lm32_cpu_register_types) +type_init_from_array(lm32_cpus_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935441462255.59158296919668; Mon, 2 Oct 2017 02:10:41 -0700 (PDT) Received: from localhost ([::1]:51267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywkC-0003K2-Qz for importer@patchew.org; Mon, 02 Oct 2017 05:10:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiG-0001y2-Iv for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiF-00061l-P0 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53426) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiF-00061V-JQ for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B79AA4E33A; Mon, 2 Oct 2017 09:08:30 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFC4060621; Mon, 2 Oct 2017 09:08:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B79AA4E33A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:49 +0200 Message-Id: <1506935300-132598-8-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 02 Oct 2017 09:08:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 07/38] lm32: milkymist: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michael@walle.cc, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Acked-by: Michael Walle Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: michael@walle.cc --- hw/lm32/milkymist.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 4db4d2d..d4e765f 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -80,7 +80,6 @@ static void main_cpu_reset(void *opaque) static void milkymist_init(MachineState *machine) { - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -108,10 +107,7 @@ milkymist_init(MachineState *machine) =20 reset_info =3D g_malloc0(sizeof(ResetInfo)); =20 - if (cpu_model =3D=3D NULL) { - cpu_model =3D "lm32-full"; - } - cpu =3D LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model)); + cpu =3D LM32_CPU(cpu_create(machine->cpu_type)); =20 env =3D &cpu->env; reset_info->cpu =3D cpu; @@ -216,6 +212,7 @@ static void milkymist_machine_init(MachineClass *mc) mc->desc =3D "Milkymist One"; mc->init =3D milkymist_init; mc->is_default =3D 0; + mc->default_cpu_type =3D LM32_CPU_TYPE_NAME("lm32-full"); } =20 DEFINE_MACHINE("milkymist", milkymist_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150693559852571.24230035840571; Mon, 2 Oct 2017 02:13:18 -0700 (PDT) Received: from localhost ([::1]:51279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywmm-0005nz-Pc for importer@patchew.org; Mon, 02 Oct 2017 05:13:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiH-0001z0-MI for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiG-00062Y-SB for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44216) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiG-000621-Mk for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6D7C81E0B; Mon, 2 Oct 2017 09:08:31 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B70960A9D; Mon, 2 Oct 2017 09:08:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D6D7C81E0B Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:50 +0200 Message-Id: <1506935300-132598-9-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 02 Oct 2017 09:08:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 08/38] lm32: lm32_boards: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michael@walle.cc, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Acked-by: Michael Walle Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: michael@walle.cc --- hw/lm32/lm32_boards.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index b0bb3ef..002d638 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -75,7 +75,6 @@ static void main_cpu_reset(void *opaque) =20 static void lm32_evr_init(MachineState *machine) { - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; LM32CPU *cpu; CPULM32State *env; @@ -101,10 +100,7 @@ static void lm32_evr_init(MachineState *machine) =20 reset_info =3D g_malloc0(sizeof(ResetInfo)); =20 - if (cpu_model =3D=3D NULL) { - cpu_model =3D "lm32-full"; - } - cpu =3D LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model)); + cpu =3D LM32_CPU(cpu_create(machine->cpu_type)); =20 env =3D &cpu->env; reset_info->cpu =3D cpu; @@ -163,7 +159,6 @@ static void lm32_evr_init(MachineState *machine) =20 static void lm32_uclinux_init(MachineState *machine) { - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -198,10 +193,7 @@ static void lm32_uclinux_init(MachineState *machine) =20 reset_info =3D g_malloc0(sizeof(ResetInfo)); =20 - if (cpu_model =3D=3D NULL) { - cpu_model =3D "lm32-full"; - } - cpu =3D LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model)); + cpu =3D LM32_CPU(cpu_create(machine->cpu_type)); =20 env =3D &cpu->env; reset_info->cpu =3D cpu; @@ -295,6 +287,7 @@ static void lm32_evr_class_init(ObjectClass *oc, void *= data) mc->desc =3D "LatticeMico32 EVR32 eval system"; mc->init =3D lm32_evr_init; mc->is_default =3D 1; + mc->default_cpu_type =3D LM32_CPU_TYPE_NAME("lm32-full"); } =20 static const TypeInfo lm32_evr_type =3D { @@ -310,6 +303,7 @@ static void lm32_uclinux_class_init(ObjectClass *oc, vo= id *data) mc->desc =3D "lm32 platform for uClinux and u-boot by Theobroma System= s"; mc->init =3D lm32_uclinux_init; mc->is_default =3D 0; + mc->default_cpu_type =3D LM32_CPU_TYPE_NAME("lm32-full"); } =20 static const TypeInfo lm32_uclinux_type =3D { --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935909518303.2766700949584; Mon, 2 Oct 2017 02:18:29 -0700 (PDT) Received: from localhost ([::1]:51298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywrq-0001wM-G4 for importer@patchew.org; Mon, 02 Oct 2017 05:18:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiM-00023W-99 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiI-00063Q-6U for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiH-000638-Uc for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1422DC04AC58; Mon, 2 Oct 2017 09:08:33 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B3CE6062E; Mon, 2 Oct 2017 09:08:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1422DC04AC58 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:51 +0200 Message-Id: <1506935300-132598-10-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Oct 2017 09:08:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/38] m68k: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" use new M68K_CPU_TYPE_NAME to compose CPU type names and get rid of intermediate M68kCPUInfo/register_cpu_type() which is replaced by static TypeInfo array. Signed-off-by: Igor Mammedov Acked-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: laurent@vivier.eu --- target/m68k/cpu.h | 3 +++ target/m68k/cpu.c | 75 ++++++++++++++++++++-------------------------------= ---- 2 files changed, 30 insertions(+), 48 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index d936547..afae5f6 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -323,6 +323,9 @@ void register_m68k_insns (CPUM68KState *env); =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_M68K_CPU, cpu_model) =20 +#define M68K_CPU_TYPE_SUFFIX "-" TYPE_M68K_CPU +#define M68K_CPU_TYPE_NAME(model) model M68K_CPU_TYPE_SUFFIX + #define cpu_signal_handler cpu_m68k_signal_handler #define cpu_list m68k_cpu_list =20 diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 8c70e08..f0f90e9 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -87,7 +87,7 @@ static ObjectClass *m68k_cpu_class_by_name(const char *cp= u_model) ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_M68K_CPU, cpu_model); + typename =3D g_strdup_printf(M68K_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && (object_class_dynamic_cast(oc, TYPE_M68K_CPU) =3D= =3D NULL || @@ -202,23 +202,6 @@ static void any_cpu_initfn(Object *obj) m68k_set_feature(env, M68K_FEATURE_WORD_INDEX); } =20 -typedef struct M68kCPUInfo { - const char *name; - void (*instance_init)(Object *obj); -} M68kCPUInfo; - -static const M68kCPUInfo m68k_cpus[] =3D { - { .name =3D "m68000", .instance_init =3D m68000_cpu_initfn }, - { .name =3D "m68020", .instance_init =3D m68020_cpu_initfn }, - { .name =3D "m68030", .instance_init =3D m68030_cpu_initfn }, - { .name =3D "m68040", .instance_init =3D m68040_cpu_initfn }, - { .name =3D "m68060", .instance_init =3D m68060_cpu_initfn }, - { .name =3D "m5206", .instance_init =3D m5206_cpu_initfn }, - { .name =3D "m5208", .instance_init =3D m5208_cpu_initfn }, - { .name =3D "cfv4e", .instance_init =3D cfv4e_cpu_initfn }, - { .name =3D "any", .instance_init =3D any_cpu_initfn }, -}; - static void m68k_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs =3D CPU(dev); @@ -295,36 +278,32 @@ static void m68k_cpu_class_init(ObjectClass *c, void = *data) dc->vmsd =3D &vmstate_m68k_cpu; } =20 -static void register_cpu_type(const M68kCPUInfo *info) -{ - TypeInfo type_info =3D { - .parent =3D TYPE_M68K_CPU, - .instance_init =3D info->instance_init, - }; - - type_info.name =3D g_strdup_printf("%s-" TYPE_M68K_CPU, info->name); - type_register(&type_info); - g_free((void *)type_info.name); -} +#define DEFINE_M68K_CPU_TYPE(cpu_model, initfn) \ + { \ + .name =3D M68K_CPU_TYPE_NAME(cpu_model), \ + .instance_init =3D initfn, \ + .parent =3D TYPE_M68K_CPU, \ + } =20 -static const TypeInfo m68k_cpu_type_info =3D { - .name =3D TYPE_M68K_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(M68kCPU), - .instance_init =3D m68k_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(M68kCPUClass), - .class_init =3D m68k_cpu_class_init, +static const TypeInfo m68k_cpus_type_infos[] =3D { + { /* base class should be registered first */ + .name =3D TYPE_M68K_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(M68kCPU), + .instance_init =3D m68k_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(M68kCPUClass), + .class_init =3D m68k_cpu_class_init, + }, + DEFINE_M68K_CPU_TYPE("m68000", m68000_cpu_initfn), + DEFINE_M68K_CPU_TYPE("m68020", m68020_cpu_initfn), + DEFINE_M68K_CPU_TYPE("m68030", m68030_cpu_initfn), + DEFINE_M68K_CPU_TYPE("m68040", m68040_cpu_initfn), + DEFINE_M68K_CPU_TYPE("m68060", m68060_cpu_initfn), + DEFINE_M68K_CPU_TYPE("m5206", m5206_cpu_initfn), + DEFINE_M68K_CPU_TYPE("m5208", m5208_cpu_initfn), + DEFINE_M68K_CPU_TYPE("cfv4e", cfv4e_cpu_initfn), + DEFINE_M68K_CPU_TYPE("any", any_cpu_initfn), }; =20 -static void m68k_cpu_register_types(void) -{ - int i; - - type_register_static(&m68k_cpu_type_info); - for (i =3D 0; i < ARRAY_SIZE(m68k_cpus); i++) { - register_cpu_type(&m68k_cpus[i]); - } -} - -type_init(m68k_cpu_register_types) +type_init_from_array(m68k_cpus_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935591805546.3295783207094; Mon, 2 Oct 2017 02:13:11 -0700 (PDT) Received: from localhost ([::1]:51278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywmk-0005mc-VD for importer@patchew.org; Mon, 02 Oct 2017 05:13:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiM-00023a-9x for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiJ-00064L-I0 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42022) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiJ-00063n-D1 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A4E04ACCB; Mon, 2 Oct 2017 09:08:34 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C5F460621; Mon, 2 Oct 2017 09:08:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5A4E04ACCB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:52 +0200 Message-Id: <1506935300-132598-11-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 02 Oct 2017 09:08:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 10/38] m68k: an5206: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huth@tuxfamily.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Acked-by: Thomas Huth Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: huth@tuxfamily.org CC: laurent@vivier.eu --- hw/m68k/an5206.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index 9002c46..0cedc54 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -28,7 +28,6 @@ static void an5206_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; M68kCPU *cpu; CPUM68KState *env; @@ -39,10 +38,7 @@ static void an5206_init(MachineState *machine) MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 - if (!cpu_model) { - cpu_model =3D "m5206"; - } - cpu =3D M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model)); + cpu =3D M68K_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 /* Initialize CPU registers. */ @@ -94,6 +90,7 @@ static void an5206_machine_init(MachineClass *mc) { mc->desc =3D "Arnewsh 5206"; mc->init =3D an5206_init; + mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m5206"); } =20 DEFINE_MACHINE("an5206", an5206_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935755508999.6401513966957; Mon, 2 Oct 2017 02:15:55 -0700 (PDT) Received: from localhost ([::1]:51292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywpC-0008Dc-F6 for importer@patchew.org; Mon, 02 Oct 2017 05:15:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiM-00023Z-9n for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiK-00064w-MW for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44332) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiK-00064U-Gi for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1BA081E0B; Mon, 2 Oct 2017 09:08:35 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A384F6062E; Mon, 2 Oct 2017 09:08:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A1BA081E0B Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:53 +0200 Message-Id: <1506935300-132598-12-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 02 Oct 2017 09:08:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 11/38] m68k: mcf5208: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huth@tuxfamily.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Acked-by: Thomas Huth Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: laurent@vivier.eu CC: huth@tuxfamily.org --- hw/m68k/mcf5208.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index b9dde75..cfac845 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -217,7 +217,6 @@ static void mcf_fec_init(MemoryRegion *sysmem, NICInfo = *nd, hwaddr base, static void mcf5208evb_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; M68kCPU *cpu; CPUM68KState *env; @@ -229,10 +228,7 @@ static void mcf5208evb_init(MachineState *machine) MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 - if (!cpu_model) { - cpu_model =3D "m5208"; - } - cpu =3D M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model)); + cpu =3D M68K_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 /* Initialize CPU registers. */ @@ -321,6 +317,7 @@ static void mcf5208evb_machine_init(MachineClass *mc) mc->desc =3D "MCF5206EVB"; mc->init =3D mcf5208evb_init; mc->is_default =3D 1; + mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m5208"); } =20 DEFINE_MACHINE("mcf5208evb", mcf5208evb_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935917801757.233536070898; Mon, 2 Oct 2017 02:18:37 -0700 (PDT) Received: from localhost ([::1]:51300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywrv-00021e-Rd for importer@patchew.org; Mon, 02 Oct 2017 05:18:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiR-00029H-PT for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiL-00065a-SW for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57692) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiL-00065A-Ms for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CFFC585550; Mon, 2 Oct 2017 09:08:36 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id EACDE60621; Mon, 2 Oct 2017 09:08:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CFFC585550 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:54 +0200 Message-Id: <1506935300-132598-13-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 02 Oct 2017 09:08:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 12/38] moxie: fix qemu-system-moxie failing to start with CLI "-cpu MoxieLite" X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: green@moxielogic.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It 'works' with default CPU only because of bug in moxie_cpu_class_by_name() where it treats cpu_model as type name and default cpu_model also happens to be type name. But specifying explicitly cpu on CLI, ex: '-cpu MoxieLite', makes QEMU fail since moxie_cpu_class_by_name() doesn't traslate cpu_model to cpu type and fails to find corresponding object class. Fix moxie_cpu_class_by_name() to do proper cpu_model -> cpu type translation and fix default cpu_model to be cpu_model instead of being typename. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: green@moxielogic.com --- hw/moxie/moxiesim.c | 2 +- target/moxie/cpu.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index 5ea8dd3..01b9f34 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -116,7 +116,7 @@ static void moxiesim_init(MachineState *machine) =20 /* Init CPUs. */ if (cpu_model =3D=3D NULL) { - cpu_model =3D "MoxieLite-moxie-cpu"; + cpu_model =3D "MoxieLite"; } cpu =3D MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, cpu_model)); env =3D &cpu->env; diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index 30bd44f..d4626a1 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -89,7 +89,12 @@ static void moxie_cpu_initfn(Object *obj) =20 static ObjectClass *moxie_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc =3D object_class_by_name(cpu_model); + ObjectClass *oc; + char *typename; + + typename =3D g_strdup_printf("%s-" TYPE_MOXIE_CPU, cpu_model); + oc =3D object_class_by_name(typename); + g_free(typename); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_MOXIE_CPU) || object_class_is_abstract(oc))) { return NULL; --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936082597761.8022475881903; Mon, 2 Oct 2017 02:21:22 -0700 (PDT) Received: from localhost ([::1]:51312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywuZ-0004D5-5h for importer@patchew.org; Mon, 02 Oct 2017 05:21:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiO-00025X-3G for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiN-00066V-3y for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46048) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiM-00065u-RH for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE260C0587E9; Mon, 2 Oct 2017 09:08:37 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 246B95C6C5; Mon, 2 Oct 2017 09:08:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EE260C0587E9 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:55 +0200 Message-Id: <1506935300-132598-14-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 09:08:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 13/38] moxie: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: green@moxielogic.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" introduce MOXIE_CPU_TYPE_NAME macro and consistently use it to construct cpu type names. While at it replace dynamic cpu type name composition with static data. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: green@moxielogic.com --- target/moxie/cpu.h | 3 +++ target/moxie/cpu.c | 56 +++++++++++++++++---------------------------------= ---- 2 files changed, 20 insertions(+), 39 deletions(-) diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h index 75decaa..d37e6a5 100644 --- a/target/moxie/cpu.h +++ b/target/moxie/cpu.h @@ -122,6 +122,9 @@ int cpu_moxie_signal_handler(int host_signum, void *pin= fo, =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_MOXIE_CPU, cpu_model) =20 +#define MOXIE_CPU_TYPE_SUFFIX "-" TYPE_MOXIE_CPU +#define MOXIE_CPU_TYPE_NAME(model) model MOXIE_CPU_TYPE_SUFFIX + #define cpu_signal_handler cpu_moxie_signal_handler =20 static inline int cpu_mmu_index(CPUMoxieState *env, bool ifetch) diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index d4626a1..1ca8f1a 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -92,7 +92,7 @@ static ObjectClass *moxie_cpu_class_by_name(const char *c= pu_model) ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_MOXIE_CPU, cpu_model); + typename =3D g_strdup_printf(MOXIE_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_MOXIE_CPU) || @@ -139,46 +139,24 @@ static void moxie_any_initfn(Object *obj) /* Set cpu feature flags */ } =20 -typedef struct MoxieCPUInfo { - const char *name; - void (*initfn)(Object *obj); -} MoxieCPUInfo; - -static const MoxieCPUInfo moxie_cpus[] =3D { - { .name =3D "MoxieLite", .initfn =3D moxielite_initfn }, - { .name =3D "any", .initfn =3D moxie_any_initfn }, -}; +#define DEFINE_MOXIE_CPU_TYPE(cpu_model, initfn) \ + { \ + .parent =3D TYPE_MOXIE_CPU, \ + .instance_init =3D initfn, \ + .name =3D MOXIE_CPU_TYPE_NAME(cpu_model), \ + } =20 -static void cpu_register(const MoxieCPUInfo *info) -{ - TypeInfo type_info =3D { - .parent =3D TYPE_MOXIE_CPU, +static const TypeInfo moxie_cpus_type_infos[] =3D { + { /* base class should be registered first */ + .name =3D TYPE_MOXIE_CPU, + .parent =3D TYPE_CPU, .instance_size =3D sizeof(MoxieCPU), - .instance_init =3D info->initfn, + .instance_init =3D moxie_cpu_initfn, .class_size =3D sizeof(MoxieCPUClass), - }; - - type_info.name =3D g_strdup_printf("%s-" TYPE_MOXIE_CPU, info->name); - type_register(&type_info); - g_free((void *)type_info.name); -} - -static const TypeInfo moxie_cpu_type_info =3D { - .name =3D TYPE_MOXIE_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(MoxieCPU), - .instance_init =3D moxie_cpu_initfn, - .class_size =3D sizeof(MoxieCPUClass), - .class_init =3D moxie_cpu_class_init, + .class_init =3D moxie_cpu_class_init, + }, + DEFINE_MOXIE_CPU_TYPE("MoxieLite", moxielite_initfn), + DEFINE_MOXIE_CPU_TYPE("any", moxie_any_initfn), }; =20 -static void moxie_cpu_register_types(void) -{ - int i; - type_register_static(&moxie_cpu_type_info); - for (i =3D 0; i < ARRAY_SIZE(moxie_cpus); i++) { - cpu_register(&moxie_cpus[i]); - } -} - -type_init(moxie_cpu_register_types) +type_init_from_array(moxie_cpus_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935750505454.32229654156686; Mon, 2 Oct 2017 02:15:50 -0700 (PDT) Received: from localhost ([::1]:51290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywp9-0008C1-MU for importer@patchew.org; Mon, 02 Oct 2017 05:15:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiO-00026L-Su for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiO-00067F-3r for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiN-00066o-Tw for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 182B4C04AC57; Mon, 2 Oct 2017 09:08:39 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4253A60A9D; Mon, 2 Oct 2017 09:08:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 182B4C04AC57 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:56 +0200 Message-Id: <1506935300-132598-15-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Oct 2017 09:08:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 14/38] moxie: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: green@moxielogic.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: green@moxielogic.com --- hw/moxie/moxiesim.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index 01b9f34..3ba5848 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -103,7 +103,6 @@ static void moxiesim_init(MachineState *machine) { MoxieCPU *cpu =3D NULL; ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -115,10 +114,7 @@ static void moxiesim_init(MachineState *machine) LoaderParams loader_params; =20 /* Init CPUs. */ - if (cpu_model =3D=3D NULL) { - cpu_model =3D "MoxieLite"; - } - cpu =3D MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, cpu_model)); + cpu =3D MOXIE_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 qemu_register_reset(main_cpu_reset, cpu); @@ -150,6 +146,7 @@ static void moxiesim_machine_init(MachineClass *mc) mc->desc =3D "Moxie simulator platform"; mc->init =3D moxiesim_init; mc->is_default =3D 1; + mc->default_cpu_type =3D MOXIE_CPU_TYPE_NAME("MoxieLite"); } =20 DEFINE_MACHINE("moxiesim", moxiesim_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936247965467.1397286229169; Mon, 2 Oct 2017 02:24:07 -0700 (PDT) Received: from localhost ([::1]:51326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywxI-000701-66 for importer@patchew.org; Mon, 02 Oct 2017 05:24:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiV-0002Co-Mx for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiP-00067p-BL for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiP-00067S-2K for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38763356D7; Mon, 2 Oct 2017 09:08:40 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6131D60A9D; Mon, 2 Oct 2017 09:08:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 38763356D7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:57 +0200 Message-Id: <1506935300-132598-16-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Oct 2017 09:08:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 15/38] openrisc: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shorne@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" use new OPENRISC_CPU_TYPE_NAME to compose CPU type name and get rid of intermediate OpenRISCCPUInfo/openrisc_cpu_register_types() which is replaced by static TypeInfo array. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: shorne@gmail.com --- target/openrisc/cpu.h | 3 +++ target/openrisc/cpu.c | 69 +++++++++++++++++------------------------------= ---- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index f51b89a..576cf66 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -390,6 +390,9 @@ int cpu_openrisc_get_phys_data(OpenRISCCPU *cpu, =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_OPENRISC_CPU, cpu_model) =20 +#define OPENRISC_CPU_TYPE_SUFFIX "-" TYPE_OPENRISC_CPU +#define OPENRISC_CPU_TYPE_NAME(model) model OPENRISC_CPU_TYPE_SUFFIX + #include "exec/cpu-all.h" =20 #define TB_FLAGS_DFLAG 1 diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index af9cdcc..4dfb777 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -108,7 +108,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const ch= ar *cpu_model) ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model); + typename =3D g_strdup_printf(OPENRISC_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU)= || @@ -133,16 +133,6 @@ static void openrisc_any_initfn(Object *obj) cpu->env.cpucfgr =3D CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_EVBARP; } =20 -typedef struct OpenRISCCPUInfo { - const char *name; - void (*initfn)(Object *obj); -} OpenRISCCPUInfo; - -static const OpenRISCCPUInfo openrisc_cpus[] =3D { - { .name =3D "or1200", .initfn =3D or1200_initfn }, - { .name =3D "any", .initfn =3D openrisc_any_initfn }, -}; - static void openrisc_cpu_class_init(ObjectClass *oc, void *data) { OpenRISCCPUClass *occ =3D OPENRISC_CPU_CLASS(oc); @@ -172,40 +162,6 @@ static void openrisc_cpu_class_init(ObjectClass *oc, v= oid *data) cc->gdb_num_core_regs =3D 32 + 3; } =20 -static void cpu_register(const OpenRISCCPUInfo *info) -{ - TypeInfo type_info =3D { - .parent =3D TYPE_OPENRISC_CPU, - .instance_size =3D sizeof(OpenRISCCPU), - .instance_init =3D info->initfn, - .class_size =3D sizeof(OpenRISCCPUClass), - }; - - type_info.name =3D g_strdup_printf("%s-" TYPE_OPENRISC_CPU, info->name= ); - type_register(&type_info); - g_free((void *)type_info.name); -} - -static const TypeInfo openrisc_cpu_type_info =3D { - .name =3D TYPE_OPENRISC_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(OpenRISCCPU), - .instance_init =3D openrisc_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(OpenRISCCPUClass), - .class_init =3D openrisc_cpu_class_init, -}; - -static void openrisc_cpu_register_types(void) -{ - int i; - - type_register_static(&openrisc_cpu_type_info); - for (i =3D 0; i < ARRAY_SIZE(openrisc_cpus); i++) { - cpu_register(&openrisc_cpus[i]); - } -} - /* Sort alphabetically by type name, except for "any". */ static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b) { @@ -254,4 +210,25 @@ void cpu_openrisc_list(FILE *f, fprintf_function cpu_f= printf) g_slist_free(list); } =20 -type_init(openrisc_cpu_register_types) +#define DEFINE_OPENRISC_CPU_TYPE(cpu_model, initfn) \ + { \ + .parent =3D TYPE_OPENRISC_CPU, \ + .instance_init =3D initfn, \ + .name =3D OPENRISC_CPU_TYPE_NAME(cpu_model), \ + } + +static const TypeInfo openrisc_cpus_type_infos[] =3D { + { /* base class should be registered first */ + .name =3D TYPE_OPENRISC_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(OpenRISCCPU), + .instance_init =3D openrisc_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(OpenRISCCPUClass), + .class_init =3D openrisc_cpu_class_init, + }, + DEFINE_OPENRISC_CPU_TYPE("or1200", or1200_initfn), + DEFINE_OPENRISC_CPU_TYPE("any", openrisc_any_initfn), +}; + +type_init_from_array(openrisc_cpus_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935753846310.0091889415162; Mon, 2 Oct 2017 02:15:53 -0700 (PDT) Received: from localhost ([::1]:51293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywpG-0008IB-V7 for importer@patchew.org; Mon, 02 Oct 2017 05:15:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiR-00028o-8C for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiQ-000689-DC for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiQ-00067x-73 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56E65356D7; Mon, 2 Oct 2017 09:08:41 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80E8260A9D; Mon, 2 Oct 2017 09:08:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 56E65356D7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:58 +0200 Message-Id: <1506935300-132598-17-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Oct 2017 09:08:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 16/38] openrisc: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shorne@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: shorne@gmail.com --- hw/openrisc/openrisc_sim.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index 86bf284..f61b63d 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -98,18 +98,13 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_siz= e, static void openrisc_sim_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; OpenRISCCPU *cpu =3D NULL; MemoryRegion *ram; int n; =20 - if (!cpu_model) { - cpu_model =3D "or1200"; - } - for (n =3D 0; n < smp_cpus; n++) { - cpu =3D OPENRISC_CPU(cpu_generic_init(TYPE_OPENRISC_CPU, cpu_model= )); + cpu =3D OPENRISC_CPU(cpu_create(machine->cpu_type)); qemu_register_reset(main_cpu_reset, cpu); main_cpu_reset(cpu); } @@ -138,6 +133,7 @@ static void openrisc_sim_machine_init(MachineClass *mc) mc->init =3D openrisc_sim_init; mc->max_cpus =3D 1; mc->is_default =3D 1; + mc->default_cpu_type =3D OPENRISC_CPU_TYPE_NAME("or1200"); } =20 DEFINE_MACHINE("or1k-sim", openrisc_sim_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936242310846.5595301080741; Mon, 2 Oct 2017 02:24:02 -0700 (PDT) Received: from localhost ([::1]:51323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywxA-0006t3-CT for importer@patchew.org; Mon, 02 Oct 2017 05:23:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiW-0002DA-16 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiR-00068o-W7 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiR-00068O-QF for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C736E81E0D; Mon, 2 Oct 2017 09:08:42 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FB5560A9D; Mon, 2 Oct 2017 09:08:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C736E81E0D Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:07:59 +0200 Message-Id: <1506935300-132598-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 02 Oct 2017 09:08:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 17/38] sh4: r2d: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Magnus Damm , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: Magnus Damm CC: Aurelien Jarno --- hw/sh4/r2d.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 16b9ed2..458ed83 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -225,7 +225,6 @@ static struct QEMU_PACKED =20 static void r2d_init(MachineState *machine) { - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -242,11 +241,7 @@ static void r2d_init(MachineState *machine) MemoryRegion *address_space_mem =3D get_system_memory(); PCIBus *pci_bus; =20 - if (cpu_model =3D=3D NULL) { - cpu_model =3D "SH7751R"; - } - - cpu =3D SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model)); + cpu =3D SUPERH_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 reset_info =3D g_malloc0(sizeof(ResetData)); @@ -365,6 +360,7 @@ static void r2d_machine_init(MachineClass *mc) mc->desc =3D "r2d-plus board"; mc->init =3D r2d_init; mc->block_default_type =3D IF_IDE; + mc->default_cpu_type =3D TYPE_SH7751R_CPU; } =20 DEFINE_MACHINE("r2d", r2d_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506935930163666.1796613376766; Mon, 2 Oct 2017 02:18:50 -0700 (PDT) Received: from localhost ([::1]:51301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywrx-00022m-JH for importer@patchew.org; Mon, 02 Oct 2017 05:18:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiW-0002DC-14 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiT-00069C-A0 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48764) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiT-00068y-3X for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C10737EEF; Mon, 2 Oct 2017 09:08:44 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ABC560621; Mon, 2 Oct 2017 09:08:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1C10737EEF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:00 +0200 Message-Id: <1506935300-132598-19-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 02 Oct 2017 09:08:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 18/38] sh4: shix: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Magnus Damm , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Acked-by: Philippe Mathieu-Daud=C3=A9 --- CC: Magnus Damm CC: Aurelien Jarno --- hw/sh4/shix.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c index 50ee36a..4add230 100644 --- a/hw/sh4/shix.c +++ b/hw/sh4/shix.c @@ -45,7 +45,6 @@ =20 static void shix_init(MachineState *machine) { - const char *cpu_model =3D machine->cpu_model; int ret; SuperHCPU *cpu; struct SH7750State *s; @@ -53,10 +52,7 @@ static void shix_init(MachineState *machine) MemoryRegion *rom =3D g_new(MemoryRegion, 1); MemoryRegion *sdram =3D g_new(MemoryRegion, 2); =20 - if (!cpu_model) - cpu_model =3D "any"; - - cpu =3D SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model)); + cpu =3D SUPERH_CPU(cpu_create(machine->cpu_type)); =20 /* Allocate memory space */ memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); @@ -89,6 +85,7 @@ static void shix_machine_init(MachineClass *mc) mc->desc =3D "shix card"; mc->init =3D shix_init; mc->is_default =3D 1; + mc->default_cpu_type =3D TYPE_SH7750R_CPU; } =20 DEFINE_MACHINE("shix", shix_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936089939952.3621689757753; Mon, 2 Oct 2017 02:21:29 -0700 (PDT) Received: from localhost ([::1]:51313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywub-0004Dg-6h for importer@patchew.org; Mon, 02 Oct 2017 05:21:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiW-0002DD-1B for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiU-00069e-CV for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiU-00069L-3m for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A99D820E1; Mon, 2 Oct 2017 09:08:45 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6326760A9D; Mon, 2 Oct 2017 09:08:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A99D820E1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:01 +0200 Message-Id: <1506935300-132598-20-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 02 Oct 2017 09:08:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 19/38] sh4: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" introduce SUPERH_CPU_TYPE_NAME macro and use it to construct cpu type names. While at it move cpu type_infos into one array and register it directly with type_init_from_array() instead of custom superh_cpu_register_types() Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: aurelien@aurel32.net --- target/sh4/cpu-qom.h | 6 ++--- target/sh4/cpu.h | 3 +++ target/sh4/cpu.c | 63 +++++++++++++++++++++---------------------------= ---- 3 files changed, 31 insertions(+), 41 deletions(-) diff --git a/target/sh4/cpu-qom.h b/target/sh4/cpu-qom.h index 01abb20..17deeb6 100644 --- a/target/sh4/cpu-qom.h +++ b/target/sh4/cpu-qom.h @@ -24,9 +24,9 @@ =20 #define TYPE_SUPERH_CPU "superh-cpu" =20 -#define TYPE_SH7750R_CPU "sh7750r-" TYPE_SUPERH_CPU -#define TYPE_SH7751R_CPU "sh7751r-" TYPE_SUPERH_CPU -#define TYPE_SH7785_CPU "sh7785-" TYPE_SUPERH_CPU +#define TYPE_SH7750R_CPU SUPERH_CPU_TYPE_NAME("sh7750r") +#define TYPE_SH7751R_CPU SUPERH_CPU_TYPE_NAME("sh7751r") +#define TYPE_SH7785_CPU SUPERH_CPU_TYPE_NAME("sh7785") =20 #define SUPERH_CPU_CLASS(klass) \ OBJECT_CLASS_CHECK(SuperHCPUClass, (klass), TYPE_SUPERH_CPU) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 79f85d3..a25a3f6 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -270,6 +270,9 @@ void cpu_load_tlb(CPUSH4State * env); =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_SUPERH_CPU, cpu_model) =20 +#define SUPERH_CPU_TYPE_SUFFIX "-" TYPE_SUPERH_CPU +#define SUPERH_CPU_TYPE_NAME(model) model SUPERH_CPU_TYPE_SUFFIX + #define cpu_signal_handler cpu_sh4_signal_handler #define cpu_list sh4_cpu_list =20 diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 252440e..9198460 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -172,13 +172,6 @@ static void sh7750r_class_init(ObjectClass *oc, void *= data) scc->cvr =3D 0x00110000; } =20 -static const TypeInfo sh7750r_type_info =3D { - .name =3D TYPE_SH7750R_CPU, - .parent =3D TYPE_SUPERH_CPU, - .class_init =3D sh7750r_class_init, - .instance_init =3D sh7750r_cpu_initfn, -}; - static void sh7751r_cpu_initfn(Object *obj) { SuperHCPU *cpu =3D SUPERH_CPU(obj); @@ -198,13 +191,6 @@ static void sh7751r_class_init(ObjectClass *oc, void *= data) scc->cvr =3D 0x00110000; /* Neutered caches, should be 0x20480000 */ } =20 -static const TypeInfo sh7751r_type_info =3D { - .name =3D TYPE_SH7751R_CPU, - .parent =3D TYPE_SUPERH_CPU, - .class_init =3D sh7751r_class_init, - .instance_init =3D sh7751r_cpu_initfn, -}; - static void sh7785_cpu_initfn(Object *obj) { SuperHCPU *cpu =3D SUPERH_CPU(obj); @@ -224,13 +210,6 @@ static void sh7785_class_init(ObjectClass *oc, void *d= ata) scc->cvr =3D 0x71440211; } =20 -static const TypeInfo sh7785_type_info =3D { - .name =3D TYPE_SH7785_CPU, - .parent =3D TYPE_SUPERH_CPU, - .class_init =3D sh7785_class_init, - .instance_init =3D sh7785_cpu_initfn, -}; - static void superh_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs =3D CPU(dev); @@ -303,22 +282,30 @@ static void superh_cpu_class_init(ObjectClass *oc, vo= id *data) dc->vmsd =3D &vmstate_sh_cpu; } =20 -static const TypeInfo superh_cpu_type_info =3D { - .name =3D TYPE_SUPERH_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(SuperHCPU), - .instance_init =3D superh_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(SuperHCPUClass), - .class_init =3D superh_cpu_class_init, -}; +#define DEFINE_SUPERH_CPU_TYPE(type_name, cinit, initfn) \ + { \ + .name =3D type_name, \ + .parent =3D TYPE_SUPERH_CPU, \ + .class_init =3D cinit, \ + .instance_init =3D initfn, \ + } +static const TypeInfo superh_cpu_type_infos[] =3D { + { + .name =3D TYPE_SUPERH_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(SuperHCPU), + .instance_init =3D superh_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(SuperHCPUClass), + .class_init =3D superh_cpu_class_init, + }, + DEFINE_SUPERH_CPU_TYPE(TYPE_SH7750R_CPU, sh7750r_class_init, + sh7750r_cpu_initfn), + DEFINE_SUPERH_CPU_TYPE(TYPE_SH7751R_CPU, sh7751r_class_init, + sh7751r_cpu_initfn), + DEFINE_SUPERH_CPU_TYPE(TYPE_SH7785_CPU, sh7785_class_init, + sh7785_cpu_initfn), =20 -static void superh_cpu_register_types(void) -{ - type_register_static(&superh_cpu_type_info); - type_register_static(&sh7750r_type_info); - type_register_static(&sh7751r_type_info); - type_register_static(&sh7785_type_info); -} +}; =20 -type_init(superh_cpu_register_types) +type_init_from_array(superh_cpu_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936087409842.9155373930136; Mon, 2 Oct 2017 02:21:27 -0700 (PDT) Received: from localhost ([::1]:51315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywuh-0004IY-Hh for importer@patchew.org; Mon, 02 Oct 2017 05:21:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiW-0002Db-Ew for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiV-0006A4-DO for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46360) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiV-00069m-7A for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 588A2C0587E3; Mon, 2 Oct 2017 09:08:46 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8266660A9D; Mon, 2 Oct 2017 09:08:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 588A2C0587E3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:02 +0200 Message-Id: <1506935300-132598-21-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 09:08:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 20/38] sh4: simplify superh_cpu_class_by_name() X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" currently for sh4 cpu_model argument for '-cpu' option could be either 'cpu model' name or cpu_typename. however typically '-cpu' takes 'cpu model' name and cpu type for sh4 target isn't advertised publicly ('-cpu help' prints only 'cpu model' names) so we shouldn't care about this use case (it's more of a bug). 1. Drop '-cpu cpu_typename' to align with the rest of targets. 2. Compose searched for typename from cpu model and use it with object_class_by_name() directly instead of over-complicated object_class_get_list() g_slist_find_custom() + superh_cpu_name_compare() With #1 droped, #2 could be used for both lookups which simplifies superh_cpu_class_by_name() quite a bit. Signed-off-by: Igor Mammedov Acked-by: Philippe Mathieu-Daud=C3=A9 --- CC: aurelien@aurel32.net --- target/sh4/cpu.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 9198460..b71ff01 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -120,36 +120,26 @@ void sh4_cpu_list(FILE *f, fprintf_function cpu_fprin= tf) g_slist_free(list); } =20 -static gint superh_cpu_name_compare(gconstpointer a, gconstpointer b) -{ - const SuperHCPUClass *scc =3D SUPERH_CPU_CLASS(a); - const char *name =3D b; - - return strcasecmp(scc->name, name); -} - static ObjectClass *superh_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc; - GSList *list, *item; + ObjectClass *oc =3D NULL;; + char *s, *typename =3D NULL; =20 - if (strcasecmp(cpu_model, "any") =3D=3D 0) { - return object_class_by_name(TYPE_SH7750R_CPU); + s =3D g_ascii_strdown(cpu_model, -1); + if (strcmp(s, "any") =3D=3D 0) { + oc =3D object_class_by_name(TYPE_SH7750R_CPU); + goto out; } =20 - oc =3D object_class_by_name(cpu_model); - if (oc !=3D NULL && object_class_dynamic_cast(oc, TYPE_SUPERH_CPU) != =3D NULL - && !object_class_is_abstract(oc)) { - return oc; + typename =3D g_strdup_printf(SUPERH_CPU_TYPE_NAME("%s"), s); + oc =3D object_class_by_name(typename); + if (oc !=3D NULL && object_class_is_abstract(oc)) { + oc =3D NULL; } =20 - oc =3D NULL; - list =3D object_class_get_list(TYPE_SUPERH_CPU, false); - item =3D g_slist_find_custom(list, cpu_model, superh_cpu_name_compare); - if (item !=3D NULL) { - oc =3D item->data; - } - g_slist_free(list); +out: + g_free(s); + g_free(typename); return oc; } =20 --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936245464719.5671520641677; Mon, 2 Oct 2017 02:24:05 -0700 (PDT) Received: from localhost ([::1]:51324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywxD-0006wH-Ng for importer@patchew.org; Mon, 02 Oct 2017 05:23:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywic-0002Iu-O8 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiW-0006As-Pm for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48886) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiW-0006AF-GN for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 795C9461F9; Mon, 2 Oct 2017 09:08:47 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A182060A9D; Mon, 2 Oct 2017 09:08:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 795C9461F9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:03 +0200 Message-Id: <1506935300-132598-22-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 02 Oct 2017 09:08:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 21/38] sh4: remove SuperHCPUClass::name field X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" the field contains upper-cased cpu model name and is used for printing supported cpu model names for '-cpu help'. Considering that cpu model lookup in superh_cpu_class_by_name() is case-insensitive, we can drop upper-casing when printing supported cpus list and use cpu type directly to do the same by cutting out SUPERH_CPU_TYPE_SUFFIX from typename. It allows to remove SuperHCPUClass::name, which practically duplicates names defined by TYPE_SH*_CPU definitions and simplify sh*_class_init()/SuperHCPUClass a bit. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: aurelien@aurel32.net --- target/sh4/cpu-qom.h | 2 -- target/sh4/cpu.c | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/target/sh4/cpu-qom.h b/target/sh4/cpu-qom.h index 17deeb6..0f9fb4d 100644 --- a/target/sh4/cpu-qom.h +++ b/target/sh4/cpu-qom.h @@ -39,7 +39,6 @@ * SuperHCPUClass: * @parent_realize: The parent class' realize handler. * @parent_reset: The parent class' reset handler. - * @name: The name. * @pvr: Processor Version Register * @prr: Processor Revision Register * @cvr: Cache Version Register @@ -54,7 +53,6 @@ typedef struct SuperHCPUClass { DeviceRealize parent_realize; void (*parent_reset)(CPUState *cpu); =20 - const char *name; uint32_t pvr; uint32_t prr; uint32_t cvr; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index b71ff01..8dfbdeb 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -98,12 +98,11 @@ static gint superh_cpu_list_compare(gconstpointer a, gc= onstpointer b) =20 static void superh_cpu_list_entry(gpointer data, gpointer user_data) { - ObjectClass *oc =3D data; - SuperHCPUClass *scc =3D SUPERH_CPU_CLASS(oc); SuperHCPUListState *s =3D user_data; + const char *typename =3D object_class_get_name(OBJECT_CLASS(data)); + int len =3D strlen(typename) - strlen(SUPERH_CPU_TYPE_SUFFIX); =20 - (*s->cpu_fprintf)(s->file, "%s\n", - scc->name); + (*s->cpu_fprintf)(s->file, "%.*s\n", len, typename); } =20 void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf) @@ -156,7 +155,6 @@ static void sh7750r_class_init(ObjectClass *oc, void *d= ata) { SuperHCPUClass *scc =3D SUPERH_CPU_CLASS(oc); =20 - scc->name =3D "SH7750R"; scc->pvr =3D 0x00050000; scc->prr =3D 0x00000100; scc->cvr =3D 0x00110000; @@ -175,7 +173,6 @@ static void sh7751r_class_init(ObjectClass *oc, void *d= ata) { SuperHCPUClass *scc =3D SUPERH_CPU_CLASS(oc); =20 - scc->name =3D "SH7751R"; scc->pvr =3D 0x04050005; scc->prr =3D 0x00000113; scc->cvr =3D 0x00110000; /* Neutered caches, should be 0x20480000 */ @@ -194,7 +191,6 @@ static void sh7785_class_init(ObjectClass *oc, void *da= ta) { SuperHCPUClass *scc =3D SUPERH_CPU_CLASS(oc); =20 - scc->name =3D "SH7785"; scc->pvr =3D 0x10300700; scc->prr =3D 0x00000200; scc->cvr =3D 0x71440211; --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936401210565.660732569019; Mon, 2 Oct 2017 02:26:41 -0700 (PDT) Received: from localhost ([::1]:51338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywzc-0000fv-PT for importer@patchew.org; Mon, 02 Oct 2017 05:26:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywib-0002GH-16 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiX-0006BL-MD for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40820) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiX-0006Ay-G4 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C618C04AC53; Mon, 2 Oct 2017 09:08:48 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2B7660A9D; Mon, 2 Oct 2017 09:08:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9C618C04AC53 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:04 +0200 Message-Id: <1506935300-132598-23-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Oct 2017 09:08:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 22/38] xtensa: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcmvbkbc@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" use new XTENSA_CPU_TYPE_NAME to compose CPU type name to bring xtensa in line with all other targets that will similar macro. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: jcmvbkbc@gmail.com --- target/xtensa/cpu.h | 4 ++++ target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 4803331..b17d7d9 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -469,11 +469,15 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, va= ddr addr, #define cpu_signal_handler cpu_xtensa_signal_handler #define cpu_list xtensa_cpu_list =20 +#define XTENSA_CPU_TYPE_SUFFIX "-" TYPE_XTENSA_CPU +#define XTENSA_CPU_TYPE_NAME(model) model XTENSA_CPU_TYPE_SUFFIX + #ifdef TARGET_WORDS_BIGENDIAN #define XTENSA_DEFAULT_CPU_MODEL "fsf" #else #define XTENSA_DEFAULT_CPU_MODEL "dc232b" #endif +#define XTENSA_DEFAULT_CPU_TYPE XTENSA_CPU_TYPE_NAME(XTENSA_DEFAULT_CPU_MO= DEL) =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_XTENSA_CPU, cpu_model) =20 diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index dcdc765..b5f7079 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -83,7 +83,7 @@ static ObjectClass *xtensa_cpu_class_by_name(const char *= cpu_model) ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_XTENSA_CPU, cpu_model); + typename =3D g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc =3D=3D NULL || !object_class_dynamic_cast(oc, TYPE_XTENSA_CPU) = || diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index e8fba20..216f198 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -76,7 +76,7 @@ void xtensa_register_core(XtensaConfigList *node) =20 node->next =3D xtensa_cores; xtensa_cores =3D node; - type.name =3D g_strdup_printf("%s-" TYPE_XTENSA_CPU, node->config->nam= e); + type.name =3D g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), node->config= ->name); type_register(&type); g_free((gpointer)type.name); } --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936403139504.70966572378654; Mon, 2 Oct 2017 02:26:43 -0700 (PDT) Received: from localhost ([::1]:51339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywzn-0000o2-8V for importer@patchew.org; Mon, 02 Oct 2017 05:26:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywib-0002GI-17 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiY-0006Bi-S7 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57920) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiY-0006BT-M1 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDD4680B56; Mon, 2 Oct 2017 09:08:49 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E597860A9D; Mon, 2 Oct 2017 09:08:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BDD4680B56 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:05 +0200 Message-Id: <1506935300-132598-24-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 02 Oct 2017 09:08:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 23/38] xtensa: sim: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcmvbkbc@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: jcmvbkbc@gmail.com --- hw/xtensa/sim.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index b3580b1..2bb883b 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -75,16 +75,11 @@ static void xtensa_sim_init(MachineState *machine) XtensaCPU *cpu =3D NULL; CPUXtensaState *env =3D NULL; ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; int n; =20 - if (!cpu_model) { - cpu_model =3D XTENSA_DEFAULT_CPU_MODEL; - } - for (n =3D 0; n < smp_cpus; n++) { - cpu =3D XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)); + cpu =3D XTENSA_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 env->sregs[PRID] =3D n; @@ -133,6 +128,7 @@ static void xtensa_sim_machine_init(MachineClass *mc) mc->init =3D xtensa_sim_init; mc->max_cpus =3D 4; mc->no_serial =3D 1; + mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; } =20 DEFINE_MACHINE("sim", xtensa_sim_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936087495791.5185736780803; Mon, 2 Oct 2017 02:21:27 -0700 (PDT) Received: from localhost ([::1]:51314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywuc-0004Fv-IR for importer@patchew.org; Mon, 02 Oct 2017 05:21:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywid-0002K7-SL for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiZ-0006C8-Ud for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44718) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiZ-0006Bo-OH for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF4DC81E11; Mon, 2 Oct 2017 09:08:50 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12BD260A9D; Mon, 2 Oct 2017 09:08:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DF4DC81E11 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:06 +0200 Message-Id: <1506935300-132598-25-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 02 Oct 2017 09:08:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 24/38] xtensa: lx60/lx200/ml605/kc705: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcmvbkbc@gmail.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: jcmvbkbc@gmail.com --- hw/xtensa/xtfpga.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index a19cceb..1971ecf 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -220,19 +220,14 @@ static void lx_init(const LxBoardDesc *board, Machine= State *machine) DriveInfo *dinfo; pflash_t *flash =3D NULL; QemuOpts *machine_opts =3D qemu_get_machine_opts(); - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D qemu_opt_get(machine_opts, "kernel"); const char *kernel_cmdline =3D qemu_opt_get(machine_opts, "append"); const char *dtb_filename =3D qemu_opt_get(machine_opts, "dtb"); const char *initrd_filename =3D qemu_opt_get(machine_opts, "initrd"); int n; =20 - if (!cpu_model) { - cpu_model =3D XTENSA_DEFAULT_CPU_MODEL; - } - for (n =3D 0; n < smp_cpus; n++) { - cpu =3D XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)); + cpu =3D XTENSA_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 env->sregs[PRID] =3D n; @@ -454,6 +449,7 @@ static void xtensa_lx60_class_init(ObjectClass *oc, voi= d *data) mc->desc =3D "lx60 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init =3D xtensa_lx60_init; mc->max_cpus =3D 4; + mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; } =20 static const TypeInfo xtensa_lx60_type =3D { @@ -469,6 +465,7 @@ static void xtensa_lx200_class_init(ObjectClass *oc, vo= id *data) mc->desc =3D "lx200 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init =3D xtensa_lx200_init; mc->max_cpus =3D 4; + mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; } =20 static const TypeInfo xtensa_lx200_type =3D { @@ -484,6 +481,7 @@ static void xtensa_ml605_class_init(ObjectClass *oc, vo= id *data) mc->desc =3D "ml605 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init =3D xtensa_ml605_init; mc->max_cpus =3D 4; + mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; } =20 static const TypeInfo xtensa_ml605_type =3D { @@ -499,6 +497,7 @@ static void xtensa_kc705_class_init(ObjectClass *oc, vo= id *data) mc->desc =3D "kc705 EVB (" XTENSA_DEFAULT_CPU_MODEL ")"; mc->init =3D xtensa_kc705_init; mc->max_cpus =3D 4; + mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; } =20 static const TypeInfo xtensa_kc705_type =3D { --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936401482267.26702356643307; Mon, 2 Oct 2017 02:26:41 -0700 (PDT) Received: from localhost ([::1]:51340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywzo-0000p4-L4 for importer@patchew.org; Mon, 02 Oct 2017 05:26:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywii-0002PL-2y for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywic-0006DF-86 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49052) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywib-0006Ch-VU for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:54 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E89CE550B0; Mon, 2 Oct 2017 09:08:52 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32DCA60621; Mon, 2 Oct 2017 09:08:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E89CE550B0 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:07 +0200 Message-Id: <1506935300-132598-26-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 02 Oct 2017 09:08:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 25/38] unicore32: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gxt@mprc.pku.edu.cn, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" use new UNICORE32_CPU_TYPE_NAME to compose CPU type name and get rid of intermediate UniCore32CPUInfo/uc32_cpu_register_types() which is replaced by static TypeInfo array and type_init_from_array() Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: gxt@mprc.pku.edu.cn --- target/unicore32/cpu.h | 3 +++ target/unicore32/cpu.c | 61 +++++++++++++++++-----------------------------= ---- 2 files changed, 23 insertions(+), 41 deletions(-) diff --git a/target/unicore32/cpu.h b/target/unicore32/cpu.h index 7724108..3dc6fbc 100644 --- a/target/unicore32/cpu.h +++ b/target/unicore32/cpu.h @@ -167,6 +167,9 @@ static inline int cpu_mmu_index(CPUUniCore32State *env,= bool ifetch) =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_UNICORE32_CPU, cpu_model) =20 +#define UNICORE32_CPU_TYPE_SUFFIX "-" TYPE_UNICORE32_CPU +#define UNICORE32_CPU_TYPE_NAME(model) model UNICORE32_CPU_TYPE_SUFFIX + static inline void cpu_get_tb_cpu_state(CPUUniCore32State *env, target_ulo= ng *pc, target_ulong *cs_base, uint32_t *f= lags) { diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index 138acc9..3345cfd 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -44,7 +44,7 @@ static ObjectClass *uc32_cpu_class_by_name(const char *cp= u_model) ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_UNICORE32_CPU, cpu_model); + typename =3D g_strdup_printf(UNICORE32_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (oc !=3D NULL && (!object_class_dynamic_cast(oc, TYPE_UNICORE32_CPU= ) || @@ -54,11 +54,6 @@ static ObjectClass *uc32_cpu_class_by_name(const char *c= pu_model) return oc; } =20 -typedef struct UniCore32CPUInfo { - const char *name; - void (*instance_init)(Object *obj); -} UniCore32CPUInfo; - static void unicore_ii_cpu_initfn(Object *obj) { UniCore32CPU *cpu =3D UNICORE32_CPU(obj); @@ -90,11 +85,6 @@ static void uc32_any_cpu_initfn(Object *obj) set_snan_bit_is_one(1, &env->ucf64.fp_status); } =20 -static const UniCore32CPUInfo uc32_cpus[] =3D { - { .name =3D "UniCore-II", .instance_init =3D unicore_ii_cpu_initfn }, - { .name =3D "any", .instance_init =3D uc32_any_cpu_initfn }, -}; - static void uc32_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs =3D CPU(dev); @@ -165,36 +155,25 @@ static void uc32_cpu_class_init(ObjectClass *oc, void= *data) dc->vmsd =3D &vmstate_uc32_cpu; } =20 -static void uc32_register_cpu_type(const UniCore32CPUInfo *info) -{ - TypeInfo type_info =3D { - .parent =3D TYPE_UNICORE32_CPU, - .instance_init =3D info->instance_init, - }; - - type_info.name =3D g_strdup_printf("%s-" TYPE_UNICORE32_CPU, info->nam= e); - type_register(&type_info); - g_free((void *)type_info.name); -} +#define DEFINE_UNICORE32_CPU_TYPE(cpu_model, initfn) \ + { \ + .parent =3D TYPE_UNICORE32_CPU, \ + .instance_init =3D initfn, \ + .name =3D UNICORE32_CPU_TYPE_NAME(cpu_model), \ + } =20 -static const TypeInfo uc32_cpu_type_info =3D { - .name =3D TYPE_UNICORE32_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(UniCore32CPU), - .instance_init =3D uc32_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(UniCore32CPUClass), - .class_init =3D uc32_cpu_class_init, +static const TypeInfo uc32_cpu_type_infos[] =3D { + { + .name =3D TYPE_UNICORE32_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(UniCore32CPU), + .instance_init =3D uc32_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(UniCore32CPUClass), + .class_init =3D uc32_cpu_class_init, + }, + DEFINE_UNICORE32_CPU_TYPE("UniCore-II", unicore_ii_cpu_initfn), + DEFINE_UNICORE32_CPU_TYPE("any", uc32_any_cpu_initfn), }; =20 -static void uc32_cpu_register_types(void) -{ - int i; - - type_register_static(&uc32_cpu_type_info); - for (i =3D 0; i < ARRAY_SIZE(uc32_cpus); i++) { - uc32_register_cpu_type(&uc32_cpus[i]); - } -} - -type_init(uc32_cpu_register_types) +type_init_from_array(uc32_cpu_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936246502841.2122803627075; Mon, 2 Oct 2017 02:24:06 -0700 (PDT) Received: from localhost ([::1]:51325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywxH-0006zy-JN for importer@patchew.org; Mon, 02 Oct 2017 05:24:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywif-0002La-4i for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywid-0006E0-T2 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywid-0006Dh-NM for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C615AC0587F7; Mon, 2 Oct 2017 09:08:54 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 393CF60A9D; Mon, 2 Oct 2017 09:08:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C615AC0587F7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:08 +0200 Message-Id: <1506935300-132598-27-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 09:08:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 26/38] unicore32: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guan Xuetao , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: Guan Xuetao --- hw/unicore32/puv3.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index 504ea46..1b39cc0 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -112,7 +112,6 @@ static void puv3_load_kernel(const char *kernel_filenam= e) static void puv3_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *initrd_filename =3D machine->initrd_filename; CPUUniCore32State *env; @@ -123,11 +122,7 @@ static void puv3_init(MachineState *machine) exit(1); } =20 - if (!cpu_model) { - cpu_model =3D "UniCore-II"; - } - - cpu =3D UNICORE32_CPU(cpu_generic_init(TYPE_UNICORE32_CPU, cpu_model)); + cpu =3D UNICORE32_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 puv3_soc_init(env); @@ -140,6 +135,7 @@ static void puv3_machine_init(MachineClass *mc) mc->desc =3D "PKUnity Version-3 based on UniCore32"; mc->init =3D puv3_init; mc->is_default =3D 1; + mc->default_cpu_type =3D UNICORE32_CPU_TYPE_NAME("UniCore-II"); } =20 DEFINE_MACHINE("puv3", puv3_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936468295374.8528361850439; Mon, 2 Oct 2017 02:27:48 -0700 (PDT) Received: from localhost ([::1]:51341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx0h-0001ct-DB for importer@patchew.org; Mon, 02 Oct 2017 05:27:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywig-0002NI-Kw for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywif-0006Fi-5y for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywie-0006EA-UO for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21DC07E435; Mon, 2 Oct 2017 09:08:56 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11F4D60A9D; Mon, 2 Oct 2017 09:08:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 21DC07E435 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:09 +0200 Message-Id: <1506935300-132598-28-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 02 Oct 2017 09:08:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 27/38] tricore: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kbastian@mail.uni-paderborn.de, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" introduce TRICORE_CPU_TYPE_NAME macro and use it to construct cpu type names. While at it move cpu type_infos into one array and register it directly with type_init_from_array() instead of custom tricore_cpu_register_types()/cpu_register() Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: kbastian@mail.uni-paderborn.de --- target/tricore/cpu.h | 2 ++ target/tricore/cpu.c | 68 ++++++++++++++++--------------------------------= ---- 2 files changed, 22 insertions(+), 48 deletions(-) diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index bc53c40..f41d2ce 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -413,6 +413,8 @@ static inline void cpu_get_tb_cpu_state(CPUTriCoreState= *env, target_ulong *pc, =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_TRICORE_CPU, cpu_model) =20 +#define TRICORE_CPU_TYPE_SUFFIX "-" TYPE_TRICORE_CPU +#define TRICORE_CPU_TYPE_NAME(model) model TRICORE_CPU_TYPE_SUFFIX =20 /* helpers.c */ int cpu_tricore_handle_mmu_fault(CPUState *cpu, target_ulong address, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 871eb35..69d7720 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -120,7 +120,7 @@ static ObjectClass *tricore_cpu_class_by_name(const cha= r *cpu_model) ObjectClass *oc; char *typename; =20 - typename =3D g_strdup_printf("%s-" TYPE_TRICORE_CPU, cpu_model); + typename =3D g_strdup_printf(TRICORE_CPU_TYPE_NAME("%s"), cpu_model); oc =3D object_class_by_name(typename); g_free(typename); if (!oc || !object_class_dynamic_cast(oc, TYPE_TRICORE_CPU) || @@ -151,19 +151,6 @@ static void tc27x_initfn(Object *obj) set_feature(&cpu->env, TRICORE_FEATURE_161); } =20 -typedef struct TriCoreCPUInfo { - const char *name; - void (*initfn)(Object *obj); - void (*class_init)(ObjectClass *oc, void *data); -} TriCoreCPUInfo; - -static const TriCoreCPUInfo tricore_cpus[] =3D { - { .name =3D "tc1796", .initfn =3D tc1796_initfn }, - { .name =3D "tc1797", .initfn =3D tc1797_initfn }, - { .name =3D "tc27x", .initfn =3D tc27x_initfn }, - { .name =3D NULL } -}; - static void tricore_cpu_class_init(ObjectClass *c, void *data) { TriCoreCPUClass *mcc =3D TRICORE_CPU_CLASS(c); @@ -184,41 +171,26 @@ static void tricore_cpu_class_init(ObjectClass *c, vo= id *data) cc->get_phys_page_attrs_debug =3D tricore_cpu_get_phys_page_attrs_debu= g; } =20 -static void cpu_register(const TriCoreCPUInfo *info) -{ - TypeInfo type_info =3D { - .parent =3D TYPE_TRICORE_CPU, +#define DEFINE_TRICORE_CPU_TYPE(cpu_model, initfn) \ + { \ + .parent =3D TYPE_TRICORE_CPU, \ + .instance_init =3D initfn, \ + .name =3D TRICORE_CPU_TYPE_NAME(cpu_model), \ + } + +static const TypeInfo tricore_cpu_type_infos[] =3D { + { + .name =3D TYPE_TRICORE_CPU, + .parent =3D TYPE_CPU, .instance_size =3D sizeof(TriCoreCPU), - .instance_init =3D info->initfn, + .instance_init =3D tricore_cpu_initfn, + .abstract =3D true, .class_size =3D sizeof(TriCoreCPUClass), - .class_init =3D info->class_init, - }; - - type_info.name =3D g_strdup_printf("%s-" TYPE_TRICORE_CPU, info->name); - type_register(&type_info); - g_free((void *)type_info.name); -} - -static const TypeInfo tricore_cpu_type_info =3D { - .name =3D TYPE_TRICORE_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(TriCoreCPU), - .instance_init =3D tricore_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(TriCoreCPUClass), - .class_init =3D tricore_cpu_class_init, + .class_init =3D tricore_cpu_class_init, + }, + DEFINE_TRICORE_CPU_TYPE("tc1796", tc1796_initfn), + DEFINE_TRICORE_CPU_TYPE("tc1797", tc1797_initfn), + DEFINE_TRICORE_CPU_TYPE("tc27x", tc27x_initfn), }; =20 -static void tricore_cpu_register_types(void) -{ - const TriCoreCPUInfo *info =3D tricore_cpus; - - type_register_static(&tricore_cpu_type_info); - - while (info->name) { - cpu_register(info); - info++; - } -} - -type_init(tricore_cpu_register_types) +type_init_from_array(tricore_cpu_type_infos) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936552193940.5374909768082; Mon, 2 Oct 2017 02:29:12 -0700 (PDT) Received: from localhost ([::1]:51348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx2D-0002wF-Fc for importer@patchew.org; Mon, 02 Oct 2017 05:29:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywih-0002Nq-7O for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywig-0006GK-Bx for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36514) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywig-0006Fy-5l for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F64E356E3; Mon, 2 Oct 2017 09:08:57 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 698E260A9D; Mon, 2 Oct 2017 09:08:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F64E356E3 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:10 +0200 Message-Id: <1506935300-132598-29-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Oct 2017 09:08:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 28/38] tricore: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bastian Koppelmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: Bastian Koppelmann --- hw/tricore/tricore_testboard.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 0486f8a..ac75eb2 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -71,10 +71,7 @@ static void tricore_testboard_init(MachineState *machine= , int board_id) MemoryRegion *pcp_data =3D g_new(MemoryRegion, 1); MemoryRegion *pcp_text =3D g_new(MemoryRegion, 1); =20 - if (!machine->cpu_model) { - machine->cpu_model =3D "tc1796"; - } - cpu =3D TRICORE_CPU(cpu_generic_init(TYPE_TRICORE_CPU, machine->cpu_mo= del)); + cpu =3D TRICORE_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram", 2 * 1024 * 1024, &error_fatal); @@ -114,6 +111,7 @@ static void ttb_machine_init(MachineClass *mc) mc->desc =3D "a minimal TriCore board"; mc->init =3D tricoreboard_init; mc->is_default =3D 0; + mc->default_cpu_type =3D TRICORE_CPU_TYPE_NAME("tc1796"); } =20 DEFINE_MACHINE("tricore_testboard", ttb_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936711902145.54437953584966; Mon, 2 Oct 2017 02:31:51 -0700 (PDT) Received: from localhost ([::1]:51361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx4k-0005Bs-4p for importer@patchew.org; Mon, 02 Oct 2017 05:31:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywii-0002QT-Vf for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywih-0006Gz-UD for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15221) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywih-0006Gh-OP for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:08:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B10B3356DA; Mon, 2 Oct 2017 09:08:58 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 883A060A9D; Mon, 2 Oct 2017 09:08:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B10B3356DA Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:11 +0200 Message-Id: <1506935300-132598-30-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Oct 2017 09:08:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 29/38] sparc: cleanup cpu type name composition X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.cave-ayland@ilande.co.uk, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , atar4qemu@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" introduce SPARC_CPU_TYPE_NAME macro and use it to construct cpu type names. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- macro will also be used in follow up patches to define default cpu types per board CC: mark.cave-ayland@ilande.co.uk CC: atar4qemu@gmail.com --- target/sparc/cpu.h | 3 +++ target/sparc/cpu.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 1598f65..7aa45c9 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -658,6 +658,9 @@ int cpu_sparc_signal_handler(int host_signum, void *pin= fo, void *puc); #define cpu_init(cpu_model) cpu_generic_init(TYPE_SPARC_CPU, cpu_model) #endif =20 +#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU +#define SPARC_CPU_TYPE_NAME(model) model SPARC_CPU_TYPE_SUFFIX + #define cpu_signal_handler cpu_sparc_signal_handler #define cpu_list sparc_cpu_list =20 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index beab90f..f09ba50 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -712,7 +712,7 @@ static bool sparc_cpu_has_work(CPUState *cs) =20 static char *sparc_cpu_type_name(const char *cpu_model) { - char *name =3D g_strdup_printf("%s-" TYPE_SPARC_CPU, cpu_model); + char *name =3D g_strdup_printf(SPARC_CPU_TYPE_NAME("%s"), cpu_model); char *s =3D name; =20 /* SPARC cpu model names happen to have whitespaces, --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936557901524.5573758828717; Mon, 2 Oct 2017 02:29:17 -0700 (PDT) Received: from localhost ([::1]:51349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx2I-0002zk-3C for importer@patchew.org; Mon, 02 Oct 2017 05:29:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywik-0002SF-C3 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywij-0006HT-3S for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58538) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywii-0006HB-R1 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F41E15AFED; Mon, 2 Oct 2017 09:08:59 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01AE460621; Mon, 2 Oct 2017 09:08:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F41E15AFED Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:12 +0200 Message-Id: <1506935300-132598-31-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 02 Oct 2017 09:09:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 30/38] sparc: sun4u/sun4v/niagara: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.cave-ayland@ilande.co.uk, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , atar4qemu@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: mark.cave-ayland@ilande.co.uk CC: atar4qemu@gmail.com --- include/hw/sparc/sparc64.h | 3 +-- hw/sparc64/niagara.c | 4 ++-- hw/sparc64/sparc64.c | 8 ++------ hw/sparc64/sun4u.c | 8 +++----- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/hw/sparc/sparc64.h b/include/hw/sparc/sparc64.h index 7748939..ca3bb4b 100644 --- a/include/hw/sparc/sparc64.h +++ b/include/hw/sparc/sparc64.h @@ -1,5 +1,4 @@ =20 -SPARCCPU *sparc64_cpu_devinit(const char *cpu_model, - const char *dflt_cpu_model, uint64_t prom_ad= dr); +SPARCCPU *sparc64_cpu_devinit(const char *cpu_type, uint64_t prom_addr); =20 void sparc64_cpu_set_ivec_irq(void *opaque, int irq, int level); diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index 9a8d610..7a72332 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -106,8 +106,7 @@ static void niagara_init(MachineState *machine) MemoryRegion *sysmem =3D get_system_memory(); =20 /* init CPUs */ - sparc64_cpu_devinit(machine->cpu_model, "Sun UltraSparc T1", - NIAGARA_PROM_BASE); + sparc64_cpu_devinit(machine->cpu_type, NIAGARA_PROM_BASE); /* set up devices */ memory_region_allocate_system_memory(&s->hv_ram, NULL, "sun4v-hv.ram", NIAGARA_HV_RAM_SIZE); @@ -174,6 +173,7 @@ static void niagara_class_init(ObjectClass *oc, void *d= ata) mc->init =3D niagara_init; mc->max_cpus =3D 1; /* XXX for now */ mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1"); } =20 static const TypeInfo niagara_type =3D { diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 097d529..9453e2c 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -339,8 +339,7 @@ void cpu_tick_set_limit(CPUTimer *timer, uint64_t limit) } } =20 -SPARCCPU *sparc64_cpu_devinit(const char *cpu_model, - const char *default_cpu_model, uint64_t prom= _addr) +SPARCCPU *sparc64_cpu_devinit(const char *cpu_type, uint64_t prom_addr) { SPARCCPU *cpu; CPUSPARCState *env; @@ -350,10 +349,7 @@ SPARCCPU *sparc64_cpu_devinit(const char *cpu_model, uint32_t stick_frequency =3D 100 * 1000000; uint32_t hstick_frequency =3D 100 * 1000000; =20 - if (cpu_model =3D=3D NULL) { - cpu_model =3D default_cpu_model; - } - cpu =3D SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model)); + cpu =3D SPARC_CPU(cpu_create(cpu_type)); env =3D &cpu->env; =20 env->tick =3D cpu_timer_create("tick", cpu, tick_irq, diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index c3280aa..d53fad8 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -73,7 +73,6 @@ #define IVEC_MAX 0x40 =20 struct hwdef { - const char * const default_cpu_model; uint16_t machine_id; uint64_t prom_addr; uint64_t console_serial_base; @@ -439,8 +438,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, int onboard_nic_idx; =20 /* init CPUs */ - cpu =3D sparc64_cpu_devinit(machine->cpu_model, hwdef->default_cpu_mod= el, - hwdef->prom_addr); + cpu =3D sparc64_cpu_devinit(machine->cpu_type, hwdef->prom_addr); =20 /* set up devices */ ram_init(0, machine->ram_size); @@ -569,14 +567,12 @@ enum { static const struct hwdef hwdefs[] =3D { /* Sun4u generic PC-like machine */ { - .default_cpu_model =3D "TI UltraSparc IIi", .machine_id =3D sun4u_id, .prom_addr =3D 0x1fff0000000ULL, .console_serial_base =3D 0, }, /* Sun4v generic PC-like machine */ { - .default_cpu_model =3D "Sun UltraSparc T1", .machine_id =3D sun4v_id, .prom_addr =3D 0x1fff0000000ULL, .console_serial_base =3D 0, @@ -605,6 +601,7 @@ static void sun4u_class_init(ObjectClass *oc, void *dat= a) mc->max_cpus =3D 1; /* XXX for now */ mc->is_default =3D 1; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi"); } =20 static const TypeInfo sun4u_type =3D { @@ -622,6 +619,7 @@ static void sun4v_class_init(ObjectClass *oc, void *dat= a) mc->block_default_type =3D IF_IDE; mc->max_cpus =3D 1; /* XXX for now */ mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1"); } =20 static const TypeInfo sun4v_type =3D { --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936893942419.3318170955182; Mon, 2 Oct 2017 02:34:53 -0700 (PDT) Received: from localhost ([::1]:51370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx7Y-0007aw-4Q for importer@patchew.org; Mon, 02 Oct 2017 05:34:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywil-0002Tn-TX for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywik-0006IE-Ch for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywik-0006Hk-4I for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4529C7E431; Mon, 2 Oct 2017 09:09:01 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47EDC60621; Mon, 2 Oct 2017 09:09:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4529C7E431 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:13 +0200 Message-Id: <1506935300-132598-32-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 02 Oct 2017 09:09:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 31/38] sparc: sparc: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.cave-ayland@ilande.co.uk, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , atar4qemu@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- CC: mark.cave-ayland@ilande.co.uk CC: atar4qemu@gmail.com --- hw/sparc/sun4m.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index e1bdd48..68b2378 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -94,7 +94,6 @@ struct sun4m_hwdef { } vsimm[MAX_VSIMMS]; hwaddr ecc_base; uint64_t max_mem; - const char * const default_cpu_model; uint32_t ecc_version; uint32_t iommu_version; uint16_t machine_id; @@ -790,14 +789,14 @@ static const TypeInfo ram_info =3D { .class_init =3D ram_class_init, }; =20 -static void cpu_devinit(const char *cpu_model, unsigned int id, +static void cpu_devinit(const char *cpu_type, unsigned int id, uint64_t prom_addr, qemu_irq **cpu_irqs) { CPUState *cs; SPARCCPU *cpu; CPUSPARCState *env; =20 - cpu =3D SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model)); + cpu =3D SPARC_CPU(cpu_create(cpu_type)); env =3D &cpu->env; =20 cpu_sparc_set_id(env, id); @@ -820,7 +819,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwd= ef, MachineState *machine) { DeviceState *slavio_intctl; - const char *cpu_model =3D machine->cpu_model; unsigned int i; void *iommu, *espdma, *ledma, *nvram; qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS], @@ -833,11 +831,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hw= def, unsigned int num_vsimms; =20 /* init CPUs */ - if (!cpu_model) - cpu_model =3D hwdef->default_cpu_model; - for(i =3D 0; i < smp_cpus; i++) { - cpu_devinit(cpu_model, i, hwdef->slavio_base, &cpu_irqs[i]); + cpu_devinit(machine->cpu_type, i, hwdef->slavio_base, &cpu_irqs[i]= ); } =20 for (i =3D smp_cpus; i < MAX_CPUS; i++) @@ -1074,7 +1069,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D ss5_id, .iommu_version =3D 0x05000000, .max_mem =3D 0x10000000, - .default_cpu_model =3D "Fujitsu MB86904", }, /* SS-10 */ { @@ -1100,7 +1094,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D ss10_id, .iommu_version =3D 0x03000000, .max_mem =3D 0xf00000000ULL, - .default_cpu_model =3D "TI SuperSparc II", }, /* SS-600MP */ { @@ -1124,7 +1117,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D ss600mp_id, .iommu_version =3D 0x01000000, .max_mem =3D 0xf00000000ULL, - .default_cpu_model =3D "TI SuperSparc II", }, /* SS-20 */ { @@ -1166,7 +1158,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D ss20_id, .iommu_version =3D 0x13000000, .max_mem =3D 0xf00000000ULL, - .default_cpu_model =3D "TI SuperSparc II", }, /* Voyager */ { @@ -1190,7 +1181,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D vger_id, .iommu_version =3D 0x05000000, .max_mem =3D 0x10000000, - .default_cpu_model =3D "Fujitsu MB86904", }, /* LX */ { @@ -1215,7 +1205,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D lx_id, .iommu_version =3D 0x04000000, .max_mem =3D 0x10000000, - .default_cpu_model =3D "TI MicroSparc I", }, /* SS-4 */ { @@ -1240,7 +1229,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D ss4_id, .iommu_version =3D 0x05000000, .max_mem =3D 0x10000000, - .default_cpu_model =3D "Fujitsu MB86904", }, /* SPARCClassic */ { @@ -1264,7 +1252,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D scls_id, .iommu_version =3D 0x05000000, .max_mem =3D 0x10000000, - .default_cpu_model =3D "TI MicroSparc I", }, /* SPARCbook */ { @@ -1288,7 +1275,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] =3D { .machine_id =3D sbook_id, .iommu_version =3D 0x05000000, .max_mem =3D 0x10000000, - .default_cpu_model =3D "TI MicroSparc I", }, }; =20 @@ -1355,6 +1341,7 @@ static void ss5_class_init(ObjectClass *oc, void *dat= a) mc->block_default_type =3D IF_SCSI; mc->is_default =3D 1; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); } =20 static const TypeInfo ss5_type =3D { @@ -1372,6 +1359,7 @@ static void ss10_class_init(ObjectClass *oc, void *da= ta) mc->block_default_type =3D IF_SCSI; mc->max_cpus =3D 4; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-SuperSparc-II"); } =20 static const TypeInfo ss10_type =3D { @@ -1389,6 +1377,7 @@ static void ss600mp_class_init(ObjectClass *oc, void = *data) mc->block_default_type =3D IF_SCSI; mc->max_cpus =3D 4; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-SuperSparc-II"); } =20 static const TypeInfo ss600mp_type =3D { @@ -1406,6 +1395,7 @@ static void ss20_class_init(ObjectClass *oc, void *da= ta) mc->block_default_type =3D IF_SCSI; mc->max_cpus =3D 4; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-SuperSparc-II"); } =20 static const TypeInfo ss20_type =3D { @@ -1422,6 +1412,7 @@ static void voyager_class_init(ObjectClass *oc, void = *data) mc->init =3D vger_init; mc->block_default_type =3D IF_SCSI; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); } =20 static const TypeInfo voyager_type =3D { @@ -1438,6 +1429,7 @@ static void ss_lx_class_init(ObjectClass *oc, void *d= ata) mc->init =3D ss_lx_init; mc->block_default_type =3D IF_SCSI; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-MicroSparc-I"); } =20 static const TypeInfo ss_lx_type =3D { @@ -1454,6 +1446,7 @@ static void ss4_class_init(ObjectClass *oc, void *dat= a) mc->init =3D ss4_init; mc->block_default_type =3D IF_SCSI; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("Fujitsu-MB86904"); } =20 static const TypeInfo ss4_type =3D { @@ -1470,6 +1463,7 @@ static void scls_class_init(ObjectClass *oc, void *da= ta) mc->init =3D scls_init; mc->block_default_type =3D IF_SCSI; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-MicroSparc-I"); } =20 static const TypeInfo scls_type =3D { @@ -1486,6 +1480,7 @@ static void sbook_class_init(ObjectClass *oc, void *d= ata) mc->init =3D sbook_init; mc->block_default_type =3D IF_SCSI; mc->default_boot_order =3D "c"; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("TI-MicroSparc-I"); } =20 static const TypeInfo sbook_type =3D { --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936614932655.9279052169662; Mon, 2 Oct 2017 02:30:14 -0700 (PDT) Received: from localhost ([::1]:51350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx39-0003ka-5L for importer@patchew.org; Mon, 02 Oct 2017 05:30:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiq-0002W2-1Q for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywim-0006Iz-2Y for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43012) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywil-0006Ib-St for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6B7C4A6E0; Mon, 2 Oct 2017 09:09:02 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DF8360A9D; Mon, 2 Oct 2017 09:09:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C6B7C4A6E0 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:14 +0200 Message-Id: <1506935300-132598-33-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 02 Oct 2017 09:09:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 32/38] sparc: leon3: use generic cpu_model parsing X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chouteau@adacore.com, mark.cave-ayland@ilande.co.uk, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , atar4qemu@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- CC: mark.cave-ayland@ilande.co.uk CC: atar4qemu@gmail.com CC: chouteau@adacore.com --- hw/sparc/leon3.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index ec2816b..8c66d5a 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -107,7 +107,6 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil= _in) static void leon3_generic_hw_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; SPARCCPU *cpu; CPUSPARCState *env; @@ -122,11 +121,7 @@ static void leon3_generic_hw_init(MachineState *machin= e) ResetData *reset_info; =20 /* Init CPU */ - if (!cpu_model) { - cpu_model =3D "LEON3"; - } - - cpu =3D SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model)); + cpu =3D SPARC_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 cpu_sparc_set_id(env, 0); @@ -222,6 +217,7 @@ static void leon3_generic_machine_init(MachineClass *mc) { mc->desc =3D "Leon-3 generic"; mc->init =3D leon3_generic_hw_init; + mc->default_cpu_type =3D SPARC_CPU_TYPE_NAME("LEON3"); } =20 DEFINE_MACHINE("leon3_generic", leon3_generic_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506937052712687.9677671544732; Mon, 2 Oct 2017 02:37:32 -0700 (PDT) Received: from localhost ([::1]:51392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyxA8-0001Qh-Qm for importer@patchew.org; Mon, 02 Oct 2017 05:37:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiq-0002W4-1f for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywin-0006JY-A8 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywin-0006J8-4h for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41A977E428; Mon, 2 Oct 2017 09:09:04 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B2B560A9D; Mon, 2 Oct 2017 09:09:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 41A977E428 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:15 +0200 Message-Id: <1506935300-132598-34-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 02 Oct 2017 09:09:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 33/38] mips: use object_new() instead of gnew()+object_initialize() X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yongbok.kim@imgtec.com, aurelien@aurel32.net, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , paul.burton@imgtec.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" object_initialize() is intended for inplace initialization of objects, but here it's first allocated with g_new0() and then initialized with object_initialize(). QEMU already has API to do this (object_new), so do object creation with suitable for usecase API. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- CC: paul.burton@imgtec.com CC: aurelien@aurel32.net CC: yongbok.kim@imgtec.com --- hw/mips/boston.c | 3 +-- hw/mips/mips_malta.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 776ee28..e815be6 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -460,7 +460,6 @@ static void boston_mach_init(MachineState *machine) =20 s =3D BOSTON(dev); s->mach =3D machine; - s->cps =3D g_new0(MIPSCPSState, 1); =20 if (!cpu_supports_cps_smp(cpu_model)) { error_report("Boston requires CPUs which support CPS"); @@ -469,7 +468,7 @@ static void boston_mach_init(MachineState *machine) =20 is_64b =3D cpu_supports_isa(cpu_model, ISA_MIPS64); =20 - object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS); + s->cps =3D MIPS_CPS(object_new(TYPE_MIPS_CPS)); qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default()); =20 object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 2adb9bc..b6a58c7 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -949,9 +949,8 @@ static void create_cps(MaltaState *s, const char *cpu_m= odel, qemu_irq *cbus_irq, qemu_irq *i8259_irq) { Error *err =3D NULL; - s->cps =3D g_new0(MIPSCPSState, 1); =20 - object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS); + s->cps =3D MIPS_CPS(object_new(TYPE_MIPS_CPS)); qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default()); =20 object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err); --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936549598136.06353920493223; Mon, 2 Oct 2017 02:29:09 -0700 (PDT) Received: from localhost ([::1]:51347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx27-0002qz-GK for importer@patchew.org; Mon, 02 Oct 2017 05:29:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiq-0002Wm-JQ for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywio-0006KF-Tx for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywio-0006Jw-KL for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:06 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF015C04AC60; Mon, 2 Oct 2017 09:09:05 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89B7D60A9D; Mon, 2 Oct 2017 09:09:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF015C04AC60 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:16 +0200 Message-Id: <1506935300-132598-35-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Oct 2017 09:09:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 34/38] mips: malta/boston: replace cpu_model with cpu_type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yongbok.kim@imgtec.com, aurelien@aurel32.net, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , paul.burton@imgtec.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- CC: paul.burton@imgtec.com CC: aurelien@aurel32.net CC: yongbok.kim@imgtec.com --- include/hw/mips/cps.h | 2 +- target/mips/cpu.h | 8 ++++++-- hw/mips/boston.c | 11 +++++------ hw/mips/cps.c | 4 ++-- hw/mips/mips_malta.c | 33 +++++++++++++++------------------ target/mips/cpu.c | 2 +- target/mips/translate.c | 20 ++++++-------------- target/mips/translate_init.c | 12 ------------ 8 files changed, 36 insertions(+), 56 deletions(-) diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.h index 526b8d0..aab1af9 100644 --- a/include/hw/mips/cps.h +++ b/include/hw/mips/cps.h @@ -34,7 +34,7 @@ typedef struct MIPSCPSState { =20 uint32_t num_vp; uint32_t num_irq; - char *cpu_model; + char *cpu_type; =20 MemoryRegion container; MIPSGCRState gcr; diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 66265e4..7f8ba5f 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -740,8 +740,12 @@ enum { int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc); =20 #define cpu_init(cpu_model) cpu_generic_init(TYPE_MIPS_CPU, cpu_model) -bool cpu_supports_cps_smp(const char *cpu_model); -bool cpu_supports_isa(const char *cpu_model, unsigned int isa); + +#define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU +#define MIPS_CPU_TYPE_NAME(model) model MIPS_CPU_TYPE_SUFFIX + +bool cpu_supports_cps_smp(const char *cpu_type); +bool cpu_supports_isa(const char *cpu_type, unsigned int isa); void cpu_set_exception_base(int vp_index, target_ulong address); =20 /* mips_int.c */ diff --git a/hw/mips/boston.c b/hw/mips/boston.c index e815be6..1cb4b6a 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -437,7 +437,6 @@ static void boston_mach_init(MachineState *machine) DeviceState *dev; BostonState *s; Error *err =3D NULL; - const char *cpu_model; MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg; MemoryRegion *sys_mem =3D get_system_memory(); XilinxPCIEHost *pcie2; @@ -453,25 +452,24 @@ static void boston_mach_init(MachineState *machine) exit(1); } =20 - cpu_model =3D machine->cpu_model ?: "I6400"; - dev =3D qdev_create(NULL, TYPE_MIPS_BOSTON); qdev_init_nofail(dev); =20 s =3D BOSTON(dev); s->mach =3D machine; =20 - if (!cpu_supports_cps_smp(cpu_model)) { + if (!cpu_supports_cps_smp(machine->cpu_type)) { error_report("Boston requires CPUs which support CPS"); exit(1); } =20 - is_64b =3D cpu_supports_isa(cpu_model, ISA_MIPS64); + is_64b =3D cpu_supports_isa(machine->cpu_type, ISA_MIPS64); =20 s->cps =3D MIPS_CPS(object_new(TYPE_MIPS_CPS)); qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default()); =20 - object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err); + object_property_set_str(OBJECT(s->cps), machine->cpu_type, "cpu-type", + &err); object_property_set_int(OBJECT(s->cps), smp_cpus, "num-vp", &err); object_property_set_bool(OBJECT(s->cps), true, "realized", &err); =20 @@ -571,6 +569,7 @@ static void boston_mach_class_init(MachineClass *mc) mc->block_default_type =3D IF_IDE; mc->default_ram_size =3D 1 * G_BYTE; mc->max_cpus =3D 16; + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("I6400"); } =20 DEFINE_MACHINE("boston", boston_mach_class_init) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index fe5c630..4285d19 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -71,7 +71,7 @@ static void mips_cps_realize(DeviceState *dev, Error **er= rp) bool itu_present =3D false; =20 for (i =3D 0; i < s->num_vp; i++) { - cpu =3D MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, s->cpu_model)); + cpu =3D MIPS_CPU(cpu_create(s->cpu_type)); =20 /* Init internal devices */ cpu_mips_irq_init_cpu(cpu); @@ -160,7 +160,7 @@ static void mips_cps_realize(DeviceState *dev, Error **= errp) static Property mips_cps_properties[] =3D { DEFINE_PROP_UINT32("num-vp", MIPSCPSState, num_vp, 1), DEFINE_PROP_UINT32("num-irq", MIPSCPSState, num_irq, 256), - DEFINE_PROP_STRING("cpu-model", MIPSCPSState, cpu_model), + DEFINE_PROP_STRING("cpu-type", MIPSCPSState, cpu_type), DEFINE_PROP_END_OF_LIST() }; =20 diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index b6a58c7..ec6af4a 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -923,7 +923,7 @@ static void main_cpu_reset(void *opaque) } } =20 -static void create_cpu_without_cps(const char *cpu_model, +static void create_cpu_without_cps(const char *cpu_type, qemu_irq *cbus_irq, qemu_irq *i8259_irq) { CPUMIPSState *env; @@ -931,7 +931,7 @@ static void create_cpu_without_cps(const char *cpu_mode= l, int i; =20 for (i =3D 0; i < smp_cpus; i++) { - cpu =3D MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model)); + cpu =3D MIPS_CPU(cpu_create(cpu_type)); =20 /* Init internal devices */ cpu_mips_irq_init_cpu(cpu); @@ -945,7 +945,7 @@ static void create_cpu_without_cps(const char *cpu_mode= l, *cbus_irq =3D env->irq[4]; } =20 -static void create_cps(MaltaState *s, const char *cpu_model, +static void create_cps(MaltaState *s, const char *cpu_type, qemu_irq *cbus_irq, qemu_irq *i8259_irq) { Error *err =3D NULL; @@ -953,7 +953,7 @@ static void create_cps(MaltaState *s, const char *cpu_m= odel, s->cps =3D MIPS_CPS(object_new(TYPE_MIPS_CPS)); qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default()); =20 - object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err); + object_property_set_str(OBJECT(s->cps), cpu_type, "cpu-type", &err); object_property_set_int(OBJECT(s->cps), smp_cpus, "num-vp", &err); object_property_set_bool(OBJECT(s->cps), true, "realized", &err); if (err !=3D NULL) { @@ -967,21 +967,13 @@ static void create_cps(MaltaState *s, const char *cpu= _model, *cbus_irq =3D NULL; } =20 -static void create_cpu(MaltaState *s, const char *cpu_model, - qemu_irq *cbus_irq, qemu_irq *i8259_irq) +static void mips_create_cpu(MaltaState *s, const char *cpu_type, + qemu_irq *cbus_irq, qemu_irq *i8259_irq) { - if (cpu_model =3D=3D NULL) { -#ifdef TARGET_MIPS64 - cpu_model =3D "20Kc"; -#else - cpu_model =3D "24Kf"; -#endif - } - - if ((smp_cpus > 1) && cpu_supports_cps_smp(cpu_model)) { - create_cps(s, cpu_model, cbus_irq, i8259_irq); + if ((smp_cpus > 1) && cpu_supports_cps_smp(cpu_type)) { + create_cps(s, cpu_type, cbus_irq, i8259_irq); } else { - create_cpu_without_cps(cpu_model, cbus_irq, i8259_irq); + create_cpu_without_cps(cpu_type, cbus_irq, i8259_irq); } } =20 @@ -1038,7 +1030,7 @@ void mips_malta_init(MachineState *machine) } =20 /* create CPU */ - create_cpu(s, machine->cpu_model, &cbus_irq, &i8259_irq); + mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq); =20 /* allocate RAM */ if (ram_size > (2048u << 20)) { @@ -1264,6 +1256,11 @@ static void mips_malta_machine_init(MachineClass *mc) mc->block_default_type =3D IF_IDE; mc->max_cpus =3D 16; mc->is_default =3D 1; +#ifdef TARGET_MIPS64 + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("20Kc"); +#else + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); +#endif } =20 DEFINE_MACHINE("malta", mips_malta_machine_init) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index c15b894..24a8907 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -158,7 +158,7 @@ static void mips_cpu_initfn(Object *obj) =20 static char *mips_cpu_type_name(const char *cpu_model) { - return g_strdup_printf("%s-" TYPE_MIPS_CPU, cpu_model); + return g_strdup_printf(MIPS_CPU_TYPE_NAME("%s"), cpu_model); } =20 static ObjectClass *mips_cpu_class_by_name(const char *cpu_model) diff --git a/target/mips/translate.c b/target/mips/translate.c index d16d879..3d76fc6 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -20523,24 +20523,16 @@ void cpu_mips_realize_env(CPUMIPSState *env) mvp_init(env, env->cpu_model); } =20 -bool cpu_supports_cps_smp(const char *cpu_model) +bool cpu_supports_cps_smp(const char *cpu_type) { - const mips_def_t *def =3D cpu_mips_find_by_name(cpu_model); - if (!def) { - return false; - } - - return (def->CP0_Config3 & (1 << CP0C3_CMGCR)) !=3D 0; + const MIPSCPUClass *mcc =3D MIPS_CPU_CLASS(object_class_by_name(cpu_ty= pe)); + return (mcc->cpu_def->CP0_Config3 & (1 << CP0C3_CMGCR)) !=3D 0; } =20 -bool cpu_supports_isa(const char *cpu_model, unsigned int isa) +bool cpu_supports_isa(const char *cpu_type, unsigned int isa) { - const mips_def_t *def =3D cpu_mips_find_by_name(cpu_model); - if (!def) { - return false; - } - - return (def->insn_flags & isa) !=3D 0; + const MIPSCPUClass *mcc =3D MIPS_CPU_CLASS(object_class_by_name(cpu_ty= pe)); + return (mcc->cpu_def->insn_flags & isa) !=3D 0; } =20 void cpu_set_exception_base(int vp_index, target_ulong address) diff --git a/target/mips/translate_init.c b/target/mips/translate_init.c index 8bbded4..c7ba6ee 100644 --- a/target/mips/translate_init.c +++ b/target/mips/translate_init.c @@ -755,18 +755,6 @@ const mips_def_t mips_defs[] =3D }; const int mips_defs_number =3D ARRAY_SIZE(mips_defs); =20 -static const mips_def_t *cpu_mips_find_by_name (const char *name) -{ - int i; - - for (i =3D 0; i < ARRAY_SIZE(mips_defs); i++) { - if (strcasecmp(name, mips_defs[i].name) =3D=3D 0) { - return &mips_defs[i]; - } - } - return NULL; -} - void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf) { int i; --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936711304685.2058957343065; Mon, 2 Oct 2017 02:31:51 -0700 (PDT) Received: from localhost ([::1]:51360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx4e-00058O-HD for importer@patchew.org; Mon, 02 Oct 2017 05:31:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiv-0002cX-VF for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiq-0006Kh-32 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43328) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywip-0006KP-Sv for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00F174A6E6; Mon, 2 Oct 2017 09:09:07 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0395760A9D; Mon, 2 Oct 2017 09:09:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 00F174A6E6 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:17 +0200 Message-Id: <1506935300-132598-36-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 02 Oct 2017 09:09:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 35/38] mips: fulong2e: replace cpu_model with cpu_type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yongbok.kim@imgtec.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: yongbok.kim@imgtec.com CC: aurelien@aurel32.net --- hw/mips/mips_fulong2e.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 7531868..146cf0f 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -258,7 +258,6 @@ static void network_init (PCIBus *pci_bus) static void mips_fulong2e_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -277,10 +276,7 @@ static void mips_fulong2e_init(MachineState *machine) CPUMIPSState *env; =20 /* init CPUs */ - if (cpu_model =3D=3D NULL) { - cpu_model =3D "Loongson-2E"; - } - cpu =3D MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model)); + cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 qemu_register_reset(main_cpu_reset, cpu); @@ -385,6 +381,7 @@ static void mips_fulong2e_machine_init(MachineClass *mc) mc->desc =3D "Fulong 2e mini pc"; mc->init =3D mips_fulong2e_init; mc->block_default_type =3D IF_IDE; + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("Loongson-2E"); } =20 DEFINE_MACHINE("fulong2e", mips_fulong2e_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936785531829.4414007039869; Mon, 2 Oct 2017 02:33:05 -0700 (PDT) Received: from localhost ([::1]:51363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx5q-00065H-3Z for importer@patchew.org; Mon, 02 Oct 2017 05:32:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywis-0002ZK-Pt for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywir-0006LP-N5 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywir-0006L6-Gg for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98EF54A6E1; Mon, 2 Oct 2017 09:09:08 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49E6F6062E; Mon, 2 Oct 2017 09:09:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 98EF54A6E1 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:18 +0200 Message-Id: <1506935300-132598-37-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 02 Oct 2017 09:09:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 36/38] mips: Magnum/Acer Pica 61: replace cpu_model with cpu_type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yongbok.kim@imgtec.com, hpoussin@reactos.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Herv=C3=A9 Poussineau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: hpoussin@reactos.org CC: aurelien@aurel32.net CC: yongbok.kim@imgtec.com --- hw/mips/mips_jazz.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 7e6626d..fe4f173 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -122,7 +122,6 @@ static void mips_jazz_init(MachineState *machine, enum jazz_model_e jazz_model) { MemoryRegion *address_space =3D get_system_memory(); - const char *cpu_model =3D machine->cpu_model; char *filename; int bios_size, n; MIPSCPU *cpu; @@ -148,10 +147,7 @@ static void mips_jazz_init(MachineState *machine, MemoryRegion *bios2 =3D g_new(MemoryRegion, 1); =20 /* init CPUs */ - if (cpu_model =3D=3D NULL) { - cpu_model =3D "R4000"; - } - cpu =3D MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model)); + cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; qemu_register_reset(main_cpu_reset, cpu); =20 @@ -349,6 +345,7 @@ static void mips_magnum_class_init(ObjectClass *oc, voi= d *data) mc->desc =3D "MIPS Magnum"; mc->init =3D mips_magnum_init; mc->block_default_type =3D IF_SCSI; + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("R4000"); } =20 static const TypeInfo mips_magnum_type =3D { @@ -364,6 +361,7 @@ static void mips_pica61_class_init(ObjectClass *oc, voi= d *data) mc->desc =3D "Acer Pica 61"; mc->init =3D mips_pica61_init; mc->block_default_type =3D IF_SCSI; + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("R4000"); } =20 static const TypeInfo mips_pica61_type =3D { --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936944383384.81046549417283; Mon, 2 Oct 2017 02:35:44 -0700 (PDT) Received: from localhost ([::1]:51378 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx8Z-0008Vm-M8 for importer@patchew.org; Mon, 02 Oct 2017 05:35:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiu-0002aX-08 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywis-0006Lw-U8 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47266) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywis-0006Ld-On for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF2A5C0587D3; Mon, 2 Oct 2017 09:09:09 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1C3660A9D; Mon, 2 Oct 2017 09:09:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DF2A5C0587D3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:19 +0200 Message-Id: <1506935300-132598-38-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 02 Oct 2017 09:09:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 37/38] mips: mipssim: replace cpu_model with cpu_type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yongbok.kim@imgtec.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: yongbok.kim@imgtec.com CC: aurelien@aurel32.net --- hw/mips/mips_mipssim.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index a092072..e5d3654 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -141,7 +141,6 @@ static void mips_mipssim_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -156,14 +155,7 @@ mips_mipssim_init(MachineState *machine) int bios_size; =20 /* Init CPUs. */ - if (cpu_model =3D=3D NULL) { -#ifdef TARGET_MIPS64 - cpu_model =3D "5Kf"; -#else - cpu_model =3D "24Kf"; -#endif - } - cpu =3D MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model)); + cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 reset_info =3D g_malloc0(sizeof(ResetData)); @@ -235,6 +227,11 @@ static void mips_mipssim_machine_init(MachineClass *mc) { mc->desc =3D "MIPS MIPSsim platform"; mc->init =3D mips_mipssim_init; +#ifdef TARGET_MIPS64 + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("5Kf"); +#else + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); +#endif } =20 DEFINE_MACHINE("mipssim", mips_mipssim_machine_init) --=20 2.7.4 From nobody Mon Apr 29 00:06:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506936717350667.7192106663887; Mon, 2 Oct 2017 02:31:57 -0700 (PDT) Received: from localhost ([::1]:51362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyx4r-0005H7-JF for importer@patchew.org; Mon, 02 Oct 2017 05:31:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dywiw-0002cu-AB for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dywiu-0006Me-6u for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33716) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dywiu-0006MC-0f for qemu-devel@nongnu.org; Mon, 02 Oct 2017 05:09:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31458820E3; Mon, 2 Oct 2017 09:09:11 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3317D60A9D; Mon, 2 Oct 2017 09:09:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31458820E3 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 11:08:20 +0200 Message-Id: <1506935300-132598-39-git-send-email-imammedo@redhat.com> In-Reply-To: <1506935300-132598-1-git-send-email-imammedo@redhat.com> References: <1506935300-132598-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 02 Oct 2017 09:09:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 38/38] mips: r4k: replace cpu_model with cpu_type X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yongbok.kim@imgtec.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: aurelien@aurel32.net CC: yongbok.kim@imgtec.com --- hw/mips/mips_r4k.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 1272d4e..3bbb182 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -163,7 +163,6 @@ static void mips_r4k_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - const char *cpu_model =3D machine->cpu_model; const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; @@ -186,14 +185,7 @@ void mips_r4k_init(MachineState *machine) int be; =20 /* init CPUs */ - if (cpu_model =3D=3D NULL) { -#ifdef TARGET_MIPS64 - cpu_model =3D "R4000"; -#else - cpu_model =3D "24Kf"; -#endif - } - cpu =3D MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model)); + cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 reset_info =3D g_malloc0(sizeof(ResetData)); @@ -303,6 +295,12 @@ static void mips_machine_init(MachineClass *mc) mc->desc =3D "mips r4k platform"; mc->init =3D mips_r4k_init; mc->block_default_type =3D IF_IDE; +#ifdef TARGET_MIPS64 + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("R4000"); +#else + mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); +#endif + } =20 DEFINE_MACHINE("mips", mips_machine_init) --=20 2.7.4