Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp62541pxf; Tue, 6 Apr 2021 15:03:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV7jjcmoXPeS0PvLswsiII7in3Hrp+siUQlFkoLWJyrrXAQeoXKkyc5PqbROassIlbuPRg X-Received: by 2002:a92:d58e:: with SMTP id a14mr311426iln.135.1617746626466; Tue, 06 Apr 2021 15:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617746626; cv=none; d=google.com; s=arc-20160816; b=gmUiakvtD4F4Sl0pdcaikMRMhryK0T1g7gjJYnUlBmxsq4ffGGBKt0as8KjFW5EazG ALUF9Q8nI9Za30Z6dZKxML2uXA/bHcKq22KjDG0ZfugcoSKyBdSWeW+SEHVbkP0dc4RJ sPZNwA08N4yCo7KxRO/vArhaAoP835PyBzIqpBDwbAAofkz/x5uTqX8mIoqWR6xSpy3Y Kc+kBw1kKe2mmcS1AQPEXigP4Ak9nYWtBHw9yGFs/nKYc3ywjJCKfADN1SRGP9BK4CuD SanDyEuyjBZHT4fmYvJdGw4CCjB4J6s4Tsy6Dk6rTIZ8BY3BAA6+H9/ZPUqLKCb4DXeX U61g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=3RoWnW6QMcwH4ObFyssBBcp8o+FLDLzu/ySzB0AASOQ=; b=DU3+3VACzt9hhX0YCMoktPLPqFpww1Hs8Tv1IvvL7dOXD7asE6ZSPllXlVY/5lZ+B5 RspEBu7e+PLBmmV55MYxJ95yrHdAGd05o42+p9cxDG42eqJaSaEkG0KzCVWASMGG/OcE merjKgsH39QuWouKX0Yz6pg40pKdOr4u+KdWgI3mhNMsi2GwyF+NswUGKEOx2iSUZ8gC oi+Z1TeWYbO/nyMwAFskUJhFtiRzg+6y2251yjUNqyTok/9i3cipxOOVKmfoOtgnvv+X Q6y75k2dbrkimaykiKQTeQRVVaowCXXF30Ip4NSfsUupVm3oroBf91TYh6q6RUb+gFkF 0UtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si18537805iod.10.2021.04.06.15.03.33; Tue, 06 Apr 2021 15:03:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243494AbhDFNCw convert rfc822-to-8bit (ORCPT + 99 others); Tue, 6 Apr 2021 09:02:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:52512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbhDFNCw (ORCPT ); Tue, 6 Apr 2021 09:02:52 -0400 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 Cc: Linux ARM , Linux Kernel Mailing List , "open list:BROADCOM NVRAM DRIVER" , linuxppc-dev , Linux-sh list , Daniel Mack , Robert Jarzmik , Haojian Zhuang , Yoshinori Sato , Rich Felker , Thomas Bogendoerfer , Michael Ellerman , Thomas Gleixner 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: 8BIT 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 06 Apr 2021 11:32:13 +0100, Geert Uytterhoeven wrote: > > Hi Marc, > > 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 > > Thanks for your patch! > > > --- a/drivers/sh/intc/core.c > > +++ b/drivers/sh/intc/core.c > > @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_desc_int *d, > > return 0; > > } > > > > +static bool __init intc_map(struct irq_domain *domain, int irq) > > +{ > > + int res; > > warning: unused variable ‘res’ [-Wunused-variable] > > > + > > + if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != 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_desc *desc) > > warning: unused variable ‘res’ [-Wunused-variable] Ah, thanks for spotting these. > > > if (!vect->enum_id) > > continue; > > > > - res = irq_create_identity_mapping(d->domain, irq); > > > > - if (unlikely(res)) { > > - if (res == -EEXIST) { > > - res = irq_domain_associate(d->domain, irq, irq); > > - if (unlikely(res)) { > > - pr_err("domain association failure\n"); > > - continue; > > - } > > - } else { > > - pr_err("can't identity map IRQ %d\n", irq); > > - 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); > > Otherwise this seems to work fine on real hardware (landisk) and qemu > (rts7751r2d). I did verify that the new function intc_map() is called. > > Tested-by: Geert Uytterhoeven Awesome, thanks Geert. M. -- Without deviation from the norm, progress is not possible.