Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2991299pxb; Tue, 12 Oct 2021 18:24:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2p4AzJYMqSt/UvV1Ek+foyj0BlkBXtcp/7syjtJi5fAKhfJqdKEDJlITUk8IbVmBt1CZv X-Received: by 2002:a50:e08c:: with SMTP id f12mr5040648edl.178.1634088282081; Tue, 12 Oct 2021 18:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634088282; cv=none; d=google.com; s=arc-20160816; b=MUrjjN/KAo2vRX6VCR4cO83SIekDtzaBHNOdDUeIkByJ3TGzXsxdHnYnKFk5boWHRo T9xivlocktiZWxMIeUltjMsdpfxLIBVu01gV4jfXb4EjySmlmrljxjgu8vKcUaM6udD1 nyhjxBghcqjH21VQ/0hU1MkbajF2JxjCju+fy9jO1WH9dcZ5AHEQeqzM7IbI6cRPk0mr 0yXg3WJWtVCe8+Dma1jfgvbEPWr9wM+/O1CkQ2/7x57Pf0cg0n4FbM53FLM7cdlXLROH jOt53yqyW/KXJhCJamVCeU627Hs09XUU/CpaMq+T69BfXFSm7LManE7RZjpizr+6P+67 IfHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BS4wRteNctEnbNBuFARLsN4BqsFgPHtS1bNxvaVmpoc=; b=L/iZxbkb4LhU+1FNEk0FhuLRAZ+l+mOp6v+xGiF+K9n//fsCJOeeAMMbKLgU1TDDkY dQOyvM3YPAjpfk1baMnnYbNGm+d7K1Fo7LA9FRed0Z2j/1ug4TXrAzODG8cxa+DgoOmJ EL6rl5LMTWJcvRpgPweLol6m+R/dwiqvT591qV2f5XIqkMrP1Mv53iiKl5cRfc9vlljr ZF/eFKdC0qgNDPT4OMrYSADX44RyPao9IpNj+wHXfjrkW3niNTlzcjO5b+4wAZMJ/jXk KoQ6Fi/VNnVpDtASaKuv8LdwDCWD0uqbKFai7t9lXCXxHYJjhb1mQD55SnFzojY76OPl kbqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q7IiouUE; 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 v19si17176287edw.480.2021.10.12.18.24.18; Tue, 12 Oct 2021 18:24:42 -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=@kernel.org header.s=k20201202 header.b=Q7IiouUE; 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 S236394AbhJMBY3 (ORCPT + 99 others); Tue, 12 Oct 2021 21:24:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:54552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236319AbhJMBY2 (ORCPT ); Tue, 12 Oct 2021 21:24:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AAE0B60EB4; Wed, 13 Oct 2021 01:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634088146; bh=xdFNRaKIEdOX1bCHR9Iw6lKDctOEN+PWB8DJ4TThBAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7IiouUErlVyHM+hyiR6VanPykrLzMfMN7syy4EUw1IV2c6V0TrZwGN6sHZS6AGIe Nns5db+s436hWHPhGH0RA0X+QdzN//pIa1dwz6d+OH/8tMdzeOr5i+qaA5Rpx32vaj ZUlh2kvgXlTtRGp+oii1olqJrknjh+to7+pWxc0bbZcwijZDvQHwIyXVZqGO6DwsXj lwTgq9anG2TKjNEfbVELy3gx1ps0DKOav1rpHx6B+Y9i9gDvl2134D9rRM9HgXbr9L 6bj/MMirpjCiqmjKHDYm+i2sBJeUOnjbQJUS04QsuEjEWBFgmTJMtk35ya0RKQd50i CemJc4sRFXi3w== From: guoren@kernel.org To: guoren@kernel.org, anup@brainfault.org, atish.patra@wdc.com, maz@kernel.org, tglx@linutronix.de, palmer@dabbelt.com, heiko@sntech.de Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren Subject: [PATCH V3 2/2] irqchip/sifive-plic: Add thead,c900-plic support Date: Wed, 13 Oct 2021 09:21:49 +0800 Message-Id: <20211013012149.2834212-2-guoren@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013012149.2834212-1-guoren@kernel.org> References: <20211013012149.2834212-1-guoren@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren thead,c900-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,c900-plic. Because when IRQ is disabled in c900, 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 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 | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index cf74cfa82045..5b806d823df7 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -166,7 +166,7 @@ static void plic_irq_eoi(struct irq_data *d) writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); } -static struct irq_chip plic_chip = { +static struct irq_chip sifive_plic_chip = { .name = "SiFive PLIC", .irq_mask = plic_irq_mask, .irq_unmask = plic_irq_unmask, @@ -176,12 +176,24 @@ static struct irq_chip plic_chip = { #endif }; +static struct irq_chip thead_plic_chip = { + .name = "T-Head PLIC", + .irq_disable = plic_irq_mask, + .irq_enable = plic_irq_unmask, + .irq_eoi = plic_irq_eoi, +#ifdef CONFIG_SMP + .irq_set_affinity = plic_set_affinity, +#endif +}; + +static struct irq_chip *def_plic_chip = &sifive_plic_chip; + static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hwirq) { struct plic_priv *priv = d->host_data; - irq_domain_set_info(d, irq, hwirq, &plic_chip, d->host_data, + irq_domain_set_info(d, irq, hwirq, def_plic_chip, d->host_data, handle_fasteoi_irq, NULL, NULL); irq_set_noprobe(irq); irq_set_affinity(irq, &priv->lmask); @@ -390,5 +402,14 @@ static int __init plic_init(struct device_node *node, return error; } +static int __init thead_c900_plic_init(struct device_node *node, + struct device_node *parent) +{ + def_plic_chip = &thead_plic_chip; + + 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_c900_plic, "thead,c900-plic", thead_c900_plic_init); -- 2.25.1