Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2814075iog; Mon, 27 Jun 2022 03:33:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1thfjk4tw3R+o62Y0jG987gKY6BUbX2jmqK+/4NMaNMjHf5i90DCeBbdh1jyrmgG+RIH/ne X-Received: by 2002:a05:6a00:ac1:b0:4f1:29e4:b3a1 with SMTP id c1-20020a056a000ac100b004f129e4b3a1mr14514111pfl.63.1656326037537; Mon, 27 Jun 2022 03:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326037; cv=none; d=google.com; s=arc-20160816; b=suEVzgBgArR0pNcR1w3yvgfKyF0t0EVApkWCPnD+pl9T+OF6Zh0fbf7I9ZQwVTi61X Lx356Fc4B6MZCAUPqosjno0mxtPameWLWIkyvBZhbfCo4wCWa0TbOfwIBSLeGUukNZ7C wm+Q5hOHud6WP6SWQdTwomahJJKagA/zqRsYToxlBfDvYNq15MakTJk5SQxCsUJPJmjG pZxripJBQQgEkROIFRAqfPEpuxIC6H6ArxssEs737PXES8GBfaMFE7L4wvxawXyWJQvN ct1wTLwasvbHqG2XPKRY6zLMieOsXr7k5BN8P5pJxUPu8EYFABjCe26L3w6oDOfZYUN/ 8cFQ== 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=sm4I15ww/IscEmERNpF+7mYJReT58sx17tnu+yf3E9s=; b=RZXmxx//xpmbp4qAdDWqQu3KLJ3sq3VcCIhkILQBsU8w/5hU//e9fATsXtDhTYw17W tXX+VJQzHNcB8yzafiFM6XenCjYUexX3aRoblYzKLuaJ5qO5GPnYDF2b8bQXgqxvTWOe gOiE1pRdbNpm7sizDzNK2bNf5Bknga8XNCxYZKcmHjsOmNh0YcgF+YIFyWqgL+mW+QBk YntVwV7aH8CVPNqXpVimh1PZK5i+krkefHPwrioVQRP+uRPM49HNkn5jbrT90G6trjGz jqwBipXF0ihQ8e1TIqr3apf/aMldtk0peJ5mt+BBNY8VYbkUB4UlC9NNR3yX1lkKoQxx 8jog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G0lRwuQ5; 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 l15-20020a170903120f00b0016a4da2313dsi17295928plh.171.2022.06.27.03.33.41; Mon, 27 Jun 2022 03:33:57 -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=G0lRwuQ5; 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 S232023AbiF0KLb (ORCPT + 99 others); Mon, 27 Jun 2022 06:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231776AbiF0KL2 (ORCPT ); Mon, 27 Jun 2022 06:11:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FDDF6401; Mon, 27 Jun 2022 03:11:27 -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 BF161B8106E; Mon, 27 Jun 2022 10:11:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66AF1C3411D; Mon, 27 Jun 2022 10:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656324684; bh=uM9Jg0xWGjqPi0Q4iaOPjmzP/20updvm1fUGxrOmNGM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=G0lRwuQ5A6e7SuAtuHgJhvkJ9nOwh4bP0BSZ2uoYhzGNN347xKLZ79PT5l8WJS9Fg la8tZGg6YkAYUreLjih3n5IgGhpBnNyTBCaHlHkyky1F9M1t/CdfpKqVv+3KwCOd4O 0isOnQEIG3vwdUGH2JP26UKlfCyGJ/xeslFDLpXBYKGA/pYeQIr5EhKXL9T04l+ZgW h+RMJ/Q+2e5qD3xI62wre8v3GzN9Vp3jf54EfdTxKeTP32Ee2H5dM1MdnxscqM1V9w dSb54w2w8hFtwfi5NfH+n7NuVkQXK2gH0Fj8kV2HpzRF5QIkmslMz/+vNhbsm542aw DCCoNxhorI2fw== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.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 1o5liE-003OOJ-5W; Mon, 27 Jun 2022 11:11:22 +0100 Date: Mon, 27 Jun 2022 11:11:21 +0100 Message-ID: <87a69y2z7a.wl-maz@kernel.org> From: Marc Zyngier To: Geert Uytterhoeven Cc: "Lad, Prabhakar" , 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> <87v8snehwi.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: geert@linux-m68k.org, 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 Mon, 27 Jun 2022 09:53:13 +0100, Geert Uytterhoeven wrote: > > Hi Marc, > > On Sun, Jun 26, 2022 at 2:19 PM Marc Zyngier wrote: > > On Sun, 26 Jun 2022 10:38:18 +0100, > > "Lad, Prabhakar" wrote: > > > 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 > > > > > > + 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. > > What about using a feature flag (e.g. had_edge_irqs) instead? Sure. Then make this an unsigned long, and have a set of quirk bits, because I expect this to grow quickly. > > > It almost feels like I've written this whole patch. Oh wait... > > > Without deviation from the norm, progress is not possible. > > How applicable ;-) I'm not sure there is any sign of progress here, and evolution through random mutation has a pretty massive failure rate. Thanks, M. -- Without deviation from the norm, progress is not possible.