mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 18:11:39 +00:00
a50297cf82
In the existing code the creation of the PCI bus and the scanning of function zero all happens in zpci_scan_bus(). This in turn requires functions to be enabled and their resources to be available before the PCI bus is even created. This not only means that functions are enabled long before they are actually made available to the common PCI subsystem. In case of functions with non-zero devfn which appeared before the function with devfn zero they can wait arbitrarily long in this enabled but not scanned state. Fix this by separating the creation of the PCI bus from scanning it and only prepare, that is enable and setup MMIO bus resources, functions just before they are scanned. As they may be scanned multiple times track if we already created resources in the zdev. Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Acked-by: Pierre Morel <pmorel@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
36 lines
963 B
C
36 lines
963 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright IBM Corp. 2020
|
|
*
|
|
* Author(s):
|
|
* Pierre Morel <pmorel@linux.ibm.com>
|
|
*
|
|
*/
|
|
|
|
int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops);
|
|
void zpci_bus_device_unregister(struct zpci_dev *zdev);
|
|
|
|
int zpci_bus_scan_bus(struct zpci_bus *zbus);
|
|
|
|
int zpci_bus_scan_device(struct zpci_dev *zdev);
|
|
void zpci_bus_remove_device(struct zpci_dev *zdev, bool set_error);
|
|
|
|
void zpci_release_device(struct kref *kref);
|
|
static inline void zpci_zdev_put(struct zpci_dev *zdev)
|
|
{
|
|
kref_put(&zdev->kref, zpci_release_device);
|
|
}
|
|
|
|
int zpci_alloc_domain(int domain);
|
|
void zpci_free_domain(int domain);
|
|
int zpci_setup_bus_resources(struct zpci_dev *zdev,
|
|
struct list_head *resources);
|
|
|
|
static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus,
|
|
unsigned int devfn)
|
|
{
|
|
struct zpci_bus *zbus = bus->sysdata;
|
|
|
|
return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
|
|
}
|
|
|