Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2396135iof; Wed, 8 Jun 2022 04:12:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDylM20tGrb1fozfy7How3vtAUcECCcMlbHQ9F4AwkQf3yy/Yibry6h/dFuFnKqobipctL X-Received: by 2002:a05:6a00:1941:b0:50d:807d:530b with SMTP id s1-20020a056a00194100b0050d807d530bmr34223824pfk.17.1654686724911; Wed, 08 Jun 2022 04:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654686724; cv=none; d=google.com; s=arc-20160816; b=VT86V7Ta0CAFpOQl6rskJLMUqTG2V1VhWu5n9LadNL75wPioDXlkkt/An3ZLukUK7z YStfpJVTzEs4eiyJRvyB9YqNh7hk8heyEsKrIqm8jIRa/YSxmZL1hOZer4RdBxTVwmBN XNyAOvccVcSiFlcIib2rXk3NN7iYmb8O8ruJ3hEj88I3aqNBwTqjDnTRUVtkQsF3owzv +2Shh3EE0GGkfaUoOmbJ6ZKDgUo/f3ShKfoQru879oSyw+IC1RPsOJPqy39knZ7+kqlK gzSQxyeqUZjavd5Fzu+f4xSU4GUyMveigrFKXYPSI0cfmxCy4pLZvXsUSKg90008PL0f oxUw== 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=b47b0fT9XVL0AN+ilJ4dXSHeAzWS95mrsf41LPP+ll8=; b=BTKdn0sMmMQTaISytrjTtdxifAzxqy6oaYAkIiSZ3qBndruwD1I5GAdMbRsJlBddiM FgfD7D3A+dswBgixLbafcPnSEeM2Uza2aYG46Kr6DBt2aV9iIjLDCIe+dISr9MfcCxhk bbplpVc5UabRZwL58Is3+CLsJ6s+csn7xq88+W7EpeSzmpnasdiPoyTuv3V07qCaQAnl IwpgZ/oR8lRu+ayV7v6TXnwl1z0TcjK5S6jNvdQ0REqp9JqX86bro2/scvCJuDIlc5Tc jCG8UVYI4jQSl53tE5n1nDKRK7GGKWTgAnYqLVpioU3r1Kj9TPCyTEaaoF56X04RDVC6 TLxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uIzDWzys; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i186-20020a6387c3000000b003ab9d94aaccsi999645pge.328.2022.06.08.04.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 04:12:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uIzDWzys; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B9E931AE8F; Wed, 8 Jun 2022 03:36:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235886AbiFHKgH (ORCPT + 99 others); Wed, 8 Jun 2022 06:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239228AbiFHKfA (ORCPT ); Wed, 8 Jun 2022 06:35:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 669582A8918; Wed, 8 Jun 2022 03:28:32 -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 BC776B8261D; Wed, 8 Jun 2022 10:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77D39C34116; Wed, 8 Jun 2022 10:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654684071; bh=lS1qiuHW0eqGC4UvSS41hSkG8X/ge0lN3jktBcbYpeQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uIzDWzysJK3RpgucV/+5VsGzXWxaO6fP5yGSEYPvIXJmwtFHICwP48/4/V0OOTRWs 6sUs9zuTTWBK5+s5+3/qI2qGZO8sSOOa89OCEuAWV2/5Pnt7YCsr5sjuZnVkQ2PO4i e4CfjWU7p05jkRgdaNKSSNjnelPKCFy9gCLGu1/fGmdgRVoZIbhUIgW1xfHk1mh7LJ 5FHKBjNtVBqhEXyUofAD6rnv0kLRf3qc8VSaOpfZE9cqrsrx1DpwPg72MUApltdLBs kHrRRFplY42lOdHA1gMj1No+GJviikzawkmpP2TvrCYYoaS8D+OqzTDtzeWAwazsKp DxThBFjep7hzQ== 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.94.2) (envelope-from ) id 1nysui-00GZgf-22; Wed, 08 Jun 2022 11:27:49 +0100 Date: Wed, 08 Jun 2022 11:27:47 +0100 Message-ID: <87leu74fh8.wl-maz@kernel.org> From: Marc Zyngier To: "Lad, Prabhakar" Cc: Geert Uytterhoeven , Lad Prabhakar , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Sagar Kadam , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-riscv , LKML , Linux-Renesas , Phil Edworthy , Biju Das Subject: Re: [PATCH RFC 2/2] irqchip/sifive-plic: Add support for Renesas RZ/Five SoC In-Reply-To: References: <20220524172214.5104-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20220524172214.5104-3-prabhakar.mahadev-lad.rj@bp.renesas.com> <87r1414x5f.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, geert+renesas@glider.be, prabhakar.mahadev-lad.rj@bp.renesas.com, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, sagar.kadam@sifive.com, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, phil.edworthy@renesas.com, 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=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Tue, 07 Jun 2022 13:41:16 +0100, "Lad, Prabhakar" wrote: > > Hi Marc, > > On Mon, Jun 6, 2022 at 4:41 PM Marc Zyngier wrote: > > > > On Fri, 27 May 2022 12:05:38 +0100, > > "Lad, Prabhakar" wrote: > > > > > > I sometimes still see an interrupt miss! > > > > > > As per [0], we first need to claim the interrupt by reading the claim > > > register which needs to be done in the ack callback (which should be > > > doable) for edge interrupts, but the problem arises in the chained > > > handler callback where it does claim the interrupt by reading the > > > claim register. > > > > > > static void plic_handle_irq(struct irq_desc *desc) > > > { > > > struct plic_handler *handler = this_cpu_ptr(&plic_handlers); > > > struct irq_chip *chip = irq_desc_get_chip(desc); > > > void __iomem *claim = handler->hart_base + CONTEXT_CLAIM; > > > irq_hw_number_t hwirq; > > > > > > WARN_ON_ONCE(!handler->present); > > > > > > chained_irq_enter(chip, desc); > > > > > > while ((hwirq = readl(claim))) { > > > int err = generic_handle_domain_irq(handler->priv->irqdomain, > > > hwirq); > > > if (unlikely(err)) > > > pr_warn_ratelimited("can't find mapping for hwirq %lu\n", > > > hwirq); > > > } > > > > > > chained_irq_exit(chip, desc); > > > } > > > > > > I was thinking I would get around by getting the irqdata in > > > plic_handle_irq() callback using the irq_desc (struct irq_data *d = > > > &desc->irq_data;) and check the d->hwirq but this will be always 9. > > > > > > plic: interrupt-controller@12c00000 { > > > compatible = "renesas-r9a07g043-plic"; > > > #interrupt-cells = <2>; > > > #address-cells = <0>; > > > riscv,ndev = <543>; > > > interrupt-controller; > > > reg = <0x0 0x12c00000 0 0x400000>; > > > clocks = <&cpg CPG_MOD R9A07G043_NCEPLIC_ACLK>; > > > clock-names = "plic100ss"; > > > power-domains = <&cpg>; > > > resets = <&cpg R9A07G043_NCEPLIC_ARESETN>; > > > interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9>; > > > }; > > > > > > Any pointers on how this could be done sanely. > > > > Why doesn't the chained interrupt also get the ack-aware irq_chip? > > > Sorry for being naive, could you please elaborate on this. There are two main reasons why the above code fails: these interrupts are not using either - the irqchip you think they are using (which one then?), - the interrupt flow they should be using. Dumping /sys/kernel/debug/irq/irqs/$IRQ should give you a clue. Thanks, M. -- Without deviation from the norm, progress is not possible.