diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-07-21 11:11:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-21 21:37:12 -0400 |
commit | 1c10070a55a38ad8489df8afd52c9a3ffd46bbb5 (patch) | |
tree | e4c1ab4e436fbc3345cb465c8c896153f6a33ff3 /arch/i386 | |
parent | 114ab8e99c52828b37c994f580e39ce341c17d3b (diff) |
i386: do not restore reserved memory after hibernation
On some systems the ACPI NVS area is located in the first 1 MB of RAM and
it is overwritten by the i386 code during the restore after hibernation.
This confuses the ACPI platform firmware that doesn't update the AC adapter
status appropriately as a result
(http://bugzilla.kernel.org/show_bug.cgi?id=7995).
The solution is to register the reserved memory in the first 1 MB as
'nosave', so that swsusp doesn't touch it during the restore. Also, this
has been done on x86_64 for a long time now, so this patch makes the i386
restore code behave like the x86_64 one.
[akpm@linux-foundation.org: build fix]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/e820.c | 32 | ||||
-rw-r--r-- | arch/i386/kernel/setup.c | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c index fc822a46897a..e60cddbc4cfb 100644 --- a/arch/i386/kernel/e820.c +++ b/arch/i386/kernel/e820.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/efi.h> | 10 | #include <linux/efi.h> |
11 | #include <linux/pfn.h> | 11 | #include <linux/pfn.h> |
12 | #include <linux/uaccess.h> | 12 | #include <linux/uaccess.h> |
13 | #include <linux/suspend.h> | ||
13 | 14 | ||
14 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
15 | #include <asm/page.h> | 16 | #include <asm/page.h> |
@@ -320,6 +321,37 @@ static int __init request_standard_resources(void) | |||
320 | 321 | ||
321 | subsys_initcall(request_standard_resources); | 322 | subsys_initcall(request_standard_resources); |
322 | 323 | ||
324 | #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) | ||
325 | /** | ||
326 | * e820_mark_nosave_regions - Find the ranges of physical addresses that do not | ||
327 | * correspond to e820 RAM areas and mark the corresponding pages as nosave for | ||
328 | * hibernation. | ||
329 | * | ||
330 | * This function requires the e820 map to be sorted and without any | ||
331 | * overlapping entries and assumes the first e820 area to be RAM. | ||
332 | */ | ||
333 | void __init e820_mark_nosave_regions(void) | ||
334 | { | ||
335 | int i; | ||
336 | unsigned long pfn; | ||
337 | |||
338 | pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size); | ||
339 | for (i = 1; i < e820.nr_map; i++) { | ||
340 | struct e820entry *ei = &e820.map[i]; | ||
341 | |||
342 | if (pfn < PFN_UP(ei->addr)) | ||
343 | register_nosave_region(pfn, PFN_UP(ei->addr)); | ||
344 | |||
345 | pfn = PFN_DOWN(ei->addr + ei->size); | ||
346 | if (ei->type != E820_RAM) | ||
347 | register_nosave_region(PFN_UP(ei->addr), pfn); | ||
348 | |||
349 | if (pfn >= max_low_pfn) | ||
350 | break; | ||
351 | } | ||
352 | } | ||
353 | #endif | ||
354 | |||
323 | void __init add_memory_region(unsigned long long start, | 355 | void __init add_memory_region(unsigned long long start, |
324 | unsigned long long size, int type) | 356 | unsigned long long size, int type) |
325 | { | 357 | { |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index ec4dfcc50cf7..2986b48a823f 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -640,6 +640,7 @@ void __init setup_arch(char **cmdline_p) | |||
640 | #endif | 640 | #endif |
641 | 641 | ||
642 | e820_register_memory(); | 642 | e820_register_memory(); |
643 | e820_mark_nosave_regions(); | ||
643 | 644 | ||
644 | #ifdef CONFIG_VT | 645 | #ifdef CONFIG_VT |
645 | #if defined(CONFIG_VGA_CONSOLE) | 646 | #if defined(CONFIG_VGA_CONSOLE) |