Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5152990ybp; Mon, 14 Oct 2019 16:30:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4O0AEaQQWrf0aMl8E1OiofqY+aEsV30Svi7bRuBvxmYWOtIns0E6Q/QAAVjXRv42MRDU4 X-Received: by 2002:a17:906:c78e:: with SMTP id cw14mr30668326ejb.67.1571095853551; Mon, 14 Oct 2019 16:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571095853; cv=none; d=google.com; s=arc-20160816; b=mZpBArP3PSuQXdIxqMErSE74zBIj08RlRtcPKTjogBJxbV0NehtwtNAF5eFVSuEdV3 O/qTBj9aF5kQh2ZpaPFHkBLh7C0IjMjA3LgNxXR9+JPqOt1B2Q7Eem046VAG3qpKG3RT 8GP+Fdl0rLbidQGFKgVAMM1XFCyIvVBfK9t8xmInLHMliSp376b7x8tEdG+OACGKYgXb VgCpVMpWw+eY+fLuiNlcC71Gd0o8bj52yFRO+ypP8j7pyHpRnfwNe5Tg8GNZbO+Z+sa8 PGQXFyYODQxi5tzNK6E1vdRxMREc6d5W3Nb/yfFr/tPf8s2G2AP1rqdf/WT7POB5sBRc RD5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=lmsOLOa+tOqwK9ZK9dJWfhLrV1wZA4HmGb20TOzVeIg=; b=CEOv64n1VxwD7JWF2Bp0wxL1P/z72f3+F7ml+gZCcXqQee6sOOeM5Vf/oGcaw2KErK cJ5p4FAfwWKDDBBAptM/uvYG+lVvBHm6NHDUTiH4RYqxepnyLOsF4zWp2PUjE7m32Nvr 4djRPEAe/Mz6Byul640udJv6+5N9l/dB+x0rNvWgMW9IJdZOy5aSE4wyfykYyegu+CF+ s0HZAwmHWmcawzmfFbbjdS79XwTHFOj23VeXWdXsL2ULB8ogwDCAePgrmbaZm6eg1ldz uyoIBSYEV3iWT0SQ8mg4H+rTfDLNdfb3Lh2WjJmIUD5wUsdfa+gQpF/e1jeHGC7XtWaK 9mrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jx7si12250309ejb.84.2019.10.14.16.30.30; Mon, 14 Oct 2019 16:30:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732021AbfJNSjA (ORCPT + 99 others); Mon, 14 Oct 2019 14:39:00 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40320 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731291AbfJNSi6 (ORCPT ); Mon, 14 Oct 2019 14:38:58 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iK5F7-0005bI-2o; Mon, 14 Oct 2019 20:38:53 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id A6EAA1C010B; Mon, 14 Oct 2019 20:38:47 +0200 (CEST) Date: Mon, 14 Oct 2019 18:38:47 -0000 From: "tip-bot2 for Marc Zyngier" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] irqchip/sifive-plic: Switch to fasteoi flow Cc: Marc Zyngier , Palmer Dabbelt , Darius Rad , Paul Walmsley , stable@vger.kernel.org, Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <8636gxskmj.wl-maz@kernel.org> References: <8636gxskmj.wl-maz@kernel.org> MIME-Version: 1.0 Message-ID: <157107832749.12254.5664038799279181370.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/urgent branch of tip: Commit-ID: bb0fed1c60cccbe4063b455a7228818395dac86e Gitweb: https://git.kernel.org/tip/bb0fed1c60cccbe4063b455a7228818395dac86e Author: Marc Zyngier AuthorDate: Sun, 15 Sep 2019 15:17:45 +01:00 Committer: Marc Zyngier CommitterDate: Wed, 18 Sep 2019 12:29:52 +01:00 irqchip/sifive-plic: Switch to fasteoi flow The SiFive PLIC interrupt controller seems to have all the HW features to support the fasteoi flow, but the driver seems to be stuck in a distant past. Bring it into the 21st century. Signed-off-by: Marc Zyngier Tested-by: Palmer Dabbelt (QEMU Boot) Tested-by: Darius Rad (on 2 HW PLIC implementations) Tested-by: Paul Walmsley (HiFive Unleashed) Reviewed-by: Palmer Dabbelt Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/8636gxskmj.wl-maz@kernel.org --- drivers/irqchip/irq-sifive-plic.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index cf75596..3e51dee 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -97,7 +97,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask, } } -static void plic_irq_enable(struct irq_data *d) +static void plic_irq_unmask(struct irq_data *d) { unsigned int cpu = cpumask_any_and(irq_data_get_affinity_mask(d), cpu_online_mask); @@ -106,7 +106,7 @@ static void plic_irq_enable(struct irq_data *d) plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); } -static void plic_irq_disable(struct irq_data *d) +static void plic_irq_mask(struct irq_data *d) { plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); } @@ -125,10 +125,8 @@ static int plic_set_affinity(struct irq_data *d, if (cpu >= nr_cpu_ids) return -EINVAL; - if (!irqd_irq_disabled(d)) { - plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); - plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); - } + plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); + plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); irq_data_update_effective_affinity(d, cpumask_of(cpu)); @@ -136,14 +134,18 @@ static int plic_set_affinity(struct irq_data *d, } #endif +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); +} + static struct irq_chip plic_chip = { .name = "SiFive PLIC", - /* - * There is no need to mask/unmask PLIC interrupts. They are "masked" - * by reading claim and "unmasked" when writing it back. - */ - .irq_enable = plic_irq_enable, - .irq_disable = plic_irq_disable, + .irq_mask = plic_irq_mask, + .irq_unmask = plic_irq_unmask, + .irq_eoi = plic_irq_eoi, #ifdef CONFIG_SMP .irq_set_affinity = plic_set_affinity, #endif @@ -152,7 +154,7 @@ static struct irq_chip plic_chip = { static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hwirq) { - irq_set_chip_and_handler(irq, &plic_chip, handle_simple_irq); + irq_set_chip_and_handler(irq, &plic_chip, handle_fasteoi_irq); irq_set_chip_data(irq, NULL); irq_set_noprobe(irq); return 0; @@ -188,7 +190,6 @@ static void plic_handle_irq(struct pt_regs *regs) hwirq); else generic_handle_irq(irq); - writel(hwirq, claim); } csr_set(sie, SIE_SEIE); }