Skip to content

Commit 0c81e26

Browse files
committed
Merge branches 'acpi-x86', 'acpi-apei' and 'acpi-ec'
* acpi-x86: ACPI / x86: boot: Propagate error code in acpi_gsi_to_irq() ACPI / x86: boot: Don't setup SCI on HW-reduced platforms ACPI / x86: boot: Use INVALID_ACPI_IRQ instead of 0 for acpi_sci_override_gsi ACPI / x86: boot: Get rid of ACPI_INVALID_GSI ACPI / x86: boot: Swap variables in condition in acpi_register_gsi_ioapic() * acpi-apei: ACPI / APEI: remove redundant variables len and node_len ACPI: APEI: call into AER handling regardless of severity ACPI: APEI: handle PCIe AER errors in separate function * acpi-ec: ACPI: EC: Fix debugfs_create_*() usage
4 parents 13c35c8 + a89bca2 + fd08619 + 3522f86 commit 0c81e26

File tree

6 files changed

+67
-55
lines changed

6 files changed

+67
-55
lines changed

arch/x86/include/asm/acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extern int acpi_fix_pin2_polarity;
4949
extern int acpi_disable_cmcff;
5050

5151
extern u8 acpi_sci_flags;
52-
extern int acpi_sci_override_gsi;
52+
extern u32 acpi_sci_override_gsi;
5353
void acpi_pic_sci_set_trigger(unsigned int, u16);
5454

5555
struct device;

arch/x86/kernel/acpi/boot.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ int acpi_ioapic;
6868
int acpi_strict;
6969
int acpi_disable_cmcff;
7070

71+
/* ACPI SCI override configuration */
7172
u8 acpi_sci_flags __initdata;
72-
int acpi_sci_override_gsi __initdata;
73+
u32 acpi_sci_override_gsi __initdata = INVALID_ACPI_IRQ;
7374
int acpi_skip_timer_override __initdata;
7475
int acpi_use_timer_override __initdata;
7576
int acpi_fix_pin2_polarity __initdata;
@@ -112,8 +113,6 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = {
112113
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
113114
};
114115

115-
#define ACPI_INVALID_GSI INT_MIN
116-
117116
/*
118117
* This is just a simple wrapper around early_memremap(),
119118
* with sanity checks for phys == 0 and size == 0.
@@ -372,7 +371,7 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
372371
* and acpi_isa_irq_to_gsi() may give wrong result.
373372
*/
374373
if (gsi < nr_legacy_irqs() && isa_irq_to_gsi[gsi] == gsi)
375-
isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI;
374+
isa_irq_to_gsi[gsi] = INVALID_ACPI_IRQ;
376375
isa_irq_to_gsi[bus_irq] = gsi;
377376
}
378377

@@ -620,24 +619,24 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
620619
}
621620

622621
rc = acpi_get_override_irq(gsi, &trigger, &polarity);
623-
if (rc == 0) {
624-
trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
625-
polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
626-
irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
627-
if (irq >= 0) {
628-
*irqp = irq;
629-
return 0;
630-
}
631-
}
622+
if (rc)
623+
return rc;
632624

633-
return -1;
625+
trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
626+
polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
627+
irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
628+
if (irq < 0)
629+
return irq;
630+
631+
*irqp = irq;
632+
return 0;
634633
}
635634
EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
636635

637636
int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
638637
{
639638
if (isa_irq < nr_legacy_irqs() &&
640-
isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) {
639+
isa_irq_to_gsi[isa_irq] != INVALID_ACPI_IRQ) {
641640
*gsi = isa_irq_to_gsi[isa_irq];
642641
return 0;
643642
}
@@ -676,8 +675,7 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
676675
mutex_lock(&acpi_ioapic_lock);
677676
irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
678677
/* Don't set up the ACPI SCI because it's already set up */
679-
if (irq >= 0 && enable_update_mptable &&
680-
acpi_gbl_FADT.sci_interrupt != gsi)
678+
if (irq >= 0 && enable_update_mptable && gsi != acpi_gbl_FADT.sci_interrupt)
681679
mp_config_acpi_gsi(dev, gsi, trigger, polarity);
682680
mutex_unlock(&acpi_ioapic_lock);
683681
#endif
@@ -1211,8 +1209,9 @@ static int __init acpi_parse_madt_ioapic_entries(void)
12111209
/*
12121210
* If BIOS did not supply an INT_SRC_OVR for the SCI
12131211
* pretend we got one so we can set the SCI flags.
1212+
* But ignore setting up SCI on hardware reduced platforms.
12141213
*/
1215-
if (!acpi_sci_override_gsi)
1214+
if (acpi_sci_override_gsi == INVALID_ACPI_IRQ && !acpi_gbl_reduced_hardware)
12161215
acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0,
12171216
acpi_gbl_FADT.sci_interrupt);
12181217

drivers/acpi/apei/ghes.c

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,51 @@ static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int
414414
#endif
415415
}
416416

417+
/*
418+
* PCIe AER errors need to be sent to the AER driver for reporting and
419+
* recovery. The GHES severities map to the following AER severities and
420+
* require the following handling:
421+
*
422+
* GHES_SEV_CORRECTABLE -> AER_CORRECTABLE
423+
* These need to be reported by the AER driver but no recovery is
424+
* necessary.
425+
* GHES_SEV_RECOVERABLE -> AER_NONFATAL
426+
* GHES_SEV_RECOVERABLE && CPER_SEC_RESET -> AER_FATAL
427+
* These both need to be reported and recovered from by the AER driver.
428+
* GHES_SEV_PANIC does not make it to this handling since the kernel must
429+
* panic.
430+
*/
431+
static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
432+
{
433+
#ifdef CONFIG_ACPI_APEI_PCIEAER
434+
struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata);
435+
436+
if (pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
437+
pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
438+
unsigned int devfn;
439+
int aer_severity;
440+
441+
devfn = PCI_DEVFN(pcie_err->device_id.device,
442+
pcie_err->device_id.function);
443+
aer_severity = cper_severity_to_aer(gdata->error_severity);
444+
445+
/*
446+
* If firmware reset the component to contain
447+
* the error, we must reinitialize it before
448+
* use, so treat it as a fatal AER error.
449+
*/
450+
if (gdata->flags & CPER_SEC_RESET)
451+
aer_severity = AER_FATAL;
452+
453+
aer_recover_queue(pcie_err->device_id.segment,
454+
pcie_err->device_id.bus,
455+
devfn, aer_severity,
456+
(struct aer_capability_regs *)
457+
pcie_err->aer_info);
458+
}
459+
#endif
460+
}
461+
417462
static void ghes_do_proc(struct ghes *ghes,
418463
const struct acpi_hest_generic_status *estatus)
419464
{
@@ -441,38 +486,9 @@ static void ghes_do_proc(struct ghes *ghes,
441486
arch_apei_report_mem_error(sev, mem_err);
442487
ghes_handle_memory_failure(gdata, sev);
443488
}
444-
#ifdef CONFIG_ACPI_APEI_PCIEAER
445489
else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
446-
struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata);
447-
448-
if (sev == GHES_SEV_RECOVERABLE &&
449-
sec_sev == GHES_SEV_RECOVERABLE &&
450-
pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
451-
pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
452-
unsigned int devfn;
453-
int aer_severity;
454-
455-
devfn = PCI_DEVFN(pcie_err->device_id.device,
456-
pcie_err->device_id.function);
457-
aer_severity = cper_severity_to_aer(gdata->error_severity);
458-
459-
/*
460-
* If firmware reset the component to contain
461-
* the error, we must reinitialize it before
462-
* use, so treat it as a fatal AER error.
463-
*/
464-
if (gdata->flags & CPER_SEC_RESET)
465-
aer_severity = AER_FATAL;
466-
467-
aer_recover_queue(pcie_err->device_id.segment,
468-
pcie_err->device_id.bus,
469-
devfn, aer_severity,
470-
(struct aer_capability_regs *)
471-
pcie_err->aer_info);
472-
}
473-
490+
ghes_handle_aer(gdata);
474491
}
475-
#endif
476492
else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) {
477493
struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata);
478494

@@ -870,7 +886,6 @@ static void ghes_print_queued_estatus(void)
870886
struct ghes_estatus_node *estatus_node;
871887
struct acpi_hest_generic *generic;
872888
struct acpi_hest_generic_status *estatus;
873-
u32 len, node_len;
874889

875890
llnode = llist_del_all(&ghes_estatus_llist);
876891
/*
@@ -882,8 +897,6 @@ static void ghes_print_queued_estatus(void)
882897
estatus_node = llist_entry(llnode, struct ghes_estatus_node,
883898
llnode);
884899
estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
885-
len = cper_estatus_len(estatus);
886-
node_len = GHES_ESTATUS_NODE_LEN(len);
887900
generic = estatus_node->generic;
888901
ghes_print_estatus(NULL, generic, estatus);
889902
llnode = llnode->next;

drivers/acpi/ec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ static int acpi_ec_setup(struct acpi_ec *ec, bool handle_events)
15161516
}
15171517

15181518
acpi_handle_info(ec->handle,
1519-
"GPE=0x%lx, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n",
1519+
"GPE=0x%x, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n",
15201520
ec->gpe, ec->command_addr, ec->data_addr);
15211521
return ret;
15221522
}

drivers/acpi/ec_sys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
128128
return -ENOMEM;
129129
}
130130

131-
if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe))
131+
if (!debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe))
132132
goto error;
133133
if (!debugfs_create_bool("use_global_lock", 0444, dev_dir,
134134
&first_ec->global_lock))

drivers/acpi/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static inline void acpi_early_processor_osc(void) {}
159159
-------------------------------------------------------------------------- */
160160
struct acpi_ec {
161161
acpi_handle handle;
162-
unsigned long gpe;
162+
u32 gpe;
163163
unsigned long command_addr;
164164
unsigned long data_addr;
165165
bool global_lock;

0 commit comments

Comments
 (0)