linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "irqchip-bot for Guo Ren" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Vincent Pelletier <plr.vincent@gmail.com>,
	Nikita Shubin <nikita.shubin@maquefel.me>,
	Guo Ren <guoren@linux.alibaba.com>,
	stable@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Atish Patra <atish.patra@wdc.com>,
	Anup Patel <anup@brainfault.org>, Marc Zyngier <maz@kernel.org>
Subject: [irqchip: irq/irqchip-fixes] irqchip/sifive-plic: Fixup EOI failed when masked
Date: Fri, 12 Nov 2021 16:15:00 -0000	[thread overview]
Message-ID: <163673370017.414.6466255977362659814.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20211105094748.3894453-1-guoren@kernel.org>

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID:     69ea463021be0d159ab30f96195fb0dd18ee2272
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/69ea463021be0d159ab30f96195fb0dd18ee2272
Author:        Guo Ren <guoren@linux.alibaba.com>
AuthorDate:    Fri, 05 Nov 2021 17:47:48 +08:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Fri, 12 Nov 2021 16:09:51 

irqchip/sifive-plic: Fixup EOI failed when masked

When using "devm_request_threaded_irq(,,,,IRQF_ONESHOT,,)" in a driver,
only the first interrupt is handled, and following interrupts are never
delivered (initially reported in [1]).

That's because the RISC-V PLIC cannot EOI masked interrupts, as explained
in the description of Interrupt Completion in the PLIC spec [2]:

<quote>
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.
</quote>

Re-enable the interrupt before completion if it has been masked during
the handling, and remask it afterwards.

[1] http://lists.infradead.org/pipermail/linux-riscv/2021-July/007441.html
[2] https://github.com/riscv/riscv-plic-spec/blob/8bc15a35d07c9edf7b5d23fec9728302595ffc4d/riscv-plic.adoc

Fixes: bb0fed1c60cc ("irqchip/sifive-plic: Switch to fasteoi flow")
Reported-by: Vincent Pelletier <plr.vincent@gmail.com>
Tested-by: Nikita Shubin <nikita.shubin@maquefel.me>
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: stable@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
[maz: amended commit message]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211105094748.3894453-1-guoren@kernel.org
---
 drivers/irqchip/irq-sifive-plic.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index cf74cfa..259065d 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -163,7 +163,13 @@ static void plic_irq_eoi(struct irq_data *d)
 {
 	struct plic_handler *handler = this_cpu_ptr(&plic_handlers);
 
-	writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM);
+	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);
+	}
 }
 
 static struct irq_chip plic_chip = {

      parent reply	other threads:[~2021-11-12 16:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  9:47 [PATCH V7] irqchip/sifive-plic: Fixup EOI failed when masked guoren
2021-11-06 12:11 ` Aurelien Jarno
2021-11-06 13:28   ` Nikita Shubin
2021-11-06 13:45 ` Anup Patel
2021-11-07 13:09   ` Guo Ren
2021-11-07 13:13     ` Marc Zyngier
2021-11-06 14:26 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Guo Ren
2021-11-12 16:15 ` irqchip-bot for Guo Ren [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163673370017.414.6466255977362659814.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=anup@brainfault.org \
    --cc=atish.patra@wdc.com \
    --cc=guoren@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=nikita.shubin@maquefel.me \
    --cc=palmer@dabbelt.com \
    --cc=plr.vincent@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).