Commit 72ad5d77fb981963edae15eee8196c80238f5ed0

Authored by Rafael J. Wysocki
Committed by Len Brown
1 parent b37fa16e78

ACPI / Sleep: Allow the NVS saving to be skipped during suspend to RAM

Commit 2a6b69765ad794389f2fc3e14a0afa1a995221c2
(ACPI: Store NVS state even when entering suspend to RAM) caused the
ACPI suspend code save the NVS area during suspend and restore it
during resume unconditionally, although it is known that some systems
need to use acpi_sleep=s4_nonvs for hibernation to work.  To allow
the affected systems to avoid saving and restoring the NVS area
during suspend to RAM and resume, introduce kernel command line
option acpi_sleep=nonvs and make acpi_sleep=s4_nonvs work as its
alias temporarily (add acpi_sleep=s4_nonvs to the feature removal
file).

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16396 .

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-and-tested-by: tomas m <tmezzadra@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>

Showing 5 changed files with 34 additions and 23 deletions Side-by-side Diff

Documentation/feature-removal-schedule.txt
... ... @@ -646,4 +646,12 @@
646 646 Who: Stefan Richter <stefanr@s5r6.in-berlin.de>
647 647  
648 648 ----------------------------
  649 +
  650 +What: The acpi_sleep=s4_nonvs command line option
  651 +When: 2.6.37
  652 +Files: arch/x86/kernel/acpi/sleep.c
  653 +Why: superseded by acpi_sleep=nonvs
  654 +Who: Rafael J. Wysocki <rjw@sisk.pl>
  655 +
  656 +----------------------------
Documentation/kernel-parameters.txt
... ... @@ -254,8 +254,8 @@
254 254 control method, with respect to putting devices into
255 255 low power states, to be enforced (the ACPI 2.0 ordering
256 256 of _PTS is used by default).
257   - s4_nonvs prevents the kernel from saving/restoring the
258   - ACPI NVS memory during hibernation.
  257 + nonvs prevents the kernel from saving/restoring the
  258 + ACPI NVS memory during suspend/hibernation and resume.
259 259 sci_force_enable causes the kernel to set SCI_EN directly
260 260 on resume from S1/S3 (which is against the ACPI spec,
261 261 but some broken systems don't work without it).
arch/x86/kernel/acpi/sleep.c
... ... @@ -157,9 +157,14 @@
157 157 #ifdef CONFIG_HIBERNATION
158 158 if (strncmp(str, "s4_nohwsig", 10) == 0)
159 159 acpi_no_s4_hw_signature();
160   - if (strncmp(str, "s4_nonvs", 8) == 0)
161   - acpi_s4_no_nvs();
  160 + if (strncmp(str, "s4_nonvs", 8) == 0) {
  161 + pr_warning("ACPI: acpi_sleep=s4_nonvs is deprecated, "
  162 + "please use acpi_sleep=nonvs instead");
  163 + acpi_nvs_nosave();
  164 + }
162 165 #endif
  166 + if (strncmp(str, "nonvs", 5) == 0)
  167 + acpi_nvs_nosave();
163 168 if (strncmp(str, "old_ordering", 12) == 0)
164 169 acpi_old_suspend_ordering();
165 170 str = strchr(str, ',');
drivers/acpi/sleep.c
... ... @@ -82,6 +82,20 @@
82 82 static u32 acpi_target_sleep_state = ACPI_STATE_S0;
83 83  
84 84 /*
  85 + * The ACPI specification wants us to save NVS memory regions during hibernation
  86 + * and to restore them during the subsequent resume. Windows does that also for
  87 + * suspend to RAM. However, it is known that this mechanism does not work on
  88 + * all machines, so we allow the user to disable it with the help of the
  89 + * 'acpi_sleep=nonvs' kernel command line option.
  90 + */
  91 +static bool nvs_nosave;
  92 +
  93 +void __init acpi_nvs_nosave(void)
  94 +{
  95 + nvs_nosave = true;
  96 +}
  97 +
  98 +/*
85 99 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
86 100 * user to request that behavior by using the 'acpi_old_suspend_ordering'
87 101 * kernel command line option that causes the following variable to be set.
... ... @@ -197,8 +211,7 @@
197 211 u32 acpi_state = acpi_suspend_states[pm_state];
198 212 int error = 0;
199 213  
200   - error = suspend_nvs_alloc();
201   -
  214 + error = nvs_nosave ? 0 : suspend_nvs_alloc();
202 215 if (error)
203 216 return error;
204 217  
... ... @@ -388,20 +401,6 @@
388 401 #endif /* CONFIG_SUSPEND */
389 402  
390 403 #ifdef CONFIG_HIBERNATION
391   -/*
392   - * The ACPI specification wants us to save NVS memory regions during hibernation
393   - * and to restore them during the subsequent resume. However, it is not certain
394   - * if this mechanism is going to work on all machines, so we allow the user to
395   - * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
396   - * option.
397   - */
398   -static bool s4_no_nvs;
399   -
400   -void __init acpi_s4_no_nvs(void)
401   -{
402   - s4_no_nvs = true;
403   -}
404   -
405 404 static unsigned long s4_hardware_signature;
406 405 static struct acpi_table_facs *facs;
407 406 static bool nosigcheck;
... ... @@ -415,7 +414,7 @@
415 414 {
416 415 int error;
417 416  
418   - error = s4_no_nvs ? 0 : suspend_nvs_alloc();
  417 + error = nvs_nosave ? 0 : suspend_nvs_alloc();
419 418 if (!error) {
420 419 acpi_target_sleep_state = ACPI_STATE_S4;
421 420 acpi_sleep_tts_switch(acpi_target_sleep_state);
... ... @@ -510,7 +509,7 @@
510 509 error = acpi_sleep_prepare(ACPI_STATE_S4);
511 510  
512 511 if (!error) {
513   - if (!s4_no_nvs)
  512 + if (!nvs_nosave)
514 513 error = suspend_nvs_alloc();
515 514 if (!error)
516 515 acpi_target_sleep_state = ACPI_STATE_S4;
include/linux/acpi.h
... ... @@ -253,7 +253,7 @@
253 253 #ifdef CONFIG_PM_SLEEP
254 254 void __init acpi_no_s4_hw_signature(void);
255 255 void __init acpi_old_suspend_ordering(void);
256   -void __init acpi_s4_no_nvs(void);
  256 +void __init acpi_nvs_nosave(void);
257 257 #endif /* CONFIG_PM_SLEEP */
258 258  
259 259 struct acpi_osc_context {