diff options
Diffstat (limited to 'drivers/pci/probe.c')
| -rw-r--r-- | drivers/pci/probe.c | 60 | 
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 3d5271a7a849..512cb4312ddd 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -7,6 +7,7 @@  #include <linux/delay.h>  #include <linux/init.h>  #include <linux/pci.h> +#include <linux/msi.h>  #include <linux/of_device.h>  #include <linux/of_pci.h>  #include <linux/pci_hotplug.h> @@ -572,6 +573,7 @@ static void devm_pci_release_host_bridge_dev(struct device *dev)  		bridge->release_fn(bridge);  	pci_free_resource_list(&bridge->windows); +	pci_free_resource_list(&bridge->dma_ranges);  }  static void pci_release_host_bridge_dev(struct device *dev) @@ -897,6 +899,9 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)  	else  		pr_info("PCI host bridge to bus %s\n", name); +	if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE) +		dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n"); +  	/* Add initial resources to the bus */  	resource_list_for_each_entry_safe(window, n, &resources) {  		list_move_tail(&window->node, &bridge->windows); @@ -1089,14 +1094,15 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,   * @sec: updated with secondary bus number from EA   * @sub: updated with subordinate bus number from EA   * - * If @dev is a bridge with EA capability, update @sec and @sub with - * fixed bus numbers from the capability and return true.  Otherwise, - * return false. + * If @dev is a bridge with EA capability that specifies valid secondary + * and subordinate bus numbers, return true with the bus numbers in @sec + * and @sub.  Otherwise return false.   */  static bool pci_ea_fixed_busnrs(struct pci_dev *dev, u8 *sec, u8 *sub)  {  	int ea, offset;  	u32 dw; +	u8 ea_sec, ea_sub;  	if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE)  		return false; @@ -1108,8 +1114,13 @@ static bool pci_ea_fixed_busnrs(struct pci_dev *dev, u8 *sec, u8 *sub)  	offset = ea + PCI_EA_FIRST_ENT;  	pci_read_config_dword(dev, offset, &dw); -	*sec =  dw & PCI_EA_SEC_BUS_MASK; -	*sub = (dw & PCI_EA_SUB_BUS_MASK) >> PCI_EA_SUB_BUS_SHIFT; +	ea_sec =  dw & PCI_EA_SEC_BUS_MASK; +	ea_sub = (dw & PCI_EA_SUB_BUS_MASK) >> PCI_EA_SUB_BUS_SHIFT; +	if (ea_sec  == 0 || ea_sub < ea_sec) +		return false; + +	*sec = ea_sec; +	*sub = ea_sub;  	return true;  } @@ -2300,8 +2311,7 @@ void pcie_report_downtraining(struct pci_dev *dev)  static void pci_init_capabilities(struct pci_dev *dev)  { -	/* Enhanced Allocation */ -	pci_ea_init(dev); +	pci_ea_init(dev);		/* Enhanced Allocation */  	/* Setup MSI caps & disable MSI/MSI-X interrupts */  	pci_msi_setup_pci_dev(dev); @@ -2309,29 +2319,16 @@ static void pci_init_capabilities(struct pci_dev *dev)  	/* Buffers for saving PCIe and PCI-X capabilities */  	pci_allocate_cap_save_buffers(dev); -	/* Power Management */ -	pci_pm_init(dev); - -	/* Vital Product Data */ -	pci_vpd_init(dev); - -	/* Alternative Routing-ID Forwarding */ -	pci_configure_ari(dev); - -	/* Single Root I/O Virtualization */ -	pci_iov_init(dev); - -	/* Address Translation Services */ -	pci_ats_init(dev); - -	/* Enable ACS P2P upstream forwarding */ -	pci_enable_acs(dev); - -	/* Precision Time Measurement */ -	pci_ptm_init(dev); - -	/* Advanced Error Reporting */ -	pci_aer_init(dev); +	pci_pm_init(dev);		/* Power Management */ +	pci_vpd_init(dev);		/* Vital Product Data */ +	pci_configure_ari(dev);		/* Alternative Routing-ID Forwarding */ +	pci_iov_init(dev);		/* Single Root I/O Virtualization */ +	pci_ats_init(dev);		/* Address Translation Services */ +	pci_pri_init(dev);		/* Page Request Interface */ +	pci_pasid_init(dev);		/* Process Address Space ID */ +	pci_enable_acs(dev);		/* Enable ACS P2P upstream forwarding */ +	pci_ptm_init(dev);		/* Precision Time Measurement */ +	pci_aer_init(dev);		/* Advanced Error Reporting */  	pcie_report_downtraining(dev); @@ -2403,13 +2400,10 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)  	/* Fix up broken headers */  	pci_fixup_device(pci_fixup_header, dev); -	/* Moved out from quirk header fixup code */  	pci_reassigndev_resource_alignment(dev); -	/* Clear the state_saved flag */  	dev->state_saved = false; -	/* Initialize various capabilities */  	pci_init_capabilities(dev);  	/*  |