Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756693AbbGFXnI (ORCPT ); Mon, 6 Jul 2015 19:43:08 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:17791 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756587AbbGFXmU (ORCPT ); Mon, 6 Jul 2015 19:42:20 -0400 From: Yinghai Lu To: Bjorn Helgaas , David Miller , David Ahern , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang Cc: Andrew Morton , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu , stable@vger.kernel.org Subject: [PATCH 34/36] PCI: Set resource to FIXED for lsi devices Date: Mon, 6 Jul 2015 16:39:24 -0700 Message-Id: <1436225966-27247-35-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1436225966-27247-1-git-send-email-yinghai@kernel.org> References: <1436225966-27247-1-git-send-email-yinghai@kernel.org> X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2581 Lines: 82 LSI HBA firmware stop responding pci read from host if pci core ever change pci device BAR values. Set their resources to FIXED, so will allow 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 1804d44..dec1c18 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -168,6 +168,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 e9fd0e9..184a09e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -324,6 +324,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->flags || r->flags & IORESOURCE_UNSET) + continue; + r->flags |= IORESOURCE_PCI_FIXED; + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LSI_LOGIC, PCI_ANY_ID, quirk_bar_fixed); + static void quirk_io(struct pci_dev *dev, int pos, unsigned size, const char *name) { diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 22ef9a1..9b27e15 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -2144,6 +2144,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; -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/