From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E275C4829B for ; Mon, 12 Feb 2024 11:26:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZURm-00017l-RH; Mon, 12 Feb 2024 06:26:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZUR5-0000hl-E2; Mon, 12 Feb 2024 06:25:19 -0500 Received: from ik1-413-38519.vs.sakura.ne.jp ([153.127.30.23] helo=sakura.ysato.name) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZUQy-0004EF-5l; Mon, 12 Feb 2024 06:25:17 -0500 Received: from SIOS1075.ysato.ml (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by sakura.ysato.name (Postfix) with ESMTPSA id 880AD1C0210; Mon, 12 Feb 2024 20:25:06 +0900 (JST) Date: Mon, 12 Feb 2024 20:25:06 +0900 Message-ID: <87mss5hqlp.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: Philippe =?ISO-8859-1?Q?Mathieu-Daud=E9?= Cc: qemu-devel@nongnu.org, Mark Cave-Ayland , Zhao Liu , Paolo Bonzini , qemu-block@nongnu.org, John Snow , qemu-ppc@nongnu.org, Eduardo Habkost , Richard Henderson , Markus Armbruster Subject: Re: [PATCH v3 03/11] hw/rx/rx62n: Only call qdev_get_gpio_in() when necessary In-Reply-To: <20240208181245.96617-4-philmd@linaro.org> References: <20240208181245.96617-1-philmd@linaro.org> <20240208181245.96617-4-philmd@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Received-SPF: softfail client-ip=153.127.30.23; envelope-from=ysato@users.sourceforge.jp; helo=sakura.ysato.name X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.252, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Fri, 09 Feb 2024 03:12:36 +0900, Philippe Mathieu-Daud=E9 wrote: >=20 > Instead of filling an array of all the possible IRQs, only call > qdev_get_gpio_in() when an IRQ is used. Remove the array from > RX62NState. Doing so we avoid calling qdev_get_gpio_in() on an > unrealized device. >=20 > Signed-off-by: Philippe Mathieu-Daud=E9 > --- > include/hw/rx/rx62n.h | 1 - > hw/rx/rx62n.c | 16 ++++++++-------- > 2 files changed, 8 insertions(+), 9 deletions(-) >=20 > diff --git a/include/hw/rx/rx62n.h b/include/hw/rx/rx62n.h > index bcda583ab3..766fe0e435 100644 > --- a/include/hw/rx/rx62n.h > +++ b/include/hw/rx/rx62n.h > @@ -67,7 +67,6 @@ struct RX62NState { > MemoryRegion iomem2; > MemoryRegion iomem3; > MemoryRegion c_flash; > - qemu_irq irq[NR_IRQS]; > =20 > /* Input Clock (XTAL) frequency */ > uint32_t xtal_freq_hz; > diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c > index d3f61a6837..560f53a58a 100644 > --- a/hw/rx/rx62n.c > +++ b/hw/rx/rx62n.c > @@ -148,14 +148,11 @@ static void register_icu(RX62NState *s) > qlist_append_int(trigger_level, levelirq[i]); > } > qdev_prop_set_array(DEVICE(icu), "trigger-level", trigger_level); > - > - for (i =3D 0; i < NR_IRQS; i++) { > - s->irq[i] =3D qdev_get_gpio_in(DEVICE(icu), i); > - } > sysbus_realize(icu, &error_abort); > + > sysbus_connect_irq(icu, 0, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_= IRQ)); > sysbus_connect_irq(icu, 1, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_= FIR)); > - sysbus_connect_irq(icu, 2, s->irq[SWI]); > + sysbus_connect_irq(icu, 2, qdev_get_gpio_in(DEVICE(&s->icu), SWI)); > sysbus_mmio_map(icu, 0, RX62N_ICU_BASE); > } > =20 > @@ -172,7 +169,8 @@ static void register_tmr(RX62NState *s, int unit) > =20 > irqbase =3D RX62N_TMR_IRQ + TMR_NR_IRQ * unit; > for (i =3D 0; i < TMR_NR_IRQ; i++) { > - sysbus_connect_irq(tmr, i, s->irq[irqbase + i]); > + sysbus_connect_irq(tmr, i, > + qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i= )); > } > sysbus_mmio_map(tmr, 0, RX62N_TMR_BASE + unit * 0x10); > } > @@ -190,7 +188,8 @@ static void register_cmt(RX62NState *s, int unit) > =20 > irqbase =3D RX62N_CMT_IRQ + CMT_NR_IRQ * unit; > for (i =3D 0; i < CMT_NR_IRQ; i++) { > - sysbus_connect_irq(cmt, i, s->irq[irqbase + i]); > + sysbus_connect_irq(cmt, i, > + qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i= )); > } > sysbus_mmio_map(cmt, 0, RX62N_CMT_BASE + unit * 0x10); > } > @@ -209,7 +208,8 @@ static void register_sci(RX62NState *s, int unit) > =20 > irqbase =3D RX62N_SCI_IRQ + SCI_NR_IRQ * unit; > for (i =3D 0; i < SCI_NR_IRQ; i++) { > - sysbus_connect_irq(sci, i, s->irq[irqbase + i]); > + sysbus_connect_irq(sci, i, > + qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i= )); > } > sysbus_mmio_map(sci, 0, RX62N_SCI_BASE + unit * 0x08); > } > --=20 > 2.41.0 >=20 Reviewed-by: Yoshinori Sato --=20 Yosinori Sato