From patchwork Wed Sep 23 00:09:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 7246621 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 97B4EBEEC1 for ; Wed, 23 Sep 2015 00:10:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BB46207BF for ; Wed, 23 Sep 2015 00:10:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63A2E207A9 for ; Wed, 23 Sep 2015 00:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934700AbbIWAKB (ORCPT ); Tue, 22 Sep 2015 20:10:01 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:38724 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934608AbbIWAKA (ORCPT ); Tue, 22 Sep 2015 20:10:00 -0400 Received: by igxx6 with SMTP id x6so19526123igx.1; Tue, 22 Sep 2015 17:10:00 -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; bh=YSiWWhvExptI7wZ9ZLYZQNUnhVYaurFqKz/mF1Q/0e4=; b=HKXrPV4YjUgkv72U9sN4GGNUovQd3kaUX54p6rjJ10L4c9f9lnp6aWut+1q8rW+eU3 rjnj4f8xUNy7qzQAAbGoxPfF8NoOCl9NVh1S/FBRwxHlb9WjunbHlx3YqzfPRxeSu9a8 sYSWhjlLsivWoF9pzlCZjiYX8phaU5CmPdlP+f1eFFEF8XgAsTKJu6kPfEuNoYoFUd36 vSJbLQlnTVugWBQWUlgNpp/WuQWykgEAZk9A4mB1jZ7KjYihvoi4HSxx56W09zbAHoUE eqZgOZORwKg34CXtbFZ673yKvEaBLXFyAMsAez8jIEdFU/fIueYEzs5iwF7Wfzcn4jiZ sq6g== X-Received: by 10.50.83.37 with SMTP id n5mr19649532igy.59.1442967000167; Tue, 22 Sep 2015 17:10:00 -0700 (PDT) Received: from dl.caveonetworks.com (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by smtp.gmail.com with ESMTPSA id 67sm2374411iol.7.2015.09.22.17.09.58 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Sep 2015 17:09:59 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id t8N09vl9013453; Tue, 22 Sep 2015 17:09:57 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t8N09vt7013452; Tue, 22 Sep 2015 17:09:57 -0700 From: David Daney To: linux-kernel@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.org, Marc Zyngier , Catalin Marinas , Bjorn Helgaas , linux-pci@vger.kernel.org Cc: David Daney Subject: [PATCH] arm64/pci: Add quirks for Cavium Thunder PCI bridges. Date: Tue, 22 Sep 2015 17:09:56 -0700 Message-Id: <1442966996-13419-1-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 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.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=ham 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 From: David Daney The Cavium ThunderX SoC needs a PCI quirk for its on-chip bridges. Since it is arm64, create a new quirks.c file there to contain arm64 related quirks. Add the ThunderX bridge quirk, gated by a new config variable, so that it can be disabled for kernels that aren't expected to be used on ThunderX. Signed-off-by: David Daney --- arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/quirks.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/quirks.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8bd55c5..7fdf94a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -359,6 +359,17 @@ config CAVIUM_ERRATUM_23154 If unsure, say Y. +config CAVIUM_THUNDER_PCI_QUIRKS + bool "Cavium PCI quirk workarounds" + depends on PCI + help + + Some ThunderX systems have PCI quirk workarounds that must + be enabled to be able to use PCI devices. This option + enables the workarounds. + + If unsure, say Y. + endmenu diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 22dc9bc..f80aa01 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -33,7 +33,7 @@ arm64-obj-$(CONFIG_CPU_IDLE) += cpuidle.o arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o arm64-obj-$(CONFIG_KGDB) += kgdb.o arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o -arm64-obj-$(CONFIG_PCI) += pci.o +arm64-obj-$(CONFIG_PCI) += pci.o quirks.o arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o arm64-obj-$(CONFIG_ACPI) += acpi.o diff --git a/arch/arm64/kernel/quirks.c b/arch/arm64/kernel/quirks.c new file mode 100644 index 0000000..7352bd4 --- /dev/null +++ b/arch/arm64/kernel/quirks.c @@ -0,0 +1,36 @@ +/* + * PCIe quirks for arm64 + * + * Copyright (C) 2015 Cavium, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + */ + +#include + +#ifdef CONFIG_CAVIUM_THUNDER_PCI_QUIRKS +static void thunder_bridge_fixup(struct pci_dev *dev) +{ + /* + * This bridge is broken in that it doesn't have correct + * resource ranges for the buses behind it. + * + * The upstream bus resources are a close enough approximation + * to what is needed, that they can be used instead. Copy + * upstream root bus resources so that resource claiming for + * downstream devices can be done. + */ + int resno; + struct pci_bus *bus = dev->subordinate; + + for (resno = 0; resno < PCI_BRIDGE_RESOURCE_NUM; resno++) { + bus->resource[resno] = + pci_bus_resource_n(bus->parent, + PCI_BRIDGE_RESOURCE_NUM + resno); + } +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CAVIUM, 0xa002, thunder_bridge_fixup); +#endif /* CONFIG_CAVIUM_THUNDER_PCI_QUIRKS */