mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
PCI: Enable unassigned resource reallocation on per-bus basis
pci_realloc_detect() turns on automatic resource allocation when it finds unassigned SR-IOV resources. Previously it did this on a global basis, so we enabled reallocation if any PCI device anywhere had an unassigned SR-IOV resource. This patch changes pci_realloc_detect() so it looks at a single bus, so we can do this when a host bridge is hot-added. [bhelgaas: changelog] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
fa216bf4db
commit
967260cdb1
1 changed files with 23 additions and 19 deletions
|
@ -1354,9 +1354,9 @@ void __init pci_realloc_get_opt(char *str)
|
||||||
else if (!strncmp(str, "on", 2))
|
else if (!strncmp(str, "on", 2))
|
||||||
pci_realloc_enable = user_enabled;
|
pci_realloc_enable = user_enabled;
|
||||||
}
|
}
|
||||||
static bool __init pci_realloc_enabled(void)
|
static bool __init pci_realloc_enabled(enum enable_type enable)
|
||||||
{
|
{
|
||||||
return pci_realloc_enable >= user_enabled;
|
return enable >= user_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO)
|
#if defined(CONFIG_PCI_IOV) && defined(CONFIG_PCI_REALLOC_ENABLE_AUTO)
|
||||||
|
@ -1383,24 +1383,26 @@ static int __init iov_resources_unassigned(struct pci_dev *dev, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init pci_realloc_detect(void)
|
static enum enable_type __init pci_realloc_detect(struct pci_bus *bus,
|
||||||
|
enum enable_type enable_local)
|
||||||
{
|
{
|
||||||
bool unassigned = false;
|
bool unassigned = false;
|
||||||
struct pci_bus *bus;
|
|
||||||
|
|
||||||
if (pci_realloc_enable != undefined)
|
if (enable_local != undefined)
|
||||||
return;
|
return enable_local;
|
||||||
|
|
||||||
list_for_each_entry(bus, &pci_root_buses, node) {
|
pci_walk_bus(bus, iov_resources_unassigned, &unassigned);
|
||||||
pci_walk_bus(bus, iov_resources_unassigned, &unassigned);
|
if (unassigned)
|
||||||
if (unassigned) {
|
return auto_enabled;
|
||||||
pci_realloc_enable = auto_enabled;
|
|
||||||
return;
|
return enable_local;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void __init pci_realloc_detect(void) { }
|
static enum enable_type __init pci_realloc_detect(struct pci_bus *bus,
|
||||||
|
enum enable_type enable_local)
|
||||||
|
{
|
||||||
|
return enable_local;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1422,10 +1424,12 @@ pci_assign_unassigned_resources(void)
|
||||||
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
|
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
|
||||||
IORESOURCE_PREFETCH;
|
IORESOURCE_PREFETCH;
|
||||||
int pci_try_num = 1;
|
int pci_try_num = 1;
|
||||||
|
enum enable_type enable_local = pci_realloc_enable;
|
||||||
|
|
||||||
/* don't realloc if asked to do so */
|
list_for_each_entry(bus, &pci_root_buses, node)
|
||||||
pci_realloc_detect();
|
enable_local = pci_realloc_detect(bus, enable_local);
|
||||||
if (pci_realloc_enabled()) {
|
|
||||||
|
if (pci_realloc_enabled(enable_local)) {
|
||||||
int max_depth = pci_get_max_depth();
|
int max_depth = pci_get_max_depth();
|
||||||
|
|
||||||
pci_try_num = max_depth + 1;
|
pci_try_num = max_depth + 1;
|
||||||
|
@ -1457,9 +1461,9 @@ pci_assign_unassigned_resources(void)
|
||||||
goto enable_and_dump;
|
goto enable_and_dump;
|
||||||
|
|
||||||
if (tried_times >= pci_try_num) {
|
if (tried_times >= pci_try_num) {
|
||||||
if (pci_realloc_enable == undefined)
|
if (enable_local == undefined)
|
||||||
printk(KERN_INFO "Some PCI device resources are unassigned, try booting with pci=realloc\n");
|
printk(KERN_INFO "Some PCI device resources are unassigned, try booting with pci=realloc\n");
|
||||||
else if (pci_realloc_enable == auto_enabled)
|
else if (enable_local == auto_enabled)
|
||||||
printk(KERN_INFO "Automatically enabled pci realloc, if you have problem, try booting with pci=realloc=off\n");
|
printk(KERN_INFO "Automatically enabled pci realloc, if you have problem, try booting with pci=realloc=off\n");
|
||||||
|
|
||||||
free_list(&fail_head);
|
free_list(&fail_head);
|
||||||
|
|
Loading…
Reference in a new issue