From patchwork Sat Oct 29 11:12:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9403555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CF8160588 for ; Sat, 29 Oct 2016 11:14:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1703029F5F for ; Sat, 29 Oct 2016 11:14:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED00429F9A; Sat, 29 Oct 2016 11:14:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 752C129F5F for ; Sat, 29 Oct 2016 11:14:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c0RZW-00071x-SO; Sat, 29 Oct 2016 11:13:10 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c0RZS-0006zK-Hg for linux-arm-kernel@lists.infradead.org; Sat, 29 Oct 2016 11:13:07 +0000 Received: by mail-lf0-x244.google.com with SMTP id x79so4939119lff.2 for ; Sat, 29 Oct 2016 04:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TK+CA4LwVvlgGEo1+bLTica8edi0zV89qrZlL8FgsCc=; b=Mn/jllrs53ywiRjXKy1lzTQ59tb6hpOMcKk+bHYLJfcRLsSKkhrHSmbMIZlWEkRleA JfiP0IicVo/hgR41t7MJ9hIgtrKkyKmT0WwSIoqLRB5Pi7xnNwqEiSvY27/bDIkgl0YF 7oxqhQZZCW/JfsmKSQovnqfQEhDmgCldUnJRxQFqS4vhPAYJg0dgkEpwrJ5btNa4/CeY +F1H+O+F4bGxxZxfhLgFrpX+c5v/hPGbFPZwJWGNtRLMV226xFz3vs2pwc2xi7asSZQ4 rGiINmlyqwgDUeOAMeCpF6C6++FoeHolzjFtItUWzmJbPvw0Qc28wVG6ufCg3fHO2qXM IacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TK+CA4LwVvlgGEo1+bLTica8edi0zV89qrZlL8FgsCc=; b=fuaW8JW3YMRp6gxhJQH08LEJKWAPdXF/J8gQw6ByAEtMKKe7+HF2RHqsA7xUUGwbDy xEu1hnbJ6qgEU+dn2Y5IbPsx19k6p/MI9wSagW5VMJ7R5CZlkBT0pTd4IpqC/J0WaeiL IIcPyy9FXczeK0Xe5CJL1MFhK8T9rC05pT9mTRCeP8X2j/RNRl99gUoOfRzzinLEk0/D /jMq7XTkXqV8yBHhYHs+w+VG9oLMKfb8aYego4OThbgpO6mxzgNrpe8CcyPnN0f3ch4M G9iMu2AAs57DObpRKrfnxLq8N9nEjVAI3US2m5HBqAVwFohoaITBQkGUkpleNggMi0x+ 6zKA== X-Gm-Message-State: ABUngvcIr1YV/fyeNKZ+sTVBDtH6PZuxqJzYM/mc1sKKGZKyBTUP/7K8VZ8rxPc5UohUuw== X-Received: by 10.25.19.106 with SMTP id j103mr11401563lfi.68.1477739563694; Sat, 29 Oct 2016 04:12:43 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id 18sm2750941ljj.49.2016.10.29.04.12.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 04:12:42 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Florian Fainelli , linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: BCM5301X: Add back handler ignoring external imprecise aborts Date: Sat, 29 Oct 2016 13:12:29 +0200 Message-Id: <20161029111229.26875-1-zajec5@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161029_041306_918030_20FB2200 X-CRM114-Status: GOOD ( 14.05 ) 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: Mark Rutland , devicetree@vger.kernel.org, Scott Branden , Arnd Bergmann , Jon Mason , Hauke Mehrtens , linux-pci@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , bcm-kernel-feedback-list@broadcom.com, Ray Jui , Bjorn Helgaas , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafał Miłecki Since early BCM5301X days we got abort handler that was removed by commit 937b12306ea79 ("ARM: BCM5301X: remove workaround imprecise abort fault handler"). It assumed we need to deal only with pending aborts left by the bootloader. Unfortunately this isn't true for BCM5301X. When probing PCI config space (device enumeration) it is expected to have master aborts on the PCI bus. Most bridges don't forward (or they allow disabling it) these errors onto the AXI/AMBA bus but not the Northstar (BCM5301X) one. iProc PCIe controller on Northstar seems to be some older one, without a control register for errors forwarding. It means we need to workaround this at platform level. All newer platforms are not affected by this issue. Signed-off-by: Rafał Miłecki --- arch/arm/mach-bcm/bcm_5301x.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/mach-bcm/bcm_5301x.c b/arch/arm/mach-bcm/bcm_5301x.c index c8830a2..fe067f6 100644 --- a/arch/arm/mach-bcm/bcm_5301x.c +++ b/arch/arm/mach-bcm/bcm_5301x.c @@ -9,14 +9,42 @@ #include #include +#include +#include + +#define FSR_EXTERNAL (1 << 12) +#define FSR_READ (0 << 10) +#define FSR_IMPRECISE 0x0406 static const char *const bcm5301x_dt_compat[] __initconst = { "brcm,bcm4708", NULL, }; +static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr, + struct pt_regs *regs) +{ + /* + * We want to ignore aborts forwarded from the PCIe bus that are + * expected and shouldn't really be passed by the PCIe controller. + * The biggest disadvantage is the same FSR code may be reported when + * reading non-existing APB register and we shouldn't ignore that. + */ + if (fsr == (FSR_EXTERNAL | FSR_READ | FSR_IMPRECISE)) + return 0; + + return 1; +} + +static void __init bcm5301x_init_early(void) +{ + hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR, + "imprecise external abort"); +} + DT_MACHINE_START(BCM5301X, "BCM5301X") .l2c_aux_val = 0, .l2c_aux_mask = ~0, .dt_compat = bcm5301x_dt_compat, + .init_early = bcm5301x_init_early, MACHINE_END