Skip to contentSkip to conversation

ppc suspend rewrite using inline.

PATCH Hugang 2 participants 2 messages Feb 18, 2004

Subsystems (2)
lore
Share & tools
lore

Hugang

author
#0 lore raw

Hi Ben:

I has finished rewriten the suspend code by inline, The swsusp2 works fine without any problem, But pmdisk can't works, The problem that's, when resume the current is not same as suspend.

I think the code can reuse by sleep.

I think turn off mmu copyback page is important, but I has looked x86 resume code, it do not.

Please take a look.

thanks.

Signature · 3 lines
Hu Gang / Steve
Linux Registered User 204016
GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc
arch/ppc/kernel/signal.c +10 -0
@@ -28,6 +28,7 @@
 #include <linux/elf.h>
 #include <linux/tty.h>
 #include <linux/binfmts.h>
+#include <linux/suspend.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -564,6 +565,14 @@
 	unsigned long frame, newsp;
 	int signr, ret;
 
+	if (current->flags & PF_FREEZE) {
+		refrigerator(PF_FREEZE);
+		signr = 0;
+		ret = regs->gpr[3];
+		if (!signal_pending(current))
+			goto no_signal;
+	}
+
 	if (!oldset)
 		oldset = &current->blocked;
 
@@ -588,6 +597,7 @@
 			regs->gpr[3] = EINTR;
 			/* note that the cr0.SO bit is already set */
 		} else {
+no_signal:
 			regs->nip -= 4;	/* Back up & retry system call */
 			regs->result = 0;
 			regs->trap = 0;
arch/ppc/kernel/vmlinux.lds.S +6 -0
@@ -72,6 +72,12 @@
     CONSTRUCTORS
   }
 
+  . = ALIGN(4096);
+  __nosave_begin = .;
+  .data_nosave : { *(.data.nosave) }
+  . = ALIGN(4096);
+  __nosave_end = .;
+
   . = ALIGN(32);
   .data.cacheline_aligned : { *(.data.cacheline_aligned) }
 
arch/ppc/Kconfig +2 -0
@@ -193,6 +193,8 @@
 
 	  If in doubt, say Y here.
 
+source kernel/power/Kconfig
+
 source arch/ppc/platforms/4xx/Kconfig
 
 config PPC64BRIDGE
arch/ppc/Makefile +1 -0
@@ -40,6 +40,7 @@
 core-$(CONFIG_MATH_EMULATION)	+= arch/ppc/math-emu/
 core-$(CONFIG_XMON)		+= arch/ppc/xmon/
 core-$(CONFIG_APUS)		+= arch/ppc/amiga/
+core-$(CONFIG_PM)       += arch/ppc/power/
 drivers-$(CONFIG_8xx)		+= arch/ppc/8xx_io/
 drivers-$(CONFIG_4xx)		+= arch/ppc/4xx_io/
 drivers-$(CONFIG_8260)		+= arch/ppc/8260_io/
include/linux/suspend.h +0 -2
@@ -1,9 +1,7 @@
 #ifndef _LINUX_SWSUSP_H
 #define _LINUX_SWSUSP_H
 
-#ifdef CONFIG_X86
 #include <asm/suspend.h>
-#endif
 #include <linux/swap.h>
 #include <linux/notifier.h>
 #include <linux/config.h>
arch/ppc/power/Makefile new file +1 -0
@@ -0,0 +1 @@
+obj-$(CONFIG_PM_DISK) += pmdisk.o cpu.o #cpu_data.o
arch/ppc/power/cpu.c new file +81 -0

81 lines not on this page · raw message

arch/ppc/power/pmdisk.c new file +75 -0

75 lines not on this page · raw message

include/asm-ppc/suspend.h new file +236 -0

236 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · Hugang

Hi Ben:

I has finished rewriten the suspend code by inline, The swsusp2 works fine without any problem, But pmdisk can't works, The problem that's, when resume the current is not same as suspend.

I don't understand why you write. Looking at your code, I don't see the point. By mixing C and assembly the way you do, and using those horrible inline asm constructs, you are basically making the code worse, less readable, and prone for bugs. I don't think you should even try going into that direction, it makes no sense.

Quoted 1 line

I think the code can reuse by sleep.

Same

Quoted 2 lines

I think turn off mmu copyback page is important, but I has looked x86 resume code, it do not.

Same

Quoted 1 line

Please take a look.

Please try to be clear.

Quoted 1 line

thanks.