Skip to content

Commit

Permalink
Revert "ACPI, PCI, IRQ: remove redundant code in acpi_irq_penalty_ini…
Browse files Browse the repository at this point in the history
…t()"

Trying to make the ISA and PCI init functionality common turned out
to be a bad idea, because the ISA path depends on external
functionality.

Restore the previous behavior and limit the refactoring to PCI
interrupts only.

Fixes: 1fcb6a8 "ACPI,PCI,IRQ: remove redundant code in acpi_irq_penalty_init()"
Signed-off-by: Sinan Kaya <[email protected]>
Tested-by: Wim Osterholt <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
Sinan Kaya authored and rafaeljw committed Jul 1, 2016
1 parent 4a6e68b commit 487cf91
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/pci/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ int __init pci_acpi_init(void)
return -ENODEV;

printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
acpi_irq_penalty_init();
pcibios_enable_irq = acpi_pci_irq_enable;
pcibios_disable_irq = acpi_pci_irq_disable;
x86_init.pci.init_irq = x86_init_noop;
Expand Down
36 changes: 36 additions & 0 deletions drivers/acpi/pci_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,42 @@ static int acpi_irq_get_penalty(int irq)
return penalty;
}

int __init acpi_irq_penalty_init(void)
{
struct acpi_pci_link *link;
int i;

/*
* Update penalties to facilitate IRQ balancing.
*/
list_for_each_entry(link, &acpi_link_list, list) {

/*
* reflect the possible and active irqs in the penalty table --
* useful for breaking ties.
*/
if (link->irq.possible_count) {
int penalty =
PIRQ_PENALTY_PCI_POSSIBLE /
link->irq.possible_count;

for (i = 0; i < link->irq.possible_count; i++) {
if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS)
acpi_isa_irq_penalty[link->irq.
possible[i]] +=
penalty;
}

} else if (link->irq.active &&
(link->irq.active < ACPI_MAX_ISA_IRQS)) {
acpi_isa_irq_penalty[link->irq.active] +=
PIRQ_PENALTY_PCI_POSSIBLE;
}
}

return 0;
}

static int acpi_irq_balance = -1; /* 0: static, 1: balance */

static int acpi_pci_link_allocate(struct acpi_pci_link *link)
Expand Down
1 change: 1 addition & 0 deletions include/acpi/acpi_drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@

/* ACPI PCI Interrupt Link (pci_link.c) */

int acpi_irq_penalty_init(void);
int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering,
int *polarity, char **name);
int acpi_pci_link_free_irq(acpi_handle handle);
Expand Down

0 comments on commit 487cf91

Please sign in to comment.