10000 Merge tag 'acpi-4.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel… · bsd-unix/linux@7ed18e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ed18e2

Browse files
committed
Merge tag 'acpi-4.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "All of these fix recent regressions in ACPICA, in the ACPI PCI IRQ management code and in the ACPI AML debugger. Specifics: - Fix a lock ordering issue in ACPICA introduced by a recent commit that attempted to fix a deadlock in the dynamic table loading code which in turn appeared after changes related to the handling of module-level AML also made in this cycle (Lv Zheng). - Fix a recent regression in the ACPI IRQ management code that may cause PCI drivers to be unable to register an IRQ if that IRQ happens to be shared with a device on the ISA bus, like the parallel port, by reverting one commit entirely and restoring the previous behavior in two other places (Sinan Kaya). - Fix a recent regression in the ACPI AML debugger introduced by the commit that removed incorrect usage of IS_ERR_VALUE() from multiple places (Lv Zheng)" * tag 'acpi-4.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / debugger: Fix regression introduced by IS_ERR_VALUE() removal ACPICA: Namespace: Fix namespace/interpreter lock ordering ACPI,PCI,IRQ: separate ISA penalty calculation Revert "ACPI, PCI, IRQ: remove redundant code in acpi_irq_penalty_init()" ACPI,PCI,IRQ: factor in PCI possible
2 parents c09230f + b6d9015 commit 7ed18e2

File tree

6 files changed

+60
-25
lines changed

6 files changed

+60
-25
lines changed

arch/x86/pci/acpi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ int __init pci_acpi_init(void)
396396
return -ENODEV;
397397

398398
printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
399+
acpi_irq_penalty_init();
399400
pcibios_enable_irq = acpi_pci_irq_enable;
400401
pcibios_disable_irq = acpi_pci_irq_disable;
401402
x86_init.pci.init_irq = x86_init_noop;

drivers/acpi/acpi_dbg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static int acpi_aml_read_user(char __user *buf, int len)
602602
crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1);
603603
ret = n;
604604
out:
605-
acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, !ret);
605+
acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, ret >= 0);
606606
return ret;
607607
}
608608

@@ -672,7 +672,7 @@ static int acpi_aml_write_user(const char __user *buf, int len)
672672
crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1);
673673
ret = n;
674674
out:
675-
acpi_aml_unlock_fifo(ACPI_AML_IN_USER, !ret);
675+
acpi_aml_unlock_fifo(ACPI_AML_IN_USER, ret >= 0);
676676
return n;
677677
}
678678

drivers/acpi/acpica/nsload.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "acnamesp.h"
4747
#include "acdispat.h"
4848
#include "actables.h"
49+
#include "acinterp.h"
4950

5051
#define _COMPONENT ACPI_NAMESPACE
5152
ACPI_MODULE_NAME("nsload")
@@ -78,6 +79,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
7879

7980
ACPI_FUNCTION_TRACE(ns_load_table);
8081

82+
acpi_ex_enter_interpreter();
83+
8184
/*
8285
* Parse the table and load the namespace with all named
8386
* objects found within. Control methods are NOT parsed
@@ -89,7 +92,7 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
8992
*/
9093
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
9194
if (ACPI_FAILURE(status)) {
92-
return_ACPI_STATUS(status);
95+
goto unlock_interp;
9396
}
9497

9598
/* If table already loaded into namespace, just return */
@@ -130,6 +133,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
130133

131134
unlock:
132135
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
136+
unlock_interp:
137+
(void)acpi_ex_exit_interpreter();
133138

134139
if (ACPI_FAILURE(status)) {
135140
return_ACPI_STATUS(status);

drivers/acpi/acpica/nsparse.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include "acparser.h"
4848
#include "acdispat.h"
4949
#include "actables.h"
50-
#include "acinterp.h"
5150

5251
#define _COMPONENT ACPI_NAMESPACE
5352
ACPI_MODULE_NAME("nsparse")
@@ -171,8 +170,6 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
171170

172171
ACPI_FUNCTION_TRACE(ns_parse_table);
173172

174-
acpi_ex_enter_interpreter();
175-
176173
/*
177174
* AML Parse, pass 1
178175
*
@@ -188,7 +185,7 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
188185
status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1,
189186
table_index, start_node);
190187
if (ACPI_FAILURE(status)) {
191-
goto error_exit;
188+
return_ACPI_STATUS(status);
192189
}
193190

194191
/*
@@ -204,10 +201,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
204201
status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2,
205202
table_index, start_node);
206203
if (ACPI_FAILURE(status)) {
207-
goto error_exit;
204+
return_ACPI_STATUS(status);
208205
}
209206

210-
error_exit:
211-
acpi_ex_exit_interpreter();
212207
return_ACPI_STATUS(status);
213208
}

drivers/acpi/pci_link.c

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ static int acpi_irq_pci_sharing_penalty(int irq)
470470
{
471471
struct acpi_pci_link *link;
472472
int penalty = 0;
473+
int i;
473474

474475
list_for_each_entry(link, &acpi_link_list, list) {
475476
/*
@@ -478,18 +479,14 @@ static int acpi_irq_pci_sharing_penalty(int irq)
478479
*/
479480
if (link->irq.active && link->irq.active == irq)
480481
penalty += PIRQ_PENALTY_PCI_USING;
481-
else {
482-
int i;
483-
484-
/*
485-
* If a link is inactive, penalize the IRQs it
486-
* might use, but not as severely.
487-
*/
488-
for (i = 0; i < link->irq.possible_count; i++)
489-
if (link->irq.possible[i] == irq)
490-
penalty += PIRQ_PENALTY_PCI_POSSIBLE /
491-
link->irq.possible_count;
492-
}
482+
483+
/*
484+
* penalize the IRQs PCI might use, but not as severely.
485+
*/
486+
for (i = 0; i < link->irq.possible_count; i++)
487+
if (link->irq.possible[i] == irq)
488+
penalty += PIRQ_PENALTY_PCI_POSSIBLE /
489+
link->irq.possible_count;
493490
}
494491

495492
return penalty;
@@ -499,9 +496,6 @@ static int acpi_irq_get_penalty(int irq)
499496
{
500497
int penalty = 0;
501498

502-
if (irq < ACPI_MAX_ISA_IRQS)
503-
penalty += acpi_isa_irq_penalty[irq];
504-
505499
/*
506500
* Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict
507501
* with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be
@@ -516,10 +510,49 @@ static int acpi_irq_get_penalty(int irq)
516510
penalty += PIRQ_PENALTY_PCI_USING;
517511
}
518512

513+
if (irq < ACPI_MAX_ISA_IRQS)
514+
return penalty + acpi_isa_irq_penalty[irq];
515+
519516
penalty += acpi_irq_pci_sharing_penalty(irq);
520517
return penalty;
521518
}
522519

520+
int __init acpi_irq_penalty_init(void)
521+
{
522+
struct acpi_pci_link *link;
523+
int i;
524+
525+
/*
526+
* Update penalties to facilitate IRQ balancing.
527+
*/
528+
list_for_each_entry(link, &acpi_link_list, list) {
529+
530+
/*
531+
* reflect the possible and active irqs in the penalty table --
532+
* useful for breaking ties.
533+
*/
534+
if (link->irq.possible_count) {
535+
int penalty =
536+
PIRQ_PENALTY_PCI_POSSIBLE /
537+
link->irq.possible_count;
538+
539+
for (i = 0; i < link->irq.possible_count; i++) {
540+
if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS)
541+
acpi_isa_irq_penalty[link->irq.
542+
possible[i]] +=
543+
penalty;
544+
}
545+
546+
} else if (link->irq.active &&
547+
(link->irq.active < ACPI_MAX_ISA_IRQS)) {
548+
acpi_isa_irq_penalty[link->irq.active] +=
549+
PIRQ_PENALTY_PCI_POSSIBLE;
550+
}
551+
}
552+
553+
return 0;
554+
}
555+
523556
static int acpi_irq_balance = -1; /* 0: static, 1: balance */
524557

525558
static int acpi_pci_link_allocate(struct acpi_pci_link *link)

include/acpi/acpi_drivers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878

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

81+
int acpi_irq_penalty_init(void);
8182
int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering,
8283
int *polarity, char **name);
8384
int acpi_pci_link_free_irq(acpi_handle handle);

0 commit comments

Comments
 (0)
0