From patchwork Sat Apr 9 21:50:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 8788841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BECEEC0554 for ; Sat, 9 Apr 2016 22:02:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0973201C0 for ; Sat, 9 Apr 2016 22:02:15 +0000 (UTC) Received: from bombadil.infradead.org (unknown [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 0222720254 for ; Sat, 9 Apr 2016 22:02:14 +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 1ap0mm-0000aX-DA; Sat, 09 Apr 2016 21:51:20 +0000 Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ap0mi-0000Yb-VU for linux-arm-kernel@lists.infradead.org; Sat, 09 Apr 2016 21:51:17 +0000 Received: by mail-lf0-x236.google.com with SMTP id g184so114806901lfb.3 for ; Sat, 09 Apr 2016 14:50:56 -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=fgEShZiRMf+v2ilW52gGRjFrsCSs932mMwP5KmxCpS8=; b=wlgylC/RCBlzF0ObhCo1BGsM/quSHPLFl1WzCba6TfX06QDNRhJwf4Szr0EqS4erHr oq1vpZnbvSkdnulUlFgbXHiuKvUu5EuJEkXXYIU1F9G9dceFrkML8E9Tc2w2cV7jAE5r dzgs/8fBPVGTtWUGZ05qbVWtKBbOf8iipAH7dkguzXRw3CwBp5LQsZ3CAluAL1QhVniL nIDFDhvbxE0tMgDbEq/8ty8/K7N/73Btif7tAKNoS+AmHEyiDHI9alfavMKmqLZBflKL UmbIv+OoytXX5pd6cM85V1Kco1rWkVjOSzz3o9Rm/2gDwFCo9CpWi94KeFXl9CqR2deu MqBA== 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=fgEShZiRMf+v2ilW52gGRjFrsCSs932mMwP5KmxCpS8=; b=RAGnE177/RWqVFFBVLQB6m0PTelMy+kOW7aTr/DHF4S91JarcaPqtavoxyjqEtVtGL YvXfZ3PvR55jOF0xBT8Zoo8tMUlXruRe8XykXqvLy74HDspsK75kVkWXx/6OPvOL/OEo SN1ymhhXvyCQdku0hNgzPglmD+aOVuZpU29Fpcb0n4cXDqTr1m1FipYphp/HAYecidA9 8fE7AOSRyb7aJWLWnL97X8/2K/aOr8824ziSpcPO1IBd3hmmn2PvVE6O1Fn6gvOJLJdP SGxsUAkSr5vS41SUcpJC90wzRk+tQVa0uKkFHhTx+pyVi38RlsIVBOxvM1gaoHJx5XW3 n3zg== X-Gm-Message-State: AD7BkJIRXVXxWM3yswvGCDl1uSNYzXx+UC6VaHMMc3lfSvVHkjpvkglfGjrkri8mvXeZ+w== X-Received: by 10.25.42.1 with SMTP id q1mr5928428lfq.87.1460238654740; Sat, 09 Apr 2016 14:50:54 -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 g8sm3065874lbs.37.2016.04.09.14.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Apr 2016 14:50:53 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Bjorn Helgaas , Ray Jui , Scott Branden , Jon Mason Subject: [PATCH 1/2] PCI: iproc: Support DT property for ignoring aborts when probing Date: Sat, 9 Apr 2016 23:50:23 +0200 Message-Id: <1460238624-2086-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160409_145117_235538_3C499752 X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: -2.5 (--) 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: linux-pci@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Hauke Mehrtens Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RDNS_NONE, T_DKIM_INVALID, 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 Some devices (e.g. Northstar ones) may have bridges that forward harmless errors to the ARM core. In such case we need an option to add a handler ignoring them. Signed-off-by: Rafa? Mi?ecki --- .../devicetree/bindings/pci/brcm,iproc-pcie.txt | 6 ++++++ drivers/pci/host/pcie-iproc-platform.c | 2 ++ drivers/pci/host/pcie-iproc.c | 17 +++++++++++++++++ drivers/pci/host/pcie-iproc.h | 1 + 4 files changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt index 01b88f4..c91b20a 100644 --- a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt +++ b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt @@ -22,6 +22,12 @@ Optional properties: - brcm,pcie-ob: Some iProc SoCs do not have the outbound address mapping done by the ASIC after power on reset. In this case, SW needs to configure it +- brcm,pcie-hook-abort-handler: During PCI bus probing (device enumeration) + there can be errors that are expected and harmless. Unfortunately some bridges + can't be configured to ignore them and they forward them to the ARM core + triggering die(). + This property should be set in such case, it will make driver add its own + handler ignoring such errors. If the brcm,pcie-ob property is present, the following properties become effective: diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c index 1738c52..7a6eb09 100644 --- a/drivers/pci/host/pcie-iproc-platform.c +++ b/drivers/pci/host/pcie-iproc-platform.c @@ -100,6 +100,8 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev) pcie->need_ob_cfg = true; } + pcie->hook_abort_handler = of_property_read_bool(np, "brcm,pcie-hook-abort-handler"); + /* PHY use is optional */ pcie->phy = devm_phy_get(&pdev->dev, "pcie-phy"); if (IS_ERR(pcie->phy)) { diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index a576aee..a5b3816 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c @@ -433,6 +433,17 @@ static int iproc_pcie_map_ranges(struct iproc_pcie *pcie, return 0; } +#ifdef CONFIG_ARM +static int iproc_pcie_abort_handler(unsigned long addr, unsigned int fsr, + struct pt_regs *regs) +{ + if (fsr == 0x1406) + return 0; + + return 1; +} +#endif + static int iproc_pcie_msi_enable(struct iproc_pcie *pcie) { struct device_node *msi_node; @@ -498,6 +509,12 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) } #ifdef CONFIG_ARM + if (pcie->hook_abort_handler) + hook_fault_code(16 + 6, iproc_pcie_abort_handler, SIGBUS, + BUS_OBJERR, "imprecise external abort"); +#endif + +#ifdef CONFIG_ARM pcie->sysdata.private_data = pcie; sysdata = &pcie->sysdata; #else diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h index e84d93c..9a0b58d 100644 --- a/drivers/pci/host/pcie-iproc.h +++ b/drivers/pci/host/pcie-iproc.h @@ -72,6 +72,7 @@ struct iproc_pcie { struct phy *phy; int (*map_irq)(const struct pci_dev *, u8, u8); bool need_ob_cfg; + bool hook_abort_handler; struct iproc_pcie_ob ob; struct iproc_msi *msi; };