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: 9403553 X-Patchwork-Delegate: bhelgaas@google.com 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 C785560588 for ; Sat, 29 Oct 2016 11:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA12C29F5F for ; Sat, 29 Oct 2016 11:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB2829F9A; Sat, 29 Oct 2016 11:12:49 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C91BD29F5F for ; Sat, 29 Oct 2016 11:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755006AbcJ2LMr (ORCPT ); Sat, 29 Oct 2016 07:12:47 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36554 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750840AbcJ2LMp (ORCPT ); Sat, 29 Oct 2016 07:12:45 -0400 Received: by mail-lf0-f68.google.com with SMTP id b75so4917998lfg.3; Sat, 29 Oct 2016 04:12:44 -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=ATOQbDLPcCxT4i2GbE1ESihIGDHtmMATHPWZv0SnYkjK/2W2y1L4y+rfmqA+ReA7SS l/R1meanArO2BaJ4JXKgp+DX4AArJrLwgyuQeVe6xL/GGL/2Dv0cw8ZIzD7mZQpzdLx8 xi+aRyA0wPJhYisb/9MdvNpBzzWHPAkR8KbJhx4rGYlUdSsREx/lTIRUBTt1EE4yUaQs HDR2YPOH9gcNqOXjGSpiH9Wm7BlpBhIRQwTNx7/F3BwVqQo4lQeISPOrcm8dGzcuNIy9 Gn21iiab83KloXfXF3GF8qn2oZQinaabahEs73vBOkPYj8wcllkLungeh7VnJp3pFd0X c3HA== X-Gm-Message-State: ABUngvedthsEcrbb92oYLaIS8fwdqGql97An5aJfiilv3whEsyn5dKBGZ2izphzUXKDfSQ== 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 Cc: Arnd Bergmann , Bjorn Helgaas , Lucas Stach , Hauke Mehrtens , Jon Mason , Mark Rutland , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= 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 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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