Skip to content

Commit c067aff

Browse files
committed
Merge tag 'acpi-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These fix recent ACPICA regressions, an older PCI IRQ management regression, and an incorrect return value of a function in the APEI code. Specifics: - Fix three ACPICA issues related to the interpreter locking and introduced by recent changes in that area (Lv Zheng). - Fix a PCI IRQ management regression introduced during the 4.7 cycle and related to the configuration of shared IRQs on systems with an ISA bus (Sinan Kaya). - Fix up a return value of one function in the APEI code (Punit Agrawal)" * tag 'acpi-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPICA: Dispatcher: Fix interpreter locking around acpi_ev_initialize_region() ACPICA: Dispatcher: Fix an unbalanced lock exit path in acpi_ds_auto_serialize_method() ACPICA: Dispatcher: Fix order issue of method termination ACPI / APEI: Fix incorrect return value of ghes_proc() ACPI/PCI: pci_link: Include PIRQ_PENALTY_PCI_USING for ISA IRQs ACPI/PCI: pci_link: penalize SCI correctly ACPI/PCI/IRQ: assign ISA IRQ directly during early boot stages
2 parents b546e0c + 21e2d9d commit c067aff

File tree

9 files changed

+54
-56
lines changed

9 files changed

+54
-56
lines changed

arch/x86/kernel/acpi/boot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger,
454454
polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
455455

456456
mp_override_legacy_irq(bus_irq, polarity, trigger, gsi);
457+
acpi_penalize_sci_irq(bus_irq, trigger, polarity);
457458

458459
/*
459460
* stash over-ride to indicate we've been here

drivers/acpi/acpica/dsinit.c

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

5051
#define _COMPONENT ACPI_DISPATCHER
5152
ACPI_MODULE_NAME("dsinit")
@@ -214,23 +215,17 @@ acpi_ds_initialize_objects(u32 table_index,
214215

215216
/* Walk entire namespace from the supplied root */
216217

217-
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
218-
if (ACPI_FAILURE(status)) {
219-
return_ACPI_STATUS(status);
220-
}
221-
222218
/*
223219
* We don't use acpi_walk_namespace since we do not want to acquire
224220
* the namespace reader lock.
225221
*/
226222
status =
227223
acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
228-
ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object,
229-
NULL, &info, NULL);
224+
0, acpi_ds_init_one_object, NULL, &info,
225+
NULL);
230226
if (ACPI_FAILURE(status)) {
231227
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
232228
}
233-
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
234229

235230
status = acpi_get_table_by_index(table_index, &table);
236231
if (ACPI_FAILURE(status)) {

drivers/acpi/acpica/dsmethod.c

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,11 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
9999
"Method auto-serialization parse [%4.4s] %p\n",
100100
acpi_ut_get_node_name(node), node));
101101

102-
acpi_ex_enter_interpreter();
103-
104102
/* Create/Init a root op for the method parse tree */
105103

106104
op = acpi_ps_alloc_op(AML_METHOD_OP, obj_desc->method.aml_start);
107105
if (!op) {
108-
status = AE_NO_MEMORY;
109-
goto unlock;
106+
return_ACPI_STATUS(AE_NO_MEMORY);
110107
}
111108

112109
acpi_ps_set_name(op, node->name.integer);
@@ -118,8 +115,7 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
118115
acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL);
119116
if (!walk_state) {
120117
acpi_ps_free_op(op);
121-
status = AE_NO_MEMORY;
122-
goto unlock;
118+
return_ACPI_STATUS(AE_NO_MEMORY);
123119
}
124120

125121
status = acpi_ds_init_aml_walk(walk_state, op, node,
@@ -138,8 +134,6 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
138134
status = acpi_ps_parse_aml(walk_state);
139135

140136
acpi_ps_delete_parse_tree(op);
141-
unlock:
142-
acpi_ex_exit_interpreter();
143137
return_ACPI_STATUS(status);
144138
}
145139

@@ -730,26 +724,6 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
730724

731725
acpi_ds_method_data_delete_all(walk_state);
732726

733-
/*
734-
* If method is serialized, release the mutex and restore the
735-
* current sync level for this thread
736-
*/
737-
if (method_desc->method.mutex) {
738-
739-
/* Acquisition Depth handles recursive calls */
740-
741-
method_desc->method.mutex->mutex.acquisition_depth--;
742-
if (!method_desc->method.mutex->mutex.acquisition_depth) {
743-
walk_state->thread->current_sync_level =
744-
method_desc->method.mutex->mutex.
745-
original_sync_level;
746-
747-
acpi_os_release_mutex(method_desc->method.
748-
mutex->mutex.os_mutex);
749-
method_desc->method.mutex->mutex.thread_id = 0;
750-
}
751-
}
752-
753727
/*
754728
* Delete any namespace objects created anywhere within the
755729
* namespace by the execution of this method. Unless:
@@ -786,6 +760,26 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
786760
~ACPI_METHOD_MODIFIED_NAMESPACE;
787761
}
788762
}
763+
764+
/*
765+
* If method is serialized, release the mutex and restore the
766+
* current sync level for this thread
767+
*/
768+
if (method_desc->method.mutex) {
769+
770+
/* Acquisition Depth handles recursive calls */
771+
772+
method_desc->method.mutex->mutex.acquisition_depth--;
773+
if (!method_desc->method.mutex->mutex.acquisition_depth) {
774+
walk_state->thread->current_sync_level =
775+
method_desc->method.mutex->mutex.
776+
original_sync_level;
777+
778+
acpi_os_release_mutex(method_desc->method.
779+
mutex->mutex.os_mutex);
780+
method_desc->method.mutex->mutex.thread_id = 0;
781+
}
782+
}
789783
}
790784

791785
/* Decrement the thread count on the method */

drivers/acpi/acpica/dswload2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,9 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
607607
}
608608
}
609609

610-
acpi_ex_exit_interpreter();
611610
status =
612611
acpi_ev_initialize_region
613612
(acpi_ns_get_attached_object(node), FALSE);
614-
acpi_ex_enter_interpreter();
615613

616614
if (ACPI_FAILURE(status)) {
617615
/*

drivers/acpi/acpica/evrgnini.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "accommon.h"
4646
#include "acevents.h"
4747
#include "acnamesp.h"
48+
#include "acinterp.h"
4849

4950
#define _COMPONENT ACPI_EVENTS
5051
ACPI_MODULE_NAME("evrgnini")
@@ -597,9 +598,11 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
597598
}
598599
}
599600

601+
acpi_ex_exit_interpreter();
600602
status =
601603
acpi_ev_execute_reg_method(region_obj,
602604
ACPI_REG_CONNECT);
605+
acpi_ex_enter_interpreter();
603606

604607
if (acpi_ns_locked) {
605608
status =

drivers/acpi/acpica/nsload.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
137137
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
138138
"**** Begin Table Object Initialization\n"));
139139

140+
acpi_ex_enter_interpreter();
140141
status = acpi_ds_initialize_objects(table_index, node);
142+
acpi_ex_exit_interpreter();
141143

142144
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
143145
"**** Completed Table Object Initialization\n"));

drivers/acpi/apei/ghes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static int ghes_proc(struct ghes *ghes)
662662
ghes_do_proc(ghes, ghes->estatus);
663663
out:
664664
ghes_clear_estatus(ghes);
665-
return 0;
665+
return rc;
666666
}
667667

668668
static void ghes_add_timer(struct ghes *ghes)

drivers/acpi/pci_link.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct acpi_pci_link {
8787

8888
static LIST_HEAD(acpi_link_list);
8989
static DEFINE_MUTEX(acpi_link_lock);
90+
static int sci_irq = -1, sci_penalty;
9091

9192
/* --------------------------------------------------------------------------
9293
PCI Link Device Management
@@ -496,25 +497,13 @@ static int acpi_irq_get_penalty(int irq)
496497
{
497498
int penalty = 0;
498499

499-
/*
500-
* Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict
501-
* with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be
502-
* use for PCI IRQs.
503-
*/
504-
if (irq == acpi_gbl_FADT.sci_interrupt) {
505-
u32 type = irq_get_trigger_type(irq) & IRQ_TYPE_SENSE_MASK;
506-
507-
if (type != IRQ_TYPE_LEVEL_LOW)
508-
penalty += PIRQ_PENALTY_ISA_ALWAYS;
509-
else
510-
penalty += PIRQ_PENALTY_PCI_USING;
511-
}
500+
if (irq == sci_irq)
501+
penalty += sci_penalty;
512502

513503
if (irq < ACPI_MAX_ISA_IRQS)
514504
return penalty + acpi_isa_irq_penalty[irq];
515505

516-
penalty += acpi_irq_pci_sharing_penalty(irq);
517-
return penalty;
506+
return penalty + acpi_irq_pci_sharing_penalty(irq);
518507
}
519508

520509
int __init acpi_irq_penalty_init(void)
@@ -619,6 +608,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
619608
acpi_device_bid(link->device));
620609
return -ENODEV;
621610
} else {
611+
if (link->irq.active < ACPI_MAX_ISA_IRQS)
612+
acpi_isa_irq_penalty[link->irq.active] +=
613+
PIRQ_PENALTY_PCI_USING;
614+
622615
printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n",
623616
acpi_device_name(link->device),
624617
acpi_device_bid(link->device), link->irq.active);
@@ -849,7 +842,7 @@ static int __init acpi_irq_penalty_update(char *str, int used)
849842
continue;
850843

851844
if (used)
852-
new_penalty = acpi_irq_get_penalty(irq) +
845+
new_penalty = acpi_isa_irq_penalty[irq] +
853846
PIRQ_PENALTY_ISA_USED;
854847
else
855848
new_penalty = 0;
@@ -871,7 +864,7 @@ static int __init acpi_irq_penalty_update(char *str, int used)
871864
void acpi_penalize_isa_irq(int irq, int active)
872865
{
873866
if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty)))
874-
acpi_isa_irq_penalty[irq] = acpi_irq_get_penalty(irq) +
867+
acpi_isa_irq_penalty[irq] +=
875868
(active ? PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING);
876869
}
877870

@@ -881,6 +874,17 @@ bool acpi_isa_irq_available(int irq)
881874
acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS);
882875
}
883876

877+
void acpi_penalize_sci_irq(int irq, int trigger, int polarity)
878+
{
879+
sci_irq = irq;
880+
881+
if (trigger == ACPI_MADT_TRIGGER_LEVEL &&
882+
polarity == ACPI_MADT_POLARITY_ACTIVE_LOW)
883+
sci_penalty = PIRQ_PENALTY_PCI_USING;
884+
else
885+
sci_penalty = PIRQ_PENALTY_ISA_ALWAYS;
886+
}
887+
884888
/*
885889
* Over-ride default table to reserve additional IRQs for use by ISA
886890
* e.g. acpi_irq_isa=5

include/linux/acpi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ struct pci_dev;
326326
int acpi_pci_irq_enable (struct pci_dev *dev);
327327
void acpi_penalize_isa_irq(int irq, int active);
328328
bool acpi_isa_irq_available(int irq);
329+
void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
329330
void acpi_pci_irq_disable (struct pci_dev *dev);
330331

331332
extern int ec_read(u8 addr, u8 *val);

0 commit comments

Comments
 (0)