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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FCD6C433ED for ; Tue, 6 Apr 2021 13:03:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69F8C6117A for ; Tue, 6 Apr 2021 13:03:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69F8C6117A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FF74C5G8Dz3bvX for ; Tue, 6 Apr 2021 23:03:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=maz@kernel.org; receiver=) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FF73q24Hlz2yxq for ; Tue, 6 Apr 2021 23:02:47 +1000 (AEST) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 19E9F613CA; Tue, 6 Apr 2021 13:02:44 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lTlLu-005rUM-0s; Tue, 06 Apr 2021 14:02:42 +0100 Date: Tue, 06 Apr 2021 14:02:41 +0100 Message-ID: <87im4zpnv2.wl-maz@kernel.org> From: Marc Zyngier To: Geert Uytterhoeven Subject: Re: [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping() In-Reply-To: References: <20210406093557.1073423-1-maz@kernel.org> <20210406093557.1073423-5-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (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=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: geert@linux-m68k.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, daniel@zonque.org, robert.jarzmik@free.fr, haojian.zhuang@gmail.com, ysato@users.sourceforge.jp, dalias@libc.org, tsbogend@alpha.franken.de, mpe@ellerman.id.au, tglx@linutronix.de X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , Yoshinori Sato , Linux-sh list , Robert Jarzmik , Linux Kernel Mailing List , Haojian Zhuang , "open list:BROADCOM NVRAM DRIVER" , Thomas Bogendoerfer , Linux ARM , Thomas Gleixner , linuxppc-dev , Daniel Mack Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, 06 Apr 2021 11:32:13 +0100, Geert Uytterhoeven wrote: >=20 > Hi Marc, >=20 > On Tue, Apr 6, 2021 at 11:44 AM Marc Zyngier wrote: > > Instead of playing games with using irq_create_identity_mapping() > > and irq_domain_associate(), drop the use of the former and only > > use the latter, together with the allocation of the irq_desc > > as needed. > > > > It doesn't make the code less awful, but at least the intent > > is clearer. > > > > Signed-off-by: Marc Zyngier >=20 > Thanks for your patch! >=20 > > --- a/drivers/sh/intc/core.c > > +++ b/drivers/sh/intc/core.c > > @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_de= sc_int *d, > > return 0; > > } > > > > +static bool __init intc_map(struct irq_domain *domain, int irq) > > +{ > > + int res; >=20 > warning: unused variable =E2=80=98res=E2=80=99 [-Wunused-variable] >=20 > > + > > + if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != =3D irq) { > > + pr_err("uname to allocate IRQ %d\n", irq); > > + return false; > > + } > > + > > + if (irq_domain_associate(domain, irq, irq)) { > > + pr_err("domain association failure\n"); > > + return false; > > + } > > + > > + return true; > > +} > > + > > int __init register_intc_controller(struct intc_desc *desc) > > { > > unsigned int i, k, smp; > > @@ -316,19 +333,8 @@ int __init register_intc_controller(struct intc_de= sc *desc) >=20 > warning: unused variable =E2=80=98res=E2=80=99 [-Wunused-variable] Ah, thanks for spotting these. >=20 > > if (!vect->enum_id) > > continue; > > > > - res =3D irq_create_identity_mapping(d->domain, irq); >=20 >=20 > > - if (unlikely(res)) { > > - if (res =3D=3D -EEXIST) { > > - res =3D irq_domain_associate(d->domain,= irq, irq); > > - if (unlikely(res)) { > > - pr_err("domain association fail= ure\n"); > > - continue; > > - } > > - } else { > > - pr_err("can't identity map IRQ %d\n", i= rq); > > - continue; > > - } > > - } > > + if (!intc_map(d->domain, irq)) > > + continue; > > > > intc_irq_xlate_set(irq, vect->enum_id, d); > > intc_register_irq(desc, d, vect->enum_id, irq); >=20 > Otherwise this seems to work fine on real hardware (landisk) and qemu > (rts7751r2d). I did verify that the new function intc_map() is called. >=20 > Tested-by: Geert Uytterhoeven Awesome, thanks Geert. M. --=20 Without deviation from the norm, progress is not possible.