Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2538139pxb; Tue, 12 Oct 2021 08:36:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGaD7j1Sr9TQceKurPDAFPqF/mbIiqG/zHfWXqLmAq/4nX8jC87MpHqRquOY7NZTzQpqQR X-Received: by 2002:a63:b20c:: with SMTP id x12mr23626878pge.10.1634052999345; Tue, 12 Oct 2021 08:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634052999; cv=none; d=google.com; s=arc-20160816; b=QpQa9S4bXGzK5ommVvuIUu8xqy72V+KWCyZF2bpN9wym5stjIjw0yV/CItNheztVKf Y6tBLPG9nLwgd4xaByhmmqb+O54m+tIDF3WBMQS1TAecbR9pXLvpk1ZMKiq08NTFuhQ5 iwd/XjJHo7gUyAhXQeCHEodFYmR8Bu1Qyc8r+rQi2HBEFySYcHgdz03Wpps0PeUksUJK M/JZbznXeswy+bIDifX/RZ21/KAoYeYCzqRS195ElfBsi6KrdlvIZilnc3FRilrfnnsf 4iothyC8BkvlOVNf0Vgyi6C8WMtRLmKhpA8oL/KmIuqmjEllDriQtXeYGkBGAR7ri2Z1 z7eA== 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=xzKA+jqnVaubQ2h2Klo6XDHdl0fPRTk/uXXHto4FPwY=; b=OTMwo5Xh55WOXxomR5eGBExVdtDr/zWwJhyBCiFJFtpWQkAFMVrwZkwvwTImOdQF9t 8wV2QnfWQ4B1rdymMeuIIazH0qQFXJFArJOSYAlqfViabvlO3INM3pRLsPOtVIIeIuz2 CBbFezcEZuhHlLjOmIl78uY4DOpjuaabZVw6zD7p1hRcOLR8a2uMFZf7wETq5d4HDBgR HWiau7ATxRys+0GxBIhW4jcNPitPX27AUEpRDA5ptDkJmOqeD/by4sm+nl2sGw3Ka/UN nwE1M3rtgLolpMfw5Fztro6O5lVtMpDT3IS3BfGmwhAxlGYz/fI4wcW8D1z3ruGIic9a GtJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eWlwJ56n; 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 c4si16318076pgc.204.2021.10.12.08.36.26; Tue, 12 Oct 2021 08:36:39 -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=eWlwJ56n; 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 S237457AbhJLPgw (ORCPT + 99 others); Tue, 12 Oct 2021 11:36:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:56508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237449AbhJLPgt (ORCPT ); Tue, 12 Oct 2021 11:36:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D98EE61074; Tue, 12 Oct 2021 15:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634052887; bh=6W6iHtb0gBp1lkXoNCKov43WbKN2Zd1lRk8xkWaz6QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWlwJ56npUHtTb2/do9cb/DEEJmL/Yx7tRUMtFBhd+kqagYFHTNqxKyLecJ3laX2r VoJB2UH2obniDyu5aNU3o0g8SU6zjrhS0UCUDgXrj5D6rnfYJFN41VWbhnyYCNWzN8 75odFUkGJaQVjKrKqM/rHMPQIJSlsKjTbRQYaVLvlkx9IYWOlwn1y5e+ayZ7oHuvB3 pJo9nRcOqXgy97bH9ay28nYMQS1DOFghl+Y3lEuhOPhLWxmQ4NPaFCH9teMGEZZH2g 2U3HNw9sTCkMk3ExXpKqhzSuKH30oXP1loZaF0QQp3w08FlRhZj5tSvhivFBHZv79W K1bvAQT3y9EZg== From: guoren@kernel.org To: guoren@kernel.org, anup@brainfault.org, atish.patra@wdc.com, maz@kernel.org, tglx@linutronix.de, palmer@dabbelt.com Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren Subject: [PATCH V2 2/2] irqchip/sifive-plic: Add thead,c9xx-plic support Date: Tue, 12 Oct 2021 23:34:32 +0800 Message-Id: <20211012153432.2817285-2-guoren@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211012153432.2817285-1-guoren@kernel.org> References: <20211012153432.2817285-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,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; + + 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