Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Ghorai, Sukumar <sukumar.ghorai@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
[ rjw: Edit comment in the code and subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Zhang Rui and committed by
Rafael J. Wysocki
9a488888 cf1d2b44

+11
+11
drivers/acpi/reboot.c
··· 3 3 #include <linux/pci.h> 4 4 #include <linux/acpi.h> 5 5 #include <acpi/reboot.h> 6 + #include <linux/delay.h> 6 7 7 8 #ifdef CONFIG_PCI 8 9 static void acpi_pci_reboot(struct acpi_generic_address *rr, u8 reset_value) ··· 67 66 acpi_reset(); 68 67 break; 69 68 } 69 + 70 + /* 71 + * Some platforms do not shut down immediately after writing to the 72 + * ACPI reset register, and this results in racing with the 73 + * subsequent reboot mechanism. 74 + * 75 + * The 15ms delay has been found to be long enough for the system 76 + * to reboot on the affected platforms. 77 + */ 78 + mdelay(15); 70 79 }