Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2603446pxb; Tue, 12 Oct 2021 09:44:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeELfbZu9FEHn/XrLLvNMhyGVNGWpdQHACh0ixVZNJSA3CREuup7XwlDHCy4IR/nBcvGZt X-Received: by 2002:a17:90b:4c47:: with SMTP id np7mr7211174pjb.22.1634057042606; Tue, 12 Oct 2021 09:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634057042; cv=none; d=google.com; s=arc-20160816; b=H62H4UTVNWEZaKenC03Mhmi9xbcS76cVm0quqN7NBX0qpK7UsWhYbuUE8hKRrVml0B /XnwRa0Pnqxe0w11PdWKyHZONFBWFz/Tg2Fs+fBC/UYXQwHCjUkfxaFZ9uhxwZe9Dy29 l5Egro+bfZCqow8Pe3O1gLySc6GgjJh1W4bjh/v7dsUyzBwMoe8dd9WEzAaM0P1Q/SKu 6MpE4pNfmwr8vrD9qXTYIGiYCBf0ljsJPRgwmyXI+qL9QH/G1s3IId2Tw+4SJ/JwvjhM PH9YntrmwLmWclw0ccpNkh7TuJqYOPaEXUPSIzHdp2f713UaMNekeKw05lIyEmmntkx5 pW+Q== 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=DyQ0FnQ11AjdF2tqrPUXu5b7mdoj6pFrq0SdLPzJPkw=; b=iJfw77pWnzTIP6lR65uJys4s8uTs99MS6YhEWl/SnxgMGP9xFpzERL9l5r6R9kVAh/ ymRkTG/AEJXGMYyx2cHGEXpnEX2sZOTy2pVXWh2qOKj2j+3tUK4XC9WigO4voPbTpJ3x Y3TJlb8X8DY/a/tKXq9NjBVKgajpnIbY1QoRQQ8tGtXjMbJpDY06I5wnHsZQRP8B6BLy 8eyla5ehWNK8UKKSno8TrslXV6NcdbaMgC0Q7AAFQNVZNe/+SPmASNAK90YNTQJEnTH+ ACPjxDM6m5/gG27uxCA6dsnVQSy4HmovPYcEHMiS/6/T4gPI8d3fbqF0z/2POlSLhEKA ttRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=rGHKljQq; 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 lb11si3563601pjb.76.2021.10.12.09.43.49; Tue, 12 Oct 2021 09:44:02 -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=rGHKljQq; 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 S231356AbhJLQmx (ORCPT + 99 others); Tue, 12 Oct 2021 12:42:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbhJLQml (ORCPT ); Tue, 12 Oct 2021 12:42:41 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E03AC061570 for ; Tue, 12 Oct 2021 09:40:39 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id u18so68922400wrg.5 for ; Tue, 12 Oct 2021 09:40:39 -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=DyQ0FnQ11AjdF2tqrPUXu5b7mdoj6pFrq0SdLPzJPkw=; b=rGHKljQqqx6UUOEcCaCWB0mvux/wtJzhPa0mghK9VK59QDdZPMz+EFlcsGbt4sNk6I dyldHIawBSm6ujxvuZQgJCz0zMNfCvOKL4zgkMjVYJSKoYONsRcTxTZCi9AQa93iuJho hfGhw74lHfAaNG0aF3VIVCN5W1cISpGNmyb3zpexwL3FOnoxpaQvoNZeOqBzbEUhIB8Q 76l5LY7ol3rFh1MLE3P8JOdFCrq9CnLEvd6y88QbBm3TmD48mTL6R3XviQQlA3TUhz/L 21s2u3NFXKUpgikwV0d0bd0nWuBMwOs94/5Fi4bWjuAT+NDi8u//Eco6c600cpOLUiM6 n0uA== 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=DyQ0FnQ11AjdF2tqrPUXu5b7mdoj6pFrq0SdLPzJPkw=; b=o6wCOCqdg25/qReH/UAhiUBc2OISP59FSX6g3K4nvK+vOwussMhj1Wr0WWfRRSRZS3 tRYbMq+mDG61bzykniYWyItm4GBHFZlMULwtxw2M2TQzh7GuGEF6/X+tFS9GRGqIineV x2zVEy6rpLHY7JoPsKE4QV4XfmLodUWXhBEG1WNxZCfNdCE6y2rB9ajw3RFoo8wdXyr0 w+clGpvidn66r41Ymq086HqybqkrNi7s4etwKZIPUWCE9q48SVkaj8yXnufFUBIUgpJT Hd1OYTnqeSzsn7sVmd278GOvCpXgXbn3pBY3JB4H4k1Owpn2Wr30usAG0eMpo84ddAiV B6sw== X-Gm-Message-State: AOAM530XbUjxbKULA9OLPNuhh8OgBuzEAQ2RTQMDaDV1CTZcJMq4AdlK bV84931C2epNioCwBx9gtBWM3P9oSo1mhBK5FouELg== X-Received: by 2002:adf:ab57:: with SMTP id r23mr34064613wrc.199.1634056837790; Tue, 12 Oct 2021 09:40:37 -0700 (PDT) MIME-Version: 1.0 References: <20211012153432.2817285-1-guoren@kernel.org> <20211012153432.2817285-2-guoren@kernel.org> In-Reply-To: <20211012153432.2817285-2-guoren@kernel.org> From: Anup Patel Date: Tue, 12 Oct 2021 22:10:26 +0530 Message-ID: Subject: Re: [PATCH V2 2/2] irqchip/sifive-plic: Add thead,c9xx-plic support To: Guo Ren Cc: Atish Patra , Marc Zyngier , Thomas Gleixner , Palmer Dabbelt , "linux-kernel@vger.kernel.org List" , linux-riscv , Guo Ren Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 12, 2021 at 9:04 PM wrote: > > From: Guo Ren > > thead,c9xx-plic would mask IRQ with readl(claim), so it needn't > mask/unmask which needed in RISC-V PLIC. > > When in IRQS_ONESHOT & IRQCHIP_EOI_THREADED path, unnecessary mask > operation would cause a blocking irq bug in thead,c9xx-plic. Because > when IRQ is disabled in c9xx, writel(hwirq, claim) would be invalid. > > Signed-off-by: Guo Ren > Cc: Anup Patel > Cc: Thomas Gleixner > Cc: Marc Zyngier > Cc: Palmer Dabbelt > Cc: Atish Patra > > --- > > 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 | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c > index cf74cfa82045..3756b1c147c3 100644 > --- a/drivers/irqchip/irq-sifive-plic.c > +++ b/drivers/irqchip/irq-sifive-plic.c > @@ -79,6 +79,7 @@ struct plic_handler { > }; > static int plic_parent_irq __ro_after_init; > static bool plic_cpuhp_setup_done __ro_after_init; > +static bool disable_mask_unmask __ro_after_init; > static DEFINE_PER_CPU(struct plic_handler, plic_handlers); > > static inline void plic_toggle(struct plic_handler *handler, > @@ -181,6 +182,13 @@ static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq, > { > struct plic_priv *priv = d->host_data; > > + if (disable_mask_unmask) { > + plic_chip.irq_mask = NULL; > + plic_chip.irq_unmask = NULL; > + plic_chip.irq_enable = plic_irq_unmask; > + plic_chip.irq_disable = plic_irq_mask; > + } > + > irq_domain_set_info(d, irq, hwirq, &plic_chip, d->host_data, > handle_fasteoi_irq, NULL, NULL); > irq_set_noprobe(irq); > @@ -390,5 +398,14 @@ static int __init plic_init(struct device_node *node, > return error; > } > > +static int __init thead_c9xx_plic_init(struct device_node *node, > + struct device_node *parent) > +{ > + disable_mask_unmask = true; The plic_irqdomain_map() is called for each irq so "plic_chip" will be updated multiple times. You can drop the disable_mask_unmask variable and instead directly update "plic_chip" here. > + > + return plic_init(node, parent); > +} > + > IRQCHIP_DECLARE(sifive_plic, "sifive,plic-1.0.0", plic_init); > IRQCHIP_DECLARE(riscv_plic0, "riscv,plic0", plic_init); /* for legacy systems */ > +IRQCHIP_DECLARE(thead_c9xx_plic, "thead,c9xx-plic", thead_c9xx_plic_init); > -- > 2.25.1 > Regards, Anup