Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4415897pxb; Sat, 6 Nov 2021 13:31:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6JqeDFPq3BqN+ivhJnJB9+Be122XtMAxVHMHIUPOrMn0IAQXspWFioSgKs2sybBolPu5G X-Received: by 2002:a05:6402:3488:: with SMTP id v8mr65062728edc.170.1636230672530; Sat, 06 Nov 2021 13:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636230672; cv=none; d=google.com; s=arc-20160816; b=kvAO4xmG5f/7eveap/khu3Lo1Bj9LlKA1jaWbHoqH5ikp10uDbI2pjuRXXl77y+OeK 6mMlIVZAd7AkKB2KAG8PAj0RgXdkgJDDf+C1gVuwxjdSZxDhug0wJh/C0HKtDeD+tIXf ZhNxtvfReqdHv5BEQI147oeIH3n8hXYKOVPeFCDh40ct0FeJ7Ba9eTXBx8seWjNhypFM 6RlTrfMgbpnMAqidiUI97yPsZIADz5bD+fcOzGJxWdVg74am322PjROUjeB1j68eCaVd 0z2goIp4txcEque4YQFz2buggSnHKi5Dc3+OVAu81Z1xF8xHHaqSGagSHNryQdoLNhH/ 3COA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f31WRtxRAaJ1ReHamccwuYw+KLj+c2LCAREJ/bMMV3c=; b=S11Y1I7lXHLBKxQ8yBCTw815JawFP4OuSXUntmKlGlc/AsqEYZRkK0VBpygy2lfQ6T ciYW+EmzsiwA+xjnZnX0njLTMardHGVxMiDqtuNjKWrlBSCC7I4w+Ejro8lfE05nv/DH m1VAzmzJ0z1P/YcpCZ1V/+yyK1lb6tctYeekrDjaoDa6TlwCjombDAdLueC/KNrUrc8r E71O0NyM8cqKYNwUmEw7A2+eD0WdTrO9iYjOnKWZNXGrgA/R6I0GmDHJ4iQjQbcyEdxz Xu1yr5vKksFtK1dlDDdN3tlJeWvI0b9DQfgsfgdLniF5Rzr3YiZUEBp6VEwLWWaeKb2i 7XwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=wVf6Mdvf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z19si27409555edd.559.2021.11.06.13.30.33; Sat, 06 Nov 2021 13:31:12 -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; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=wVf6Mdvf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbhKFNsU (ORCPT + 99 others); Sat, 6 Nov 2021 09:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbhKFNsT (ORCPT ); Sat, 6 Nov 2021 09:48:19 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EFCCC061714 for ; Sat, 6 Nov 2021 06:45:38 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id r8so18183942wra.7 for ; Sat, 06 Nov 2021 06:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f31WRtxRAaJ1ReHamccwuYw+KLj+c2LCAREJ/bMMV3c=; b=wVf6Mdvfbfy0yyKVtJHy/4iYqp5dIVOo2qoWCmcFQtgMiH/3/R11fcbR8fVyHf9ULK LFjkHWCwbH+UjVtZOB7ILZc7NSGCobw0HEnrp7pRXRpkoQYhSQ6bnNat6e5m1ZZUrBxM Fay/r9bYykJC/OpZGjwlX8XieYgZ2Jd2/8YDf8X3nT4r0Ht8HqQAGJwW+8AzrcqLtcNc 7Efc7T9cO52SWaYRHpk9VoZKUVd+dTz2Xhx3XtLYKe9c9olJZd75ycov8kISJkaOy5Pd nEua5M0ov4f4KVG9S7P8N0LISg5CCt/YXD4ockptHfcDQaLjzPWS01MhpsPVHD01mD1A o6FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f31WRtxRAaJ1ReHamccwuYw+KLj+c2LCAREJ/bMMV3c=; b=dtEGu0NCPdx03sN84QHobdvOl/1EigtE2cnsiE5kcGf7PWy7s0geeKmhCkn8b49tzN POmKhH4kw47aOpgA7nJLhwEDkUrc9pwcz0CE1GmIdc/763G2uXQJupYXE+9Wt9tfX0Od SngiJynjqkxY/qCZ62/qwPu6dgFWmt9GtF4g7PGiKnCGHAwnkI/tBeFVL0IhOjTyeeLm qMnzdSlT1unnibC721ini+cmvqG5/COLE+F6hY4b97FedmIwB7orwCHgnEXtVZz7p5UB MHlnE5vUbvDf5d4eifONadkdWLRqGOclH6Mx6zanIO/kG8J7C/WGny0x15rTIlWta1zc XDQw== X-Gm-Message-State: AOAM5315mxjPEY/6Z314JQ0DXkCLNTNAobM0k3D7GqgeFzhwlp3NGwYJ 4EY3V/pmxwnNteY1YwtZWHyQsYGL5OlwzAfrAg2eRQ== X-Received: by 2002:a5d:4846:: with SMTP id n6mr36037840wrs.249.1636206336953; Sat, 06 Nov 2021 06:45:36 -0700 (PDT) MIME-Version: 1.0 References: <20211105094748.3894453-1-guoren@kernel.org> In-Reply-To: <20211105094748.3894453-1-guoren@kernel.org> From: Anup Patel Date: Sat, 6 Nov 2021 19:15:25 +0530 Message-ID: Subject: Re: [PATCH V7] irqchip/sifive-plic: Fixup EOI failed when masked To: Guo Ren Cc: Atish Patra , Marc Zyngier , Thomas Gleixner , Palmer Dabbelt , "linux-kernel@vger.kernel.org List" , linux-riscv , Guo Ren , Vincent Pelletier , Nikita Shubin , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 5, 2021 at 3:18 PM 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 riscv plic couldn't complete masked irq source which has > been disabled in enable register. The bug was firstly reported in [1]. > > Here is the description of Interrupt Completion in PLIC spec [2]: > > 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. > > [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 > Tested-by: Nikita Shubin > Signed-off-by: Guo Ren Looks good to me. Reviewed-by: Anup Patel Regards, Anup > Cc: stable@vger.kernel.org > Cc: Anup Patel > Cc: Thomas Gleixner > Cc: Marc Zyngier > Cc: Palmer Dabbelt > Cc: Atish Patra > Cc: Nikita Shubin > Cc: incent Pelletier > > --- > > Changes since V7: > - Add Fixes tag > - Add Tested-by > - Add Cc stable > > Changes since V6: > - Propagate to plic_irq_eoi for all riscv,plic by Nikita Shubin > - Remove thead related codes > > Changes since V5: > - Move back to mask/unmask > - Fixup the problem in eoi callback > - Remove allwinner,sun20i-d1 IRQCHIP_DECLARE > - Rewrite comment log > > Changes since V4: > - Update comment by Anup > > Changes since V3: > - Rename "c9xx" to "c900" > - Add sifive_plic_chip and thead_plic_chip for difference > > Changes since V2: > - Add a separate compatible string "thead,c9xx-plic" > - set irq_mask/unmask of "plic_chip" to NULL and point > irq_enable/disable of "plic_chip" to plic_irq_mask/unmask > - Add a detailed comment block in plic_init() about the > differences in Claim/Completion process of RISC-V PLIC and C9xx > PLIC. > --- > 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 cf74cfa82045..259065d271ef 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 = { > -- > 2.25.1 >