Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1671190pxb; Thu, 28 Oct 2021 08:00:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+xQz93aop80LoJtwnpn3xbT9TpPfrqSuGor6BNDLr1ZaFgQRXAsB/IVytlhSeLqqFwM0x X-Received: by 2002:a17:906:1cd1:: with SMTP id i17mr6014310ejh.205.1635433246889; Thu, 28 Oct 2021 08:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635433246; cv=none; d=google.com; s=arc-20160816; b=wR26AHqHscpBG0mKNaM2/s/kR/eEpzh1TkynkfNnHthuHpIosUq9HTq/+eoWklPmiw rfOPsWkgBuDCzZUOQk8OHHd2etyVfj+0Ib6SN9t8Rieaq77kddAekMCEL29EyYVqXTWS W4Kbfb/cYbi6Am2PGF2vn/YIdHGgYpjFRdwpEXN7E4vmIRJWML2CUHP6oyFnR71EjFFI 0LD+5htwD17Pz6dflFmV/CexZmn+j78fXbE4Dce3dyldsDWVIZkRWGFAaqXflorFr5WG YgJY426LhPRJ+FOJgX8o0cSx7puHKNUrJjk+J7QVcTKjJJ0U/uvH5rRzzj8A6SHld8FW LiOA== 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; bh=9+PWGgC+WPXSPSP2Ho4tj8BPcolmZGdDheniL0s9IZg=; b=olw97prdnGPUzVGoEkDne2/WNJuyTwaB0ERwIpca01bkdbTRZsnJqskr30gEF/pLjW /DztlyaictUmhFeroeUXHGGl1grH9C7GZ7KVBIYgXf+BgUf4et+N/q9EacjP6D39m1J8 b3PgULkydQh0DrJi01D30VPSx7PNqSB5vlE/xQ0l3i07e7XE13YdEAwIQc5Iwi1VeMUC 49qsJrAQa3N3n/QdCBnNexwkfkCs4F8GccM7+b6ifDwPgMAqeNmq1q5Tve2kyrPA0KJx F0zJ3KgeBUNW+tD6dKgYtsyi/flO43pLLAzt+D9zr5nUIEZQAs6AwhwU0VbAxClzArNO HgyA== 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 a6si2849678edt.81.2021.10.28.08.00.21; Thu, 28 Oct 2021 08:00: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 S231351AbhJ1PAw (ORCPT + 99 others); Thu, 28 Oct 2021 11:00:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:60552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbhJ1PAt (ORCPT ); Thu, 28 Oct 2021 11:00:49 -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 55D9F6112F; Thu, 28 Oct 2021 14:58:22 +0000 (UTC) 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 1mg6rE-002ErX-DD; Thu, 28 Oct 2021 15:58:20 +0100 Date: Thu, 28 Oct 2021 15:58:19 +0100 Message-ID: <87sfwl9oxg.wl-maz@kernel.org> From: Marc Zyngier To: Nikita Shubin Cc: guoren@kernel.org, anup@brainfault.org, atish.patra@wdc.com, tglx@linutronix.de, palmer@dabbelt.com, heiko@sntech.de, robh@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren Subject: Re: [PATCH V5 3/3] irqchip/sifive-plic: Fixup thead, c900-plic request_threaded_irq with ONESHOT In-Reply-To: <20211028135523.5cf4b66b@redslave.neermore.group> References: <20211024013303.3499461-1-guoren@kernel.org> <20211024013303.3499461-4-guoren@kernel.org> <87a6ixbcse.wl-maz@kernel.org> <20211028135523.5cf4b66b@redslave.neermore.group> 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: nikita.shubin@maquefel.me, guoren@kernel.org, anup@brainfault.org, atish.patra@wdc.com, tglx@linutronix.de, palmer@dabbelt.com, heiko@sntech.de, robh@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, guoren@linux.alibaba.com 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 Thu, 28 Oct 2021 11:55:23 +0100, Nikita Shubin wrote: > > Hello Marc and Guo Ren! > > On Mon, 25 Oct 2021 11:48:33 +0100 > Marc Zyngier wrote: > > > On Sun, 24 Oct 2021 02:33:03 +0100, > > guoren@kernel.org wrote: > > > > > > From: Guo Ren > > > > > > When using "devm_request_threaded_irq(,,,,IRQF_ONESHOT,,)" in the > > > driver, only the first interrupt could be handled, and continue irq > > > is blocked by hw. Because the thead,c900-plic couldn't complete > > > masked irq source which has been disabled in enable register. Add > > > thead_plic_chip which fix up c906-plic irq source completion > > > problem by unmask/mask wrapper. > > > > > > Here is the description of Interrupt Completion in PLIC spec [1]: > > > > > > The PLIC signals it has completed executing an interrupt handler by > > > writing the interrupt ID it received from the claim to the > > > claim/complete register. The PLIC does not check whether the > > > completion ID is the same as the last claim ID for that target. If > > > the completion ID does not match an interrupt source that is > > > currently enabled for the target, the ^^ ^^^^^^^^^ ^^^^^^^ > > > completion is silently ignored. > > > > Given this bit of the spec... > > > > > +static void plic_thead_irq_eoi(struct irq_data *d) > > > +{ > > > + struct plic_handler *handler = > > > this_cpu_ptr(&plic_handlers); + > > > + if (irqd_irq_masked(d)) { > > > + plic_irq_unmask(d); > > > + writel(d->hwirq, handler->hart_base + > > > CONTEXT_CLAIM); > > > + plic_irq_mask(d); > > > + } else { > > > + writel(d->hwirq, handler->hart_base + > > > CONTEXT_CLAIM); > > > + } > > > +} > > > + > > > > ... it isn't obvious to me why this cannot happen on an SiFive PLIC. > > This indeed happens with SiFive PLIC. I am currently tinkering with > da9063 RTC on SiFive Unmatched, and ALARM irq fires only once. However > with changes proposed by Guo Ren in plic_thead_irq_eoi, everything > begins to work fine. > > May be these change should be propagated to plic_irq_eoi instead of > making a new function ? That's my impression too. I think the T-Head defect is pretty much immaterial when you consider how 'interesting' the PLIC architecture is. Conflating EOI and masking really is a misfeature... M. -- Without deviation from the norm, progress is not possible.