Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2053717iog; Sun, 26 Jun 2022 05:36:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sFenP75GT31/MrvRhXDRc5eGs/X8KnDDfxvvxfDMJr+Pd/CQ2Xqw6KlIeVRl71V/VnDcJW X-Received: by 2002:a17:906:9b94:b0:722:f2a1:efb9 with SMTP id dd20-20020a1709069b9400b00722f2a1efb9mr7847433ejc.42.1656247013279; Sun, 26 Jun 2022 05:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656247013; cv=none; d=google.com; s=arc-20160816; b=y/mA7MCvAYOsL5iE4vvaSVzuueZ0MBTib6YIglOWndEgyvXZhIPhSJ3CVkO0voDWYA wbb69pEPQaqx5/HQ0I5HKl6yYDrTGwUzwOS7h64CTBBjpudhVgo1VGpuHbnBcLRBF1ph oAM87WtjCcFuGUxgw5FD/PFc51qP6xVtltkYfHvLQAa/4IRYIDEF54zuOHJPzFIda7eX yZMCyBIHKdlbRBsnvkZ9wAoGmmdZ92pkNuu3e+p66Qu8MjeVknYAd+nf7YaxmUIJTfSF tp4WYkw1+LfZdfimlyM98d3DbgTeVzuPFyBVHRwotT9nyHrSmiORqiJeDPGZzLLD8jdI eZnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=DeloHysCuKYzE+ePNUDbXKZctKfaV3moNH7+kgb2r/s=; b=Tw44Go3V0UfcUQJK8NiuktriXKPNa54Y6GiY2fuL9DQP9MnmWZhyak8Ph1TFU3tGss KpcR9kajPw6VyMZFkxwzYMbnPqpz03WUf5o/kWOJ8aqmSacMTCqE7hF6hXG36LNTvju0 NA/We13MQp+Q6VW+fAZc67RXgeMXUzGJlFvR6W1TlkQKPEyxaicpKvDJbGaR7llxz8uK yqKtcW6FKf+kEv/67waIPRsoGYDbk3lHSDJfxUcYxh/RXVoqONrcYo9faHtG+2mcK1Y+ UxRqU066HLVz+TgYEzpIBqAHYrmfWbxf5QgEJdrsCcV4vvNqCqaqp694R4XAzXYaR2tn C0gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="TYar2W/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a50f10e000000b004355261f78csi9578848edl.531.2022.06.26.05.36.28; Sun, 26 Jun 2022 05:36:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="TYar2W/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234436AbiFZMTl (ORCPT + 99 others); Sun, 26 Jun 2022 08:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234299AbiFZMTk (ORCPT ); Sun, 26 Jun 2022 08:19:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA9B0DFEE; Sun, 26 Jun 2022 05:19:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A1FA1B80D8C; Sun, 26 Jun 2022 12:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30185C34114; Sun, 26 Jun 2022 12:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656245976; bh=e9Kxi48rcO/WhIBif/j/W/eQk+T5/MunSN0PVg43DTM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TYar2W/jJdY73jLP/CvHuZNECwQfcOAA+VddWRkqUAYAHo45gMnvbwxH/xlf7M3My DJFJfEk3xKlw8ipW2RISVEifrklH12d9S4u1vNea0vQleMjrIxjW5nbogj1MPLScp5 wHsdV2RAXlBhL9dAejNZEa+3S3mcDhj4z//DfnflCgIkeQL9exmwwZ+anJxxelq2oX rbOyRUChChOXQcdbT/pwZ+5coFoR+zGjb0h2T5tqscrL5lGC3Y+p19ttG9CfgA5DUf 0183rjcP+jbXnORzPGsMkAGSSVdZ0/ZQi/IcaYySVIny9FtzDiTDEp9067NR5wZeIB mXq2zvy+77Sww== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o5REj-003Cfx-Ie; Sun, 26 Jun 2022 13:19:33 +0100 Date: Sun, 26 Jun 2022 13:19:41 +0100 Message-ID: <87v8snehwi.wl-maz@kernel.org> From: Marc Zyngier To: "Lad, Prabhakar" Cc: Lad Prabhakar , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Sagar Kadam , Palmer Dabbelt , Paul Walmsley , linux-riscv , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Geert Uytterhoeven , Linux-Renesas , LKML , Biju Das Subject: Re: [PATCH v2 2/2] irqchip/sifive-plic: Add support for Renesas RZ/Five SoC In-Reply-To: References: <20220626004326.8548-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220626004326.8548-3-prabhakar.mahadev-lad.rj@bp.renesas.com> <87wnd3erab.wl-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=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: prabhakar.csengg@gmail.com, prabhakar.mahadev-lad.rj@bp.renesas.com, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sagar.kadam@sifive.com, palmer@dabbelt.com, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, geert+renesas@glider.be, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, biju.das.jz@bp.renesas.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 26 Jun 2022 10:38:18 +0100, "Lad, Prabhakar" wrote: > > Hi Marc, > > Thank you for the review. > > On Sun, Jun 26, 2022 at 9:56 AM Marc Zyngier wrote: > > > > On Sun, 26 Jun 2022 01:43:26 +0100, > > Lad Prabhakar wrote: > > > > > > The Renesas RZ/Five SoC has a RISC-V AX45MP AndesCore with NCEPLIC100. The > > > NCEPLIC100 supports both edge-triggered and level-triggered interrupts. In > > > case of edge-triggered interrupts NCEPLIC100 ignores the next interrupt > > > edge until the previous completion message has been received and > > > NCEPLIC100 doesn't support pending interrupt counter, hence losing the > > > interrupts if not acknowledged in time. > > > > > > So the workaround for edge-triggered interrupts to be handled correctly > > > and without losing is that it needs to be acknowledged first and then > > > handler must be run so that we don't miss on the next edge-triggered > > > interrupt. > > > > > > This patch adds a new compatible string for Renesas RZ/Five SoC and adds > > > support to change interrupt flow based on the interrupt type. It also > > > implements irq_ack and irq_set_type callbacks. > > > > > > Signed-off-by: Lad Prabhakar > > > --- > > > v1->v2: > > > * Implemented IRQ flow as suggested by Marc > > > > > > RFC-->v1: > > > * Fixed review comments pointed by Geert > > > * Dropped handle_fasteoi_ack_irq support as for the PLIC we need to > > > claim the interrupt by reading the register and then acknowledge it. > > > * Add a new chained handler for RZ/Five SoC. > > > --- > > > drivers/irqchip/Kconfig | 1 + > > > drivers/irqchip/irq-sifive-plic.c | 73 ++++++++++++++++++++++++++++++- > > > 2 files changed, 72 insertions(+), 2 deletions(-) > > [...] > > > + if (of_device_is_compatible(node, "renesas,r9a07g043-plic")) { > > > + priv->of_data = RENESAS_R9A07G043_PLIC; > > > + plic_chip.name = "Renesas RZ/Five PLIC"; > > > > NAK. The irq_chip structure isn't the place for platform marketing. > > This is way too long anyway (and same for the edge version), and you > > even sent me a patch to make that structure const... > > > My bad will drop this. And why you're at it, please turn this rather random 'of_data' into something like: diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index bb87e4c3b88e..cd1683b77caf 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -64,6 +64,10 @@ struct plic_priv { struct cpumask lmask; struct irq_domain *irqdomain; void __iomem *regs; + enum { + VANILLA_PLIC, + RENESAS_R9A07G043_PLIC, + } flavour; }; struct plic_handler { to give some structure to the whole thing, because I'm pretty sure we'll see more braindead implementations as time goes by. It almost feels like I've written this whole patch. Oh wait... M. -- Without deviation from the norm, progress is not possible.