Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1788942ybb; Sun, 29 Mar 2020 13:27:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvKLms7mdcHcxeD1wFROyqBGRyLX2nLeuQeVMhPxPxcZm1lMGq7PlOEo8kaalKSiksTM9yM X-Received: by 2002:a9d:7a8:: with SMTP id 37mr7133966oto.209.1585513674606; Sun, 29 Mar 2020 13:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585513674; cv=none; d=google.com; s=arc-20160816; b=dJvDzOMe1UMb5Wx0KbUh7qacuv3oxS+MUTueKZhB0pCqlXeV7LKxpbRdiQuxSrAS8K VhrS7bSmUEL18a/+/fg6tsyb3N5Zhi4JmRSI7LHZbZFtAstJsgmVrW+i/i82WgchCiyY GKzawDyKkqfM595sCw0AfZVJ55TWtLfFGS89QMSAmFI1ZoSW020sHs7KhhEbomVKA+AL L7cNskRnJqtyVVnig4zPovsteMCWQsYDRE16teb3p9GqoXVdiWtzrcQSKmaA4sXPbKD8 CmtqnjVHVTeQXKah5bKlZ3FLKnY/ia0QtEdC8c+Qiz8dFu1VjMj147wlIrZFUC4QparX A/2w== 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=WzKQRCuJBZmDKZgOxxfHJ6W61tlf7A6a//iN86As4AE=; b=a1jmyGBNc2fotToSdW849e2zd3p5bAKHnIxUjc2boPmtcTFJstzo/5dyRNplqM3RlB xJwAoViLuLCXqw09U/+7sJ/c8lEE8Pif8CNBcsx/iDNh5HAhwrFu3JNb/hSx54IceFES 5wll9piG8/XOrfIqISbHezWHwYXql9N77NGXxzkmP4A17evChX+Odtn1YDIBYpBZzT2s sTiWcLrTEMlkH7ovc+skXUNV2PF7c2JFCM0DgDaRP7eaUKUDpWWXd8Lg7LW/HwmV2Ugq +DAvfhjZhWmjstLYcjiJ2klFkeaSsw3KuwqKtBFo0mc2s1sprXhZ25NEjDOw56Wfmve+ QLHA== 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 o6si2413590oih.267.2020.03.29.13.27.42; Sun, 29 Mar 2020 13:27:54 -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 S1729036AbgC2U1I (ORCPT + 99 others); Sun, 29 Mar 2020 16:27:08 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:57040 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728891AbgC2U0a (ORCPT ); Sun, 29 Mar 2020 16:26:30 -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 1jIeVm-0001UQ-PE; Sun, 29 Mar 2020 22:26:26 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 0C6191C07F3; Sun, 29 Mar 2020 22:26:21 +0200 (CEST) Date: Sun, 29 Mar 2020 20:26:20 -0000 From: "tip-bot2 for Lukas Wunner" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] irqchip/bcm2835: Quiesce IRQs left enabled by bootloader Cc: Lukas Wunner , Marc Zyngier , Florian Fainelli , Nicolas Saenz Julienne , x86 , LKML In-Reply-To: References: MIME-Version: 1.0 Message-ID: <158551358063.28353.14980225519315478462.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/core branch of tip: Commit-ID: bd59b343a9c902c522f006e6d71080f4893bbf42 Gitweb: https://git.kernel.org/tip/bd59b343a9c902c522f006e6d71080f4893bbf42 Author: Lukas Wunner AuthorDate: Tue, 25 Feb 2020 10:50:41 +01:00 Committer: Marc Zyngier CommitterDate: Mon, 16 Mar 2020 15:48:54 irqchip/bcm2835: Quiesce IRQs left enabled by bootloader Per the spec, the BCM2835's IRQs are all disabled when coming out of power-on reset. Its IRQ driver assumes that's still the case when the kernel boots and does not perform any initialization of the registers. However the Raspberry Pi Foundation's bootloader leaves the USB interrupt enabled when handing over control to the kernel. Quiesce IRQs and the FIQ if they were left enabled and log a message to let users know that they should update the bootloader once a fixed version is released. If the USB interrupt is not quiesced and the USB driver later on claims the FIQ (as it does on the Raspberry Pi Foundation's downstream kernel), interrupt latency for all other peripherals increases and occasional lockups occur. That's because both the FIQ and the normal USB interrupt fire simultaneously: On a multicore Raspberry Pi, if normal interrupts are routed to CPU 0 and the FIQ to CPU 1 (hardcoded in the Foundation's kernel), then a USB interrupt causes CPU 0 to spin in bcm2836_chained_handle_irq() until the FIQ on CPU 1 has cleared it. Other peripherals' interrupts are starved as long. I've seen CPU 0 blocked for up to 2.9 msec. eMMC throughput on a Compute Module 3 irregularly dips to 23.0 MB/s without this commit but remains relatively constant at 23.5 MB/s with this commit. The lockups occur when CPU 0 receives a USB interrupt while holding a lock which CPU 1 is trying to acquire while the FIQ is temporarily disabled on CPU 1. At best users get RCU CPU stall warnings, but most of the time the system just freezes. Fixes: 89214f009c1d ("ARM: bcm2835: add interrupt controller driver") Signed-off-by: Lukas Wunner Signed-off-by: Marc Zyngier Reviewed-by: Florian Fainelli Reviewed-by: Nicolas Saenz Julienne Link: https://lore.kernel.org/r/f97868ba4e9b86ddad71f44ec9d8b3b7d8daa1ea.1582618537.git.lukas@wunner.de --- drivers/irqchip/irq-bcm2835.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c index 418245d..a1e004a 100644 --- a/drivers/irqchip/irq-bcm2835.c +++ b/drivers/irqchip/irq-bcm2835.c @@ -61,6 +61,7 @@ | SHORTCUT1_MASK | SHORTCUT2_MASK) #define REG_FIQ_CONTROL 0x0c +#define FIQ_CONTROL_ENABLE BIT(7) #define NR_BANKS 3 #define IRQS_PER_BANK 32 @@ -135,6 +136,7 @@ static int __init armctrl_of_init(struct device_node *node, { void __iomem *base; int irq, b, i; + u32 reg; base = of_iomap(node, 0); if (!base) @@ -157,6 +159,19 @@ static int __init armctrl_of_init(struct device_node *node, handle_level_irq); irq_set_probe(irq); } + + reg = readl_relaxed(intc.enable[b]); + if (reg) { + writel_relaxed(reg, intc.disable[b]); + pr_err(FW_BUG "Bootloader left irq enabled: " + "bank %d irq %*pbl\n", b, IRQS_PER_BANK, ®); + } + } + + reg = readl_relaxed(base + REG_FIQ_CONTROL); + if (reg & FIQ_CONTROL_ENABLE) { + writel_relaxed(0, base + REG_FIQ_CONTROL); + pr_err(FW_BUG "Bootloader left fiq enabled\n"); } if (is_2836) {