swsusp: Support i386 systems with PAE or without PSE
Subsystems (2)
PATCH 1/1 swsusp: Support i386 systems with PAE or without PSE
Make swsusp support i386 systems with PAE or without PSE.
This is done by creating temporary page tables located in resume-safe page frames before the suspend image is restored in the same way as x86_64 does it.
Signed-off-by Rafael J. Wysocki <[email protected]>
--- arch/i386/power/Makefile | 2 arch/i386/power/suspend.c | 158 +++++++++++++++++++++++++++++++++++++++++++++ arch/i386/power/swsusp.S | 9 +- include/asm-i386/suspend.h | 13 --- kernel/power/Kconfig | 2 5 files changed, 168 insertions(+), 16 deletions(-)
arch/i386/power/swsusp.S +7 -2
@@ -28,8 +28,9 @@ ENTRY(swsusp_arch_suspend) call swsusp_save ret -ENTRY(swsusp_arch_resume) - movl $swsusp_pg_dir-__PAGE_OFFSET, %ecx +ENTRY(restore_image) + movl resume_pg_dir, %ecx + subl $__PAGE_OFFSET, %ecx movl %ecx, %cr3 movl restore_pblist, %edx
@@ -51,6 +52,10 @@ copy_loop: .p2align 4,,7 done: + /* go back to the original page tables */ + movl $swapper_pg_dir, %ecx + subl $__PAGE_OFFSET, %ecx + movl %ecx, %cr3 /* Flush TLB, including "global" things (vmalloc) */ movl mmu_cr4_features, %eax movl %eax, %edx
arch/i386/power/suspend.c new file +158 -0
158 lines not on this page · raw message
arch/i386/power/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_PM) += cpu.o -obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o +obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o suspend.o
kernel/power/Kconfig +1 -1
@@ -78,7 +78,7 @@ config PM_SYSFS_DEPRECATED config SOFTWARE_SUSPEND bool "Software Suspend" - depends on PM && SWAP && ((X86 && (!SMP || SUSPEND_SMP) && !X86_PAE) || ((FRV || PPC32) && !SMP)) + depends on PM && SWAP && ((X86 && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP)) ---help--- Enable the possibility of suspending the machine. It doesn't need ACPI or APM.
include/asm-i386/suspend.h +1 -12
@@ -6,18 +6,7 @@#include <asm/desc.h> #include <asm/i387.h> -static inline int -arch_prepare_suspend (void ) -{ -/* If you want to make non-PSE machine work, turn off paging -in swsusp_arch_suspend. swsusp_pg_dir should have identity mapping, so -it could work... */ -if (!cpu_has_pse) { -printk (KERN_ERR "PSE is required for swsusp.\n" ); -return -EPERM ; - } -return 0 ; -} +static inline int arch_prepare_suspend (void ) {return 0 ; }/* image of the saved processor state */ struct saved_context {
Quoted 7 lines · Rafael J. Wysocki
Make swsusp support i386 systems with PAE or without PSE.
This is done by creating temporary page tables located in resume-safe page frames before the suspend image is restored in the same way as
x86_64does it.Signed-off-by Rafael J. Wysocki <[email protected]>
ACK (but still did not find time to test it).
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html