ACPI: Fix bug when ACPI reset register is implemented in system memory
authorRandy Wright <rwright@hp.com>
Wed, 4 Jun 2014 15:55:59 +0000 (08:55 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 5 Jun 2014 12:36:40 +0000 (14:36 +0200)
Use acpi_os_map_generic_address to pre-map the reset register if it is
memory mapped, thereby preventing the BUG_ON() in line 1319 of
mm/vmalloc.c from triggering during panic-triggered reboots.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=77131
Signed-off-by: Randy Wright <rwright@hp.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
[rjw: Changelog, simplified code]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/osl.c

index 6776c599816f33100a2403ae7286e534f0a96354..88cddf84d245dd2a9154b3f92761e99fa3e63c26 100644 (file)
@@ -1798,6 +1798,16 @@ acpi_status __init acpi_os_initialize(void)
        acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1b_event_block);
        acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe0_block);
        acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe1_block);
+       if (acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) {
+               /*
+                * Use acpi_os_map_generic_address to pre-map the reset
+                * register if it's in system memory.
+                */
+               int rv;
+
+               rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register);
+               pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv);
+       }
 
        return AE_OK;
 }
@@ -1826,6 +1836,8 @@ acpi_status acpi_os_terminate(void)
        acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe0_block);
        acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1b_event_block);
        acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1a_event_block);
+       if (acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)
+               acpi_os_unmap_generic_address(&acpi_gbl_FADT.reset_register);
 
        destroy_workqueue(kacpid_wq);
        destroy_workqueue(kacpi_notify_wq);