From patchwork Fri Aug 17 10:26:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 144463 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp595695ljj; Fri, 17 Aug 2018 03:27:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPymiY2+4t+MFeO30fJEHIzHQ/sbr0vzYiWKx/p2b/VpngEQQPsiY4csc+oRBmt7PswkHrWd X-Received: by 2002:a63:81c3:: with SMTP id t186-v6mr33050853pgd.413.1534501665902; Fri, 17 Aug 2018 03:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534501665; cv=none; d=google.com; s=arc-20160816; b=DbOFjAfnoiv2XaN+C1BJE2XTP8DsPl+Ouf8OgmWWWwF5wyN650OaaYiTJSsbUqzAO5 WkQUy/+wQ8cVwh8LCuUjLWKZ6roxKfM3hCvpaDb0aW12YmaYVHR2RTu8mYjoOG1GzSDN +A9XScldbFCRe/bImtqOSc8wJu8H2oTypdX7yI5tdwFpM5kRUb2aAzUvnPdX6/ULWmIO A3oANbboe0zUUXZIxa46PESpxACPtHfRn/v0hMuWLR8NqinURWDflh8xGQB4/IcPV4Xq gOimHZfO5Ohnl7M5PiY30h2AHMjXKX0WyT2Z/C7lYqdY/0mQE+xpXdrmZ3JV4P/n425i 8sPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Y9CQbTeAKbG535slRqUY+wj+BWJX8MRE+fUcpjVOYCc=; b=V30ZjmS0+IkpRFZNq7dGyEiGvNVcynGkb71Yy+kWDbMLIDE/+o+//19JecNg3HitiX +RCWthQaYghoObc2++4QlvwsdPa0B64e/zVsBNr2x7OX9FRT256hFIXoZjAjFN086+Ui yk0UlwT2fctK4wCop23cF+3ZGa/C9ri4tevzxeHConCm39+jq5BqOqZQp6qHK6iAKCo2 4L13pBauOsxzTDC3aapjWK7fJk+LNUj2tgMgYGWSyfi3ddSFO7TRzaNtQt/c0Mquj7gt kAwwNdAa/oOeyNnaLOOVelvQ1ybV+HHMRpDlBVf41AUYLo0dopozbuVUyohEumPkAFNa eadQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v84-v6si1867227pfd.71.2018.08.17.03.27.45; Fri, 17 Aug 2018 03:27:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727342AbeHQNag (ORCPT + 32 others); Fri, 17 Aug 2018 09:30:36 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:39429 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726218AbeHQNae (ORCPT ); Fri, 17 Aug 2018 09:30:34 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LnjcV-1gM7mA1Qsh-00hrda; Fri, 17 Aug 2018 12:27:21 +0200 From: Arnd Bergmann To: linux-pci@vger.kernel.org, Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, Christoph Hellwig , Lorenzo Pieralisi , Benjamin Herrenschmidt , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, Arnd Bergmann Subject: [RFC 15/15] PCI: make pcibios_add_bus/remove_bus callbacks Date: Fri, 17 Aug 2018 12:26:45 +0200 Message-Id: <20180817102645.3839621-16-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180817102645.3839621-1-arnd@arndb.de> References: <20180817102645.3839621-1-arnd@arndb.de> X-Provags-ID: V03:K1:rGoCCDOtdTx0VIyssezT4pFtEqNhxuve6iKaXwJBHf+4WU+8faw Dpu9wq8RQiguXqn4V5akgwPWXgaOy5cgDTJiHcHLT3xv/oOaMtG54uC8vvLQSdW///4q0nw I5RKZeCd07/18v074X+Gqwju9Ri5zhyU1Epl7WlCft+LD22RQMCW/zNHZIYUSLUK+qnJWcB s4jqjjsW1kamBVSX4DlSQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:YniJy3MqZc4=:nm3kiV+WQhPrhRGL9FUae4 i9umo/rybRlnAwRBDrn0Sy3HDXlVnfDLSzZOxABcc41K/uvEt/E68HLmwCmngDQ6OcM+2GNfd 8nnlmOFxxtqtwHEzgVUkPB1fIDgojYiFYkK5qN4pJ6IayqWWxNen8/weDzNMc+qNOYKEBhrfq soau4uR6N3N+Xb1x6JECyrI9/ISINZ9G8yIgpAwed+3qbjZknFJVWrZ7V60urdilBY21F3Qt9 pAr9l0vTc0+QkNtXxB+M/iVR9UgZ2yBhlZkkt5HQnB8NwazdTnh0qN2t5LQtqpL2L9hHypKpA +t/m5IyTJ9YzdRa+uMSX5qW5lv3m9F4ZVeI9fEvlmSRIt2+QzAJdoI99j6UnwvfgE8eSs1eyM ZTao4rMwDbxh2LQ4EpQqOwPxMPlTi+0IRKoGHG6O4AKxrLqiSnnvZseksx43Kn61k9BVDx1Ma ET7i6/K4sTPxQ1AXOAoM7ICrkL8j+hJuCPYMAgaAWZUeDi8fL+fpc25XRHVb/ysqeD2Q9A8mW 8bcQvko0r7dsZGkIPuwyk9EEFPJu+I10wbaZa6GUEdw8HT0zpBa+zUc2ndEZTwlysp6t4h1Fv gshhS1OCrYReZLvwuaXZb11++WnFla0gulPGVHpXg6K4nlAbrbQIAkmTatn3WZC5VP+OL7Wm4 xcoO4RnkSDCOS68WDbU/eGt0VezXnwrW1XiPIAvcYkjf7ZhcwV5SWPWDfCKOHJR3jiO0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are mostly not architecture specific but are meant for particular PCI host bridge implementations, in particular for the ACPI version. Turn them both into callback functions that are implemented by the APCI PCI implementation as well as the one architecture that overrides pcibios_remove_bus. Signed-off-by: Arnd Bergmann --- arch/arm64/kernel/pci.c | 10 ---------- arch/ia64/pci/pci.c | 10 ---------- arch/s390/pci/pci.c | 3 ++- arch/x86/pci/common.c | 10 ---------- drivers/acpi/pci_root.c | 2 ++ drivers/pci/probe.c | 12 ++++++++++-- include/linux/pci.h | 2 ++ 7 files changed, 16 insertions(+), 33 deletions(-) -- 2.18.0 diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 8958a7c32a9f..99fac25efe88 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -191,14 +191,4 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return bus; } -void pcibios_add_bus(struct pci_bus *bus) -{ - acpi_pci_add_bus(bus); -} - -void pcibios_remove_bus(struct pci_bus *bus) -{ - acpi_pci_remove_bus(bus); -} - #endif diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 511b8a058d80..f47e0920d308 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -367,16 +367,6 @@ void pcibios_fixup_bus(struct pci_bus *b) platform_pci_fixup_bus(b); } -void pcibios_add_bus(struct pci_bus *bus) -{ - acpi_pci_add_bus(bus); -} - -void pcibios_remove_bus(struct pci_bus *bus) -{ - acpi_pci_remove_bus(bus); -} - void pcibios_set_master (struct pci_dev *dev) { /* No special bus mastering setup handling */ diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index b21205f131ce..120beb83b6a5 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -769,7 +769,7 @@ static void zpci_free_domain(struct zpci_dev *zdev) spin_unlock(&zpci_domain_lock); } -void pcibios_remove_bus(struct pci_bus *bus) +static void zpci_remove_bus(struct pci_bus *bus) { struct zpci_dev *zdev = get_zdev_by_bus(bus); @@ -801,6 +801,7 @@ static struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, bridge->sysdata = sysdata; bridge->busnr = bus; bridge->ops = ops; + bridge->remove_bus = zpci_remove_bus; error = pci_scan_root_bus_bridge(bridge); if (error < 0) diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 920d0885434c..987e6fefd5d3 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -168,16 +168,6 @@ void pcibios_fixup_bus(struct pci_bus *b) pcibios_fixup_device_resources(dev); } -void pcibios_add_bus(struct pci_bus *bus) -{ - acpi_pci_add_bus(bus); -} - -void pcibios_remove_bus(struct pci_bus *bus) -{ - acpi_pci_remove_bus(bus); -} - /* * Only use DMI information to set this if nothing was passed * on the kernel command line (which was parsed earlier). diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 5da0f70c4e65..cf7a9a7bf1e7 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -911,6 +911,8 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, bridge->busnr = busnum; bridge->ops = ops->pci_ops; bridge->prepare = acpi_pci_root_bridge_prepare; + bridge->add_bus = acpi_pci_add_bus; + bridge->remove_bus = acpi_pci_remove_bus; pci_set_host_bridge_release(bridge, acpi_pci_root_release_info, info); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f493d7e299e6..86a678fa8c13 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2905,12 +2905,20 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus) } EXPORT_SYMBOL_GPL(pci_scan_child_bus); -void __weak pcibios_add_bus(struct pci_bus *bus) +void pcibios_add_bus(struct pci_bus *bus) { + struct pci_host_bridge *bridge = pci_find_host_bridge(bus); + + if (bridge->add_bus) + bridge->add_bus(bus); } -void __weak pcibios_remove_bus(struct pci_bus *bus) +void pcibios_remove_bus(struct pci_bus *bus) { + struct pci_host_bridge *bridge = pci_find_host_bridge(bus); + + if (bridge->remove_bus) + bridge->remove_bus(bus); } int pci_host_probe(struct pci_host_bridge *bridge) diff --git a/include/linux/pci.h b/include/linux/pci.h index 24216daef6f8..bc9635313747 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -479,6 +479,8 @@ struct pci_host_bridge { void (*bus_add_device)(struct pci_dev *pdev); int (*alloc_irq)(struct pci_dev *); int (*free_irq)(struct pci_dev *); + void (*add_bus)(struct pci_bus *); + void (*remove_bus)(struct pci_bus *); void *release_data; struct msi_controller *msi; unsigned int ignore_reset_delay:1; /* For entire hierarchy */