Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp92038pxb; Mon, 25 Oct 2021 04:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgQrKvpHOdPtHRuCaJVYRU+Pupe94vytyvi0LhLtIeBzhkYM00g5kNZNA+TjiLHKcaxmYw X-Received: by 2002:a17:906:9bf9:: with SMTP id de57mr5974334ejc.35.1635161613833; Mon, 25 Oct 2021 04:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635161613; cv=none; d=google.com; s=arc-20160816; b=ZcgEMLqXUKgf/cu+EXmAirGHZeV96bZei+IsxE+e3bFe8tBuXhQ+la3ROEdm+W4Zxc UOrCPtBGhhMl4rO3KyGayyWDiFEfmxJWUIJK5m3yRxj/V9t3JLSxlTiQIKdHhM8MiNmY BNwwXUE3lUL1fLU7SDyTLtQyvwKbD+IqrWcZ9/mHRMh65aBadXAJQogDJGkueGebcmEW 9F2BmsG7gciM92RP8A3IzDk80UckEhqO+zM3M1zfg8d7eImvSyySoZOc+O/2lu6U2Wgz +WDHQiDy8XIWtwqYEsy5NTAL1B7ZlKdwkBXV6Fgcnzsijqys1BJG2Kb0J5d3gzo+nWnl 2VCA== 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=HFe7tXhnMz5vU/0rlWd2hSSdyOiPM6DEQwHbzhChvsc=; b=uDOlC6MNjGTUsGuvJsrc0UQHiHeLDfWuqb6BNDOufVJuqzRRYqTUmWY1JAHG6Gt9kS W3hoJ4nBF5cyN5pb5hNyLZOpNSuAUKs2eo1QzYGuvAn2+LEnp4hMZqyAti38OcAzzK/+ ex1wqR4mmlpRCKuLduN8Ol2XGN0y3xejArTNWUeSxN+jcM8J0G/OS55iztzroFSq1dgF G8b82+fVTS9Xzy/7Alf5FeLLRC3XCj9x0gWjCtZ0xlNU0pEBF4fAlqzrpcBon6ew7VTC Ar9wUqk6prSMHolagcfD4O+ut54Y0iy6ayQC+V+YM/7uognd4mJNsCoDMVdRxU2BQ2/M +FZw== 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 cw1si22212881ejc.750.2021.10.25.04.33.10; Mon, 25 Oct 2021 04:33:33 -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 S230156AbhJYKvB (ORCPT + 99 others); Mon, 25 Oct 2021 06:51:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbhJYKu6 (ORCPT ); Mon, 25 Oct 2021 06:50:58 -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 3C65560FDC; Mon, 25 Oct 2021 10:48:36 +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 1mexWr-001L6M-VV; Mon, 25 Oct 2021 11:48:34 +0100 Date: Mon, 25 Oct 2021 11:48:33 +0100 Message-ID: <87a6ixbcse.wl-maz@kernel.org> From: Marc Zyngier To: guoren@kernel.org Cc: 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: <20211024013303.3499461-4-guoren@kernel.org> References: <20211024013303.3499461-1-guoren@kernel.org> <20211024013303.3499461-4-guoren@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: 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 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. And it isn't only for threaded interrupts in oneshot mode. Any driver can mask an interrupt from its handler after having set the IRQ_DISABLE_UNLAZY flag, and the interrupt would need the exact same treatment. M. -- Without deviation from the norm, progress is not possible.