Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm+acpi-4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI fixes from Rafael Wysocki:
"These are two reverts of recent PCI-related ACPI core changes (one of
which caused some systems to crash on boot and the other was a cleanup
on top of it) and a devfreq fix for Tegra.

Specifics:

- Revert an ACPI core change related to IRQ management in PCI that
introduced code relying on the use of kmalloc() which turned out to
also run during early init when that's not available yet and caused
some systems to crash on boot for this reason along with a cleanup
on top of it (Rafael Wysocki).

- Prevent devfreq from flooding the kernel log with useless messages
on Tegra (which started to happen after some recent changes in the
devfreq core) by fixing the driver to follow the documentation and
the core's expectations in its ->target callback (Tomeu Vizoso)"

* tag 'pm+acpi-4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
Revert "ACPI, PCI, irq: remove interrupt count restriction"
Revert "ACPI / PCI: Simplify acpi_penalize_isa_irq()"
PM / devfreq: tegra: Set freq in rate callback

+36 -94
+34 -94
drivers/acpi/pci_link.c
··· 4 4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> 5 5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 6 6 * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> 7 - * Copyright (c) 2015, The Linux Foundation. All rights reserved. 8 7 * 9 8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 9 * ··· 437 438 * enabled system. 438 439 */ 439 440 441 + #define ACPI_MAX_IRQS 256 440 442 #define ACPI_MAX_ISA_IRQ 16 441 443 442 444 #define PIRQ_PENALTY_PCI_AVAILABLE (0) ··· 447 447 #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) 448 448 #define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16) 449 449 450 - static int acpi_irq_isa_penalty[ACPI_MAX_ISA_IRQ] = { 450 + static int acpi_irq_penalty[ACPI_MAX_IRQS] = { 451 451 PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ 452 452 PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ 453 453 PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ ··· 464 464 PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ 465 465 PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ 466 466 PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ 467 + /* >IRQ15 */ 467 468 }; 468 - 469 - struct irq_penalty_info { 470 - int irq; 471 - int penalty; 472 - struct list_head node; 473 - }; 474 - 475 - static LIST_HEAD(acpi_irq_penalty_list); 476 - 477 - static int acpi_irq_get_penalty(int irq) 478 - { 479 - struct irq_penalty_info *irq_info; 480 - 481 - if (irq < ACPI_MAX_ISA_IRQ) 482 - return acpi_irq_isa_penalty[irq]; 483 - 484 - list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { 485 - if (irq_info->irq == irq) 486 - return irq_info->penalty; 487 - } 488 - 489 - return 0; 490 - } 491 - 492 - static int acpi_irq_set_penalty(int irq, int new_penalty) 493 - { 494 - struct irq_penalty_info *irq_info; 495 - 496 - /* see if this is a ISA IRQ */ 497 - if (irq < ACPI_MAX_ISA_IRQ) { 498 - acpi_irq_isa_penalty[irq] = new_penalty; 499 - return 0; 500 - } 501 - 502 - /* next, try to locate from the dynamic list */ 503 - list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { 504 - if (irq_info->irq == irq) { 505 - irq_info->penalty = new_penalty; 506 - return 0; 507 - } 508 - } 509 - 510 - /* nope, let's allocate a slot for this IRQ */ 511 - irq_info = kzalloc(sizeof(*irq_info), GFP_KERNEL); 512 - if (!irq_info) 513 - return -ENOMEM; 514 - 515 - irq_info->irq = irq; 516 - irq_info->penalty = new_penalty; 517 - list_add_tail(&irq_info->node, &acpi_irq_penalty_list); 518 - 519 - return 0; 520 - } 521 - 522 - static void acpi_irq_add_penalty(int irq, int penalty) 523 - { 524 - int curpen = acpi_irq_get_penalty(irq); 525 - 526 - acpi_irq_set_penalty(irq, curpen + penalty); 527 - } 528 469 529 470 int __init acpi_irq_penalty_init(void) 530 471 { ··· 487 546 link->irq.possible_count; 488 547 489 548 for (i = 0; i < link->irq.possible_count; i++) { 490 - if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) { 491 - int irqpos = link->irq.possible[i]; 492 - 493 - acpi_irq_add_penalty(irqpos, penalty); 494 - } 549 + if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) 550 + acpi_irq_penalty[link->irq. 551 + possible[i]] += 552 + penalty; 495 553 } 496 554 497 555 } else if (link->irq.active) { 498 - acpi_irq_add_penalty(link->irq.active, 499 - PIRQ_PENALTY_PCI_POSSIBLE); 556 + acpi_irq_penalty[link->irq.active] += 557 + PIRQ_PENALTY_PCI_POSSIBLE; 500 558 } 501 559 } 502 560 ··· 547 607 * the use of IRQs 9, 10, 11, and >15. 548 608 */ 549 609 for (i = (link->irq.possible_count - 1); i >= 0; i--) { 550 - if (acpi_irq_get_penalty(irq) > 551 - acpi_irq_get_penalty(link->irq.possible[i])) 610 + if (acpi_irq_penalty[irq] > 611 + acpi_irq_penalty[link->irq.possible[i]]) 552 612 irq = link->irq.possible[i]; 553 613 } 554 614 } 555 - if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { 615 + if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) { 556 616 printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " 557 617 "Try pci=noacpi or acpi=off\n", 558 618 acpi_device_name(link->device), ··· 568 628 acpi_device_bid(link->device)); 569 629 return -ENODEV; 570 630 } else { 571 - acpi_irq_add_penalty(link->irq.active, PIRQ_PENALTY_PCI_USING); 572 - 631 + acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; 573 632 printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", 574 633 acpi_device_name(link->device), 575 634 acpi_device_bid(link->device), link->irq.active); ··· 778 839 } 779 840 780 841 /* 781 - * modify penalty from cmdline 842 + * modify acpi_irq_penalty[] from cmdline 782 843 */ 783 844 static int __init acpi_irq_penalty_update(char *str, int used) 784 845 { ··· 796 857 if (irq < 0) 797 858 continue; 798 859 860 + if (irq >= ARRAY_SIZE(acpi_irq_penalty)) 861 + continue; 862 + 799 863 if (used) 800 - acpi_irq_add_penalty(irq, PIRQ_PENALTY_ISA_USED); 864 + acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; 801 865 else 802 - acpi_irq_set_penalty(irq, PIRQ_PENALTY_PCI_AVAILABLE); 866 + acpi_irq_penalty[irq] = PIRQ_PENALTY_PCI_AVAILABLE; 803 867 804 868 if (retval != 2) /* no next number */ 805 869 break; ··· 819 877 */ 820 878 void acpi_penalize_isa_irq(int irq, int active) 821 879 { 822 - if (irq >= 0) 823 - acpi_irq_add_penalty(irq, active ? 824 - PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING); 880 + if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { 881 + if (active) 882 + acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; 883 + else 884 + acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; 885 + } 825 886 } 826 887 827 888 bool acpi_isa_irq_available(int irq) 828 889 { 829 - return irq >= 0 && 830 - (acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS); 890 + return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) || 891 + acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS); 831 892 } 832 893 833 894 /* ··· 840 895 */ 841 896 void acpi_penalize_sci_irq(int irq, int trigger, int polarity) 842 897 { 843 - int penalty; 844 - 845 - if (irq < 0) 846 - return; 847 - 848 - if (trigger != ACPI_MADT_TRIGGER_LEVEL || 849 - polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) 850 - penalty = PIRQ_PENALTY_ISA_ALWAYS; 851 - else 852 - penalty = PIRQ_PENALTY_PCI_USING; 853 - 854 - acpi_irq_add_penalty(irq, penalty); 898 + if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { 899 + if (trigger != ACPI_MADT_TRIGGER_LEVEL || 900 + polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) 901 + acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_ALWAYS; 902 + else 903 + acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; 904 + } 855 905 } 856 906 857 907 /*
+2
drivers/devfreq/tegra-devfreq.c
··· 500 500 clk_set_min_rate(tegra->emc_clock, rate); 501 501 clk_set_rate(tegra->emc_clock, 0); 502 502 503 + *freq = rate; 504 + 503 505 return 0; 504 506 } 505 507