Commit 9a488888 authored by Zhang Rui's avatar Zhang Rui Committed by Rafael J. Wysocki

ACPI: reboot: Avoid racing after writing to ACPI RESET_REG

According to the ACPI spec, "The system must reset immediately following
the write to the ACPI RESET_REG register.", but there are cases that the
system does not follow this and results in racing with the subsequetial
reboot mechanism, which brings unexpected behavior.

Fix this by adding a 15ms delay after writing to the ACPI RESET_REG.
Reported-by: default avatarGhorai, Sukumar <sukumar.ghorai@intel.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
[ rjw: Edit comment in the code and subject ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent cf1d2b44
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <acpi/reboot.h> #include <acpi/reboot.h>
#include <linux/delay.h>
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static void acpi_pci_reboot(struct acpi_generic_address *rr, u8 reset_value) static void acpi_pci_reboot(struct acpi_generic_address *rr, u8 reset_value)
...@@ -66,4 +67,14 @@ void acpi_reboot(void) ...@@ -66,4 +67,14 @@ void acpi_reboot(void)
acpi_reset(); acpi_reset();
break; break;
} }
/*
* Some platforms do not shut down immediately after writing to the
* ACPI reset register, and this results in racing with the
* subsequent reboot mechanism.
*
* The 15ms delay has been found to be long enough for the system
* to reboot on the affected platforms.
*/
mdelay(15);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment