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: 8788811 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 A0F91C0553 for ; Sat, 9 Apr 2016 21:51:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B624C20256 for ; Sat, 9 Apr 2016 21:50:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C23BC2021A for ; Sat, 9 Apr 2016 21:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbcDIVu5 (ORCPT ); Sat, 9 Apr 2016 17:50:57 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34449 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752953AbcDIVu5 (ORCPT ); Sat, 9 Apr 2016 17:50:57 -0400 Received: by mail-lf0-f47.google.com with SMTP id j11so114548867lfb.1 for ; Sat, 09 Apr 2016 14:50:55 -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=i6XcELFzi9Mfu0b37uwo1zu47A+uven7wJaY9jifxmxhlunkmriI9RlpsQKjjHXtK7 Q0OjxcjUNnnEnSI1r6mLO9VxhYGE0EMtbk2nzGKugOQAjxJ0knG0wDuzeA3uD77Pjtkm 8TToMmGJyZ0AI0fk1po6ucnLA/8dNMevzWFS7sKdmdx5IzuvkmzO4Fxy2BEZ+VotC4CS 192otmsRxtShQQTM0dwqiGgSI6EFdyZ5zAxYzlRct+99WiKsDuKUy4yWS0gsMVqQMvYN SsvoalmpINVwWY8zWI7TvGYJ1SnmZtOIuBp1uwNzN0w5afjAk1+/XV/NSAmvffxHdMAq GsmQ== X-Gm-Message-State: AD7BkJKeB4wLzYrVkiA5t3zK8sKY8sCKpmddUjJBSivX1CiXOInz3Kxm6B1JOnJ6QeJ51g== 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 Cc: linux-pci@vger.kernel.org, Hauke Mehrtens , linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= 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 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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; };