From nobody Wed Nov 5 08:25:18 2025 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@nongnu.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@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150427898131945.26383342748852; Fri, 1 Sep 2017 08:16:21 -0700 (PDT) Received: from localhost ([::1]:45065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnngB-0003Dh-R4 for importer@patchew.org; Fri, 01 Sep 2017 11:16:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnnUV-0008Sv-Oo for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:04:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnnUQ-000386-T4 for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:04:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnnUQ-00037r-Kn for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:04:10 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4FBDC04D28D; Fri, 1 Sep 2017 15:04:09 +0000 (UTC) Received: from localhost (ovpn-116-66.gru2.redhat.com [10.97.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4674866840; Fri, 1 Sep 2017 15:04:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B4FBDC04D28D 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=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Fri, 1 Sep 2017 12:03:07 -0300 Message-Id: <20170901150317.10380-20-ehabkost@redhat.com> In-Reply-To: <20170901150317.10380-1-ehabkost@redhat.com> References: <20170901150317.10380-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 01 Sep 2017 15:04:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL 19/29] xtensa: replace cpu_xtensa_init() with cpu_generic_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Igor Mammedov call xtensa_irq_init() at realize time which makes cpu_xtensa_init() like generic cpu creation function. As result we can replace it with cpu_generic_init() which does the same job, reducing code duplication a bit. Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <1503592308-93913-16-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- target/xtensa/cpu.h | 4 +--- hw/xtensa/sim.c | 2 +- hw/xtensa/xtfpga.c | 2 +- target/xtensa/cpu.c | 3 +++ target/xtensa/helper.c | 22 ---------------------- 5 files changed, 6 insertions(+), 27 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index ee29fb1a14..48033313c5 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -475,9 +475,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vadd= r addr, #define XTENSA_DEFAULT_CPU_MODEL "dc232b" #endif =20 -XtensaCPU *cpu_xtensa_init(const char *cpu_model); - -#define cpu_init(cpu_model) CPU(cpu_xtensa_init(cpu_model)) +#define cpu_init(cpu_model) cpu_generic_init(TYPE_XTENSA_CPU, cpu_model) =20 void xtensa_translate_init(void); void xtensa_breakpoint_handler(CPUState *cs); diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 249cd1e8c9..1b4767f58b 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -84,7 +84,7 @@ static void xtensa_sim_init(MachineState *machine) } =20 for (n =3D 0; n < smp_cpus; n++) { - cpu =3D cpu_xtensa_init(cpu_model); + cpu =3D XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)); if (cpu =3D=3D NULL) { error_report("unable to find CPU definition '%s'", cpu_model); diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 635a4d4ec3..182ec1e31c 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -232,7 +232,7 @@ static void lx_init(const LxBoardDesc *board, MachineSt= ate *machine) } =20 for (n =3D 0; n < smp_cpus; n++) { - cpu =3D cpu_xtensa_init(cpu_model); + cpu =3D XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)); if (cpu =3D=3D NULL) { error_report("unable to find CPU definition '%s'", cpu_model); diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index cd7f95823f..85897df0a8 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -100,9 +100,12 @@ static ObjectClass *xtensa_cpu_class_by_name(const cha= r *cpu_model) static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs =3D CPU(dev); + XtensaCPU *cpu =3D XTENSA_CPU(dev); XtensaCPUClass *xcc =3D XTENSA_CPU_GET_CLASS(dev); Error *local_err =3D NULL; =20 + xtensa_irq_init(&cpu->env); + cpu_exec_realizefn(cs, &local_err); if (local_err !=3D NULL) { error_propagate(errp, local_err); diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index bcd0b7738d..e8fba20918 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -113,28 +113,6 @@ void xtensa_breakpoint_handler(CPUState *cs) } } =20 -XtensaCPU *cpu_xtensa_init(const char *cpu_model) -{ - ObjectClass *oc; - XtensaCPU *cpu; - CPUXtensaState *env; - - oc =3D cpu_class_by_name(TYPE_XTENSA_CPU, cpu_model); - if (oc =3D=3D NULL) { - return NULL; - } - - cpu =3D XTENSA_CPU(object_new(object_class_get_name(oc))); - env =3D &cpu->env; - - xtensa_irq_init(env); - - object_property_set_bool(OBJECT(cpu), true, "realized", NULL); - - return cpu; -} - - void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf) { XtensaConfigList *core =3D xtensa_cores; --=20 2.13.5