Skip to content

Commit 96ce7d6

Browse files
committed
Merge branch 'acpi-osl' into linux-next
* acpi-osl: ACPI: OSL: Poweroff when encountering a fatal ACPI error
2 parents 0953f6a + 6f09a70 commit 96ce7d6

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ Kernel parameters
189189
unusable. The "log_buf_len" parameter may be useful
190190
if you need to capture more output.
191191

192+
acpi.poweroff_on_fatal= [ACPI]
193+
{0 | 1}
194+
Causes the system to poweroff when the ACPI bytecode signals
195+
a fatal error. The default value of this setting is 1.
196+
Overriding this value should only be done for diagnosing
197+
ACPI firmware problems, as the system might behave erratically
198+
after having encountered a fatal ACPI error.
199+
192200
acpi_enforce_resources= [ACPI]
193201
{ strict | lax | no }
194202
Check for resource conflicts between native drivers

drivers/acpi/osl.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
#define pr_fmt(fmt) "ACPI: OSL: " fmt
1313

14+
#include <linux/kconfig.h>
1415
#include <linux/module.h>
1516
#include <linux/kernel.h>
17+
#include <linux/reboot.h>
1618
#include <linux/slab.h>
1719
#include <linux/mm.h>
1820
#include <linux/highmem.h>
@@ -70,6 +72,10 @@ static bool acpi_os_initialized;
7072
unsigned int acpi_sci_irq = INVALID_ACPI_IRQ;
7173
bool acpi_permanent_mmap = false;
7274

75+
static bool poweroff_on_fatal = true;
76+
module_param(poweroff_on_fatal, bool, 0);
77+
MODULE_PARM_DESC(poweroff_on_fatal, "Poweroff when encountering a fatal ACPI error");
78+
7379
/*
7480
* This list of permanent mappings is for memory that may be accessed from
7581
* interrupt context, where we can't do the ioremap().
@@ -1381,9 +1387,20 @@ acpi_status acpi_os_notify_command_complete(void)
13811387

13821388
acpi_status acpi_os_signal(u32 function, void *info)
13831389
{
1390+
struct acpi_signal_fatal_info *fatal_info;
1391+
13841392
switch (function) {
13851393
case ACPI_SIGNAL_FATAL:
1386-
pr_err("Fatal opcode executed\n");
1394+
fatal_info = info;
1395+
pr_emerg("Fatal error while evaluating ACPI control method\n");
1396+
pr_emerg("Type 0x%X Code 0x%X Argument 0x%X\n",
1397+
fatal_info->type, fatal_info->code, fatal_info->argument);
1398+
1399+
if (poweroff_on_fatal)
1400+
orderly_poweroff(true);
1401+
else
1402+
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
1403+
13871404
break;
13881405
case ACPI_SIGNAL_BREAKPOINT:
13891406
/*

0 commit comments

Comments
 (0)