From patchwork Thu Feb 25 02:12:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 8416361 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5A6A59F372 for ; Thu, 25 Feb 2016 02:18:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C3A62034A for ; Thu, 25 Feb 2016 02:18:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3213620382 for ; Thu, 25 Feb 2016 02:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932481AbcBYCSH (ORCPT ); Wed, 24 Feb 2016 21:18:07 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:38228 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759135AbcBYCNf (ORCPT ); Wed, 24 Feb 2016 21:13:35 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1P2DE0P019006 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Feb 2016 02:13:14 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u1P2DD0A013587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 25 Feb 2016 02:13:14 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u1P2DDRj005019; Thu, 25 Feb 2016 02:13:13 GMT Received: from userv0022.oracle.com (/10.132.126.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 24 Feb 2016 18:13:13 -0800 From: Yinghai Lu To: Bjorn Helgaas , David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang , Khalid Aziz Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu , stable@vger.kernel.org Subject: [PATCH v10 18/59] PCI: Set resource to FIXED for LSI devices Date: Wed, 24 Feb 2016 18:12:09 -0800 Message-Id: <1456366370-28995-19-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1456366370-28995-1-git-send-email-yinghai@kernel.org> References: <1456366370-28995-1-git-send-email-yinghai@kernel.org> X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 LSI HBA firmware stop responding pci read from host if pci core ever change pci device BAR values. Set their resources to FIXED, so let realloc to skip them. Reported-by: Paul Johnson Suggested-by: Bjorn Helgaas Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92351 Signed-off-by: Yinghai Lu Cc: stable@vger.kernel.org --- drivers/pci/pci.h | 1 + drivers/pci/quirks.c | 20 ++++++++++++++++++++ drivers/pci/setup-bus.c | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 220bd0e..60d1c87 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -170,6 +170,7 @@ static inline void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u } void pci_realloc_get_opt(char *); +bool pci_realloc_user_enabled(void); static inline int pci_no_d1d2(struct pci_dev *dev) { diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 47921a1..8d1f75f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -335,6 +335,26 @@ static void quirk_s3_64M(struct pci_dev *dev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M); +/* + * LSI devices firmware does not like BAR get changed + */ +static void quirk_bar_fixed(struct pci_dev *dev) +{ + int i; + + if (pci_realloc_user_enabled()) + return; + + for (i = 0; i < PCI_STD_RESOURCE_END; i++) { + struct resource *r = &dev->resource[i]; + + if (!r->start || !r->flags) + continue; + r->flags |= IORESOURCE_PCI_FIXED; + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LSI_LOGIC, PCI_ANY_ID, quirk_bar_fixed); + /* for pci remove and rescan */ static void quirk_allocate_fixed(struct pci_dev *dev) { diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 05769c4..f9cd04a 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1678,6 +1678,10 @@ void __init pci_realloc_get_opt(char *str) else if (!strncmp(str, "on", 2)) pci_realloc_enable = user_enabled; } +bool pci_realloc_user_enabled(void) +{ + return pci_realloc_enable == user_enabled; +} static bool pci_realloc_enabled(enum enable_type enable) { return enable >= user_enabled;