From patchwork Mon Jul 27 20:09:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 6876461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C8F479F358 for ; Mon, 27 Jul 2015 20:13:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C57F204B0 for ; Mon, 27 Jul 2015 20:13:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4C02203ED for ; Mon, 27 Jul 2015 20:13:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZJoj2-0007WC-6q; Mon, 27 Jul 2015 20:10:16 +0000 Received: from gabe.freedesktop.org ([131.252.210.177]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZJoiz-0006IU-0W; Mon, 27 Jul 2015 20:10:13 +0000 Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 01EB76E3D7; Mon, 27 Jul 2015 13:09:51 -0700 (PDT) Received: from eliezer.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id E8F83184C0; Mon, 27 Jul 2015 13:09:50 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 7A70BF00A72; Mon, 27 Jul 2015 13:09:49 -0700 (PDT) From: Eric Anholt To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] irqchip: bcm2836: Use a CPU notifier enable IPIs. Date: Mon, 27 Jul 2015 13:09:49 -0700 Message-Id: <1438027789-1637-1-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <55B67C81.1010900@gmail.com> References: <55B67C81.1010900@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150727_131013_147718_3A98EE47 X-CRM114-Status: GOOD ( 15.47 ) X-Spam-Score: -4.2 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Jason Cooper , Stephen Warren , Lee Jones , linux-kernel@vger.kernel.org, Eric Anholt , linux-rpi-kernel@lists.infradead.org, Thomas Gleixner MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Eric Anholt --- Florian: Thanks! That looks like what we need to squash for Thomas's feedback. It feels a bit silly to me to avoid enabling IPIs on not-yet-booted CPUs, despite the fact that Linux itself is what generates IPIs. However, I've tested it on the 2836 series and it does work. drivers/irqchip/irq-bcm2836.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c index 87340b0..0bb0552 100644 --- a/drivers/irqchip/irq-bcm2836.c +++ b/drivers/irqchip/irq-bcm2836.c @@ -14,6 +14,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -195,6 +196,25 @@ static void bcm2836_arm_irqchip_send_ipi(const struct cpumask *mask, writel(1 << ipi, mailbox0_base + 16 * cpu); } } + +/* Unmasks the IPI on the CPU wen it's first brought online. */ +static int bcm2836_arm_irqchip_cpu_notify(struct notifier_block *nfb, + unsigned long action, void *hcpu) +{ + unsigned int cpu = (unsigned long)hcpu; + unsigned int int_reg = LOCAL_MAILBOX_INT_CONTROL0; + unsigned int mailbox = 0; + + if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) + bcm2836_arm_irqchip_unmask_per_cpu_irq(int_reg, mailbox, cpu); + + return NOTIFY_OK; +} + +static struct notifier_block bcm2836_arm_irqchip_cpu_notifier = { + .notifier_call = bcm2836_arm_irqchip_cpu_notify, + .priority = 100, +}; #endif static const struct irq_domain_ops bcm2836_arm_irqchip_intc_ops = { @@ -205,13 +225,12 @@ static void bcm2836_arm_irqchip_smp_init(void) { #ifdef CONFIG_SMP - int i; + /* Unmask IPIs to the boot CPU. */ + bcm2836_arm_irqchip_cpu_notify(&bcm2836_arm_irqchip_cpu_notifier, + CPU_STARTING, + (void *)smp_processor_id()); + register_cpu_notifier(&bcm2836_arm_irqchip_cpu_notifier); - /* unmask IPIs */ - for_each_possible_cpu(i) { - bcm2836_arm_irqchip_unmask_per_cpu_irq( - LOCAL_MAILBOX_INT_CONTROL0, 0, i); - } set_smp_cross_call(bcm2836_arm_irqchip_send_ipi); #endif }