Skip to contentSkip to conversation

experimental G5 powermac suspend implementation

RFC In review Johannes Berg 4 participants 24 messages Dec 11, 2006 – Jan 24, 2007

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover experimental G5 powermac suspend implementation

This is a rather hacky suspend implementation for G5s.

I'm only posting it for the fun of it and because it makes no sense to continue sitting on it (I've had parts of this code more than half a year ago...)

Don't blame me if it breaks your machine, filesystems or similar :)

johannes

#1 lore raw

RFC 1/3 support powermac G5 CPU hotplug

This patch allows "hotplugging" of CPUs on G5 machines. CPUs that are disabled are put into an idle loop with interrupts hard-disabled, to wake them up again we kick them just like when bringing them up.

Maybe there's some way to actually turn off those CPUs even more?

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/platforms/powermac/smp.c +10 -2
@@ -898,7 +898,7 @@ void smp_core99_cpu_die(unsigned int cpu
 	cpu_dead[cpu] = 0;
 }
 
-#endif
+#endif /* CONFIG_HOTPLUG_CPU && CONFIG_PP32 */
 
 /* Core99 Macs (dual G4s and G5s) */
 struct smp_ops_t core99_smp_ops = {
@@ -908,8 +908,16 @@ struct smp_ops_t core99_smp_ops = {
 	.setup_cpu	= smp_core99_setup_cpu,
 	.give_timebase	= smp_core99_give_timebase,
 	.take_timebase	= smp_core99_take_timebase,
-#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32)
+#if defined(CONFIG_HOTPLUG_CPU)
+# if defined(CONFIG_PPC32)
 	.cpu_disable	= smp_core99_cpu_disable,
 	.cpu_die	= smp_core99_cpu_die,
+# endif
+# if defined(CONFIG_PPC64)
+	.cpu_disable	= generic_cpu_disable,
+	.cpu_die	= generic_cpu_die,
+	/* intentionally do *NOT* assign cpu_enable,
+	 * the generic code will use kick_cpu then! */
+# endif
 #endif
 };
arch/powerpc/platforms/powermac/setup.c +30 -1
@@ -490,6 +490,9 @@ static int pmac_late_init(void)
 #ifdef CONFIG_SOFTWARE_SUSPEND
 	pm_set_ops(&pmac_pm_ops);
 #endif /* CONFIG_SOFTWARE_SUSPEND */
+	/* this is udbg (which is __init) and we can later use it during
+	 * cpu hotplug (in smp_core99_kick_cpu) */
+	ppc_md.progress = NULL;
 	return 0;
 }
 
@@ -716,6 +719,32 @@ static int pmac_pci_probe_mode(struct pc
 		return PCI_PROBE_NORMAL;
 	return PCI_PROBE_DEVTREE;
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+/* access per cpu vars from generic smp.c */
+DECLARE_PER_CPU(int, cpu_state);
+
+static void pmac_cpu_die(void)
+{
+	/* turn off as much as possible, we'll be
+	 * kicked out as this will only be invoked
+	 * on core99 platforms for now ... */
+	hard_irq_disable();
+	printk(KERN_DEBUG "CPU#%d offline\n", smp_processor_id());
+	__get_cpu_var(cpu_state) = CPU_DEAD;
+	smp_wmb();
+	while (1) {
+		ppc64_runlatch_off();
+		if (ppc_md.power_save) {
+			ppc_md.power_save();
+		} else {
+			HMT_low();
+			HMT_very_low();
+		}
+	}
+}
+#endif
+
 #endif
 
 define_machine(powermac) {
@@ -754,6 +783,6 @@ define_machine(powermac) {
 	.phys_mem_access_prot	= pci_phys_mem_access_prot,
 #endif
 #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
-	.cpu_die		= generic_mach_cpu_die,
+	.cpu_die		= pmac_cpu_die,
 #endif
 };
arch/powerpc/kernel/smp.c +3 -0
@@ -558,6 +558,9 @@ int __devinit start_secondary(void *unus
 
 	local_irq_enable();
 
+	/* who knows what context the processor might have died in... */
+	task_thread_info(paca[cpu].__current)->preempt_count = 0;
+
 	cpu_idle();
 	return 0;
 }

--

#2 lore raw

RFC 1/3 support powermac G5 CPU hotplug

In reply to Johannes Berg

This patch allows "hotplugging" of CPUs on G5 machines. CPUs that are disabled are put into an idle loop with interrupts hard-disabled, to wake them up again we kick them just like when bringing them up.

Maybe there's some way to actually turn off those CPUs even more?

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/platforms/powermac/smp.c +10 -2
@@ -898,7 +898,7 @@ void smp_core99_cpu_die(unsigned int cpu
 	cpu_dead[cpu] = 0;
 }
 
-#endif
+#endif /* CONFIG_HOTPLUG_CPU && CONFIG_PP32 */
 
 /* Core99 Macs (dual G4s and G5s) */
 struct smp_ops_t core99_smp_ops = {
@@ -908,8 +908,16 @@ struct smp_ops_t core99_smp_ops = {
 	.setup_cpu	= smp_core99_setup_cpu,
 	.give_timebase	= smp_core99_give_timebase,
 	.take_timebase	= smp_core99_take_timebase,
-#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32)
+#if defined(CONFIG_HOTPLUG_CPU)
+# if defined(CONFIG_PPC32)
 	.cpu_disable	= smp_core99_cpu_disable,
 	.cpu_die	= smp_core99_cpu_die,
+# endif
+# if defined(CONFIG_PPC64)
+	.cpu_disable	= generic_cpu_disable,
+	.cpu_die	= generic_cpu_die,
+	/* intentionally do *NOT* assign cpu_enable,
+	 * the generic code will use kick_cpu then! */
+# endif
 #endif
 };
arch/powerpc/platforms/powermac/setup.c +30 -1
@@ -490,6 +490,9 @@ static int pmac_late_init(void)
 #ifdef CONFIG_SOFTWARE_SUSPEND
 	pm_set_ops(&pmac_pm_ops);
 #endif /* CONFIG_SOFTWARE_SUSPEND */
+	/* this is udbg (which is __init) and we can later use it during
+	 * cpu hotplug (in smp_core99_kick_cpu) */
+	ppc_md.progress = NULL;
 	return 0;
 }
 
@@ -716,6 +719,32 @@ static int pmac_pci_probe_mode(struct pc
 		return PCI_PROBE_NORMAL;
 	return PCI_PROBE_DEVTREE;
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+/* access per cpu vars from generic smp.c */
+DECLARE_PER_CPU(int, cpu_state);
+
+static void pmac_cpu_die(void)
+{
+	/* turn off as much as possible, we'll be
+	 * kicked out as this will only be invoked
+	 * on core99 platforms for now ... */
+	hard_irq_disable();
+	printk(KERN_DEBUG "CPU#%d offline\n", smp_processor_id());
+	__get_cpu_var(cpu_state) = CPU_DEAD;
+	smp_wmb();
+	while (1) {
+		ppc64_runlatch_off();
+		if (ppc_md.power_save) {
+			ppc_md.power_save();
+		} else {
+			HMT_low();
+			HMT_very_low();
+		}
+	}
+}
+#endif
+
 #endif
 
 define_machine(powermac) {
@@ -754,6 +783,6 @@ define_machine(powermac) {
 	.phys_mem_access_prot	= pci_phys_mem_access_prot,
 #endif
 #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
-	.cpu_die		= generic_mach_cpu_die,
+	.cpu_die		= pmac_cpu_die,
 #endif
 };
arch/powerpc/kernel/smp.c +3 -0
@@ -558,6 +558,9 @@ int __devinit start_secondary(void *unus
 
 	local_irq_enable();
 
+	/* who knows what context the processor might have died in... */
+	task_thread_info(paca[cpu].__current)->preempt_count = 0;
+
 	cpu_idle();
 	return 0;
 }

--

#3 lore raw

RFC 1/3 support powermac G5 CPU hotplug

In reply to Johannes Berg

This patch allows "hotplugging" of CPUs on G5 machines. CPUs that are disabled are put into an idle loop with interrupts hard-disabled, to wake them up again we kick them just like when bringing them up.

Maybe there's some way to actually turn off those CPUs even more?

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/platforms/powermac/smp.c +10 -2
@@ -898,7 +898,7 @@ void smp_core99_cpu_die(unsigned int cpu
 	cpu_dead[cpu] = 0;
 }
 
-#endif
+#endif /* CONFIG_HOTPLUG_CPU && CONFIG_PP32 */
 
 /* Core99 Macs (dual G4s and G5s) */
 struct smp_ops_t core99_smp_ops = {
@@ -908,8 +908,16 @@ struct smp_ops_t core99_smp_ops = {
 	.setup_cpu	= smp_core99_setup_cpu,
 	.give_timebase	= smp_core99_give_timebase,
 	.take_timebase	= smp_core99_take_timebase,
-#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32)
+#if defined(CONFIG_HOTPLUG_CPU)
+# if defined(CONFIG_PPC32)
 	.cpu_disable	= smp_core99_cpu_disable,
 	.cpu_die	= smp_core99_cpu_die,
+# endif
+# if defined(CONFIG_PPC64)
+	.cpu_disable	= generic_cpu_disable,
+	.cpu_die	= generic_cpu_die,
+	/* intentionally do *NOT* assign cpu_enable,
+	 * the generic code will use kick_cpu then! */
+# endif
 #endif
 };
arch/powerpc/platforms/powermac/setup.c +30 -1
@@ -490,6 +490,9 @@ static int pmac_late_init(void)
 #ifdef CONFIG_SOFTWARE_SUSPEND
 	pm_set_ops(&pmac_pm_ops);
 #endif /* CONFIG_SOFTWARE_SUSPEND */
+	/* this is udbg (which is __init) and we can later use it during
+	 * cpu hotplug (in smp_core99_kick_cpu) */
+	ppc_md.progress = NULL;
 	return 0;
 }
 
@@ -716,6 +719,32 @@ static int pmac_pci_probe_mode(struct pc
 		return PCI_PROBE_NORMAL;
 	return PCI_PROBE_DEVTREE;
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+/* access per cpu vars from generic smp.c */
+DECLARE_PER_CPU(int, cpu_state);
+
+static void pmac_cpu_die(void)
+{
+	/* turn off as much as possible, we'll be
+	 * kicked out as this will only be invoked
+	 * on core99 platforms for now ... */
+	hard_irq_disable();
+	printk(KERN_DEBUG "CPU#%d offline\n", smp_processor_id());
+	__get_cpu_var(cpu_state) = CPU_DEAD;
+	smp_wmb();
+	while (1) {
+		ppc64_runlatch_off();
+		if (ppc_md.power_save) {
+			ppc_md.power_save();
+		} else {
+			HMT_low();
+			HMT_very_low();
+		}
+	}
+}
+#endif
+
 #endif
 
 define_machine(powermac) {
@@ -754,6 +783,6 @@ define_machine(powermac) {
 	.phys_mem_access_prot	= pci_phys_mem_access_prot,
 #endif
 #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
-	.cpu_die		= generic_mach_cpu_die,
+	.cpu_die		= pmac_cpu_die,
 #endif
 };
arch/powerpc/kernel/smp.c +3 -0
@@ -558,6 +558,9 @@ int __devinit start_secondary(void *unus
 
 	local_irq_enable();
 
+	/* who knows what context the processor might have died in... */
+	task_thread_info(paca[cpu].__current)->preempt_count = 0;
+
 	cpu_idle();
 	return 0;
 }

--

#4 lore raw

Re: [RFC 1/3] support powermac G5 CPU hotplug

Hi!

Quoted 13 lines

This patch allows "hotplugging" of CPUs on G5 machines. CPUs that are disabled are put into an idle loop with interrupts hard-disabled, to wake them up again we kick them just like when bringing them up.

Maybe there's some way to actually turn off those CPUs even more?

Cc Benjamin Herrenschmidt <[email protected]>

arch/powerpc/kernel/smp.c int __devinit start_secondary(void *unus · line 563

Quoted 6 lines
arch/powerpc/kernel/smp.c +3 -0
@@ -558,6 +558,9 @@ int __devinit start_secondary(void *unus
 
 	local_irq_enable();
 
+	/* who knows what context the processor might have died in... */
+	task_thread_info(paca[cpu].__current)->preempt_count = 0;
+

?? Context for downing cpu should better be well-defined. Just do this in cpu_die if it is really required.
Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.
#5 lore raw

Re: [linux-pm] [RFC 1/3] support powermac G5 CPU hotplug

Quoted 6 lines · Pavel Machek

arch/powerpc/kernel/smp.c int __devinit start_secondary(void *unus · line 563

Quoted 3 lines
arch/powerpc/kernel/smp.c +3 -0
+	/* who knows what context the processor might have died in... */
+	task_thread_info(paca[cpu].__current)->preempt_count = 0;
+

?? Context for downing cpu should better be well-defined. Just do this in cpu_die if it is really required.

It is actually required but I'm not exactly sure why. When I don't do this, I end up with preempt_count() 0x100000 (IIRC, notes not here at the moment).

I think this is because the suspend code has interrupts disabled already when downing the CPUs.

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#6 lore raw

Re: [linux-pm] [RFC 1/3] support powermac G5 CPU hotplug

Quoted 5 lines · Johannes Berg
Quoted 2 lines

?? Context for downing cpu should better be well-defined. Just do this in cpu_die if it is really required.

It is actually required but I'm not exactly sure why. When I don't do this, I end up with preempt_count() 0x100000 (IIRC, notes not here at

                                      ^^^^^^^^ typo, should be 0x10000
Quoted 4 lines

the moment).

I think this is because the suspend code has interrupts disabled already when downing the CPUs.

Also, the /sys/devices/system/cpu/cpuN/online thing doesn't disable interrupts before downing the CPU thus that works without this.

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#7 lore raw

Re: [linux-pm] [RFC 1/3] support powermac G5 CPU hotplug

In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

?? Context for downing cpu should better be well-defined. Just do this in cpu_die if it is really required.

Hmm. Just tried, but that doesn't help either!

I'm confused. Really need to check where that value comes from. It looks as though we disable the CPU inside an interrupt but I can't see how that should happen during resume code. Or maybe preempt count is initialised non-zero during boot or something.. Digging

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#8 lore raw

RFC 2/3 windfarm: dont die on suspend thread signal

In reply to Johannes Berg

When the windfarm thread gets a suspend signal it will die instead of freezing. This fixes it.

Cc Benjamin Herrenschmidt <[email protected]>
drivers/macintosh/windfarm_core.c +2 -4
@@ -93,8 +93,6 @@ static int wf_thread_func(void *data)
 	DBG("wf: thread started\n");
 
 	while(!kthread_should_stop()) {
-		try_to_freeze();
-
 		if (time_after_eq(jiffies, next)) {
 			wf_notify(WF_EVENT_TICK, NULL);
 			if (wf_overtemp) {
@@ -117,8 +115,8 @@ static int wf_thread_func(void *data)
 		if (delay <= HZ)
 			schedule_timeout_interruptible(delay);
 
-		/* there should be no signal, but oh well */
-		if (signal_pending(current)) {
+		/* there should be no non-suspend signal, but oh well */
+		if (signal_pending(current) && !try_to_freeze()) {
 			printk(KERN_WARNING "windfarm: thread got sigl !\n");
 			break;
 		}

--

#9 lore raw

RFC 2/3 windfarm: dont die on suspend thread signal

In reply to Johannes Berg

When the windfarm thread gets a suspend signal it will die instead of freezing. This fixes it.

Cc Benjamin Herrenschmidt <[email protected]>
drivers/macintosh/windfarm_core.c +2 -4
@@ -93,8 +93,6 @@ static int wf_thread_func(void *data)
 	DBG("wf: thread started\n");
 
 	while(!kthread_should_stop()) {
-		try_to_freeze();
-
 		if (time_after_eq(jiffies, next)) {
 			wf_notify(WF_EVENT_TICK, NULL);
 			if (wf_overtemp) {
@@ -117,8 +115,8 @@ static int wf_thread_func(void *data)
 		if (delay <= HZ)
 			schedule_timeout_interruptible(delay);
 
-		/* there should be no signal, but oh well */
-		if (signal_pending(current)) {
+		/* there should be no non-suspend signal, but oh well */
+		if (signal_pending(current) && !try_to_freeze()) {
 			printk(KERN_WARNING "windfarm: thread got sigl !\n");
 			break;
 		}

--

#10 lore raw

RFC 2/3 windfarm: dont die on suspend thread signal

In reply to Johannes Berg

When the windfarm thread gets a suspend signal it will die instead of freezing. This fixes it.

Cc Benjamin Herrenschmidt <[email protected]>
drivers/macintosh/windfarm_core.c +2 -4
@@ -93,8 +93,6 @@ static int wf_thread_func(void *data)
 	DBG("wf: thread started\n");
 
 	while(!kthread_should_stop()) {
-		try_to_freeze();
-
 		if (time_after_eq(jiffies, next)) {
 			wf_notify(WF_EVENT_TICK, NULL);
 			if (wf_overtemp) {
@@ -117,8 +115,8 @@ static int wf_thread_func(void *data)
 		if (delay <= HZ)
 			schedule_timeout_interruptible(delay);
 
-		/* there should be no signal, but oh well */
-		if (signal_pending(current)) {
+		/* there should be no non-suspend signal, but oh well */
+		if (signal_pending(current) && !try_to_freeze()) {
 			printk(KERN_WARNING "windfarm: thread got sigl !\n");
 			break;
 		}

--

#11 lore raw

Re: [RFC 2/3] windfarm: dont die on suspend thread signal

Quoted 5 lines · Johannes Berg

When the windfarm thread gets a suspend signal it will die instead of freezing. This fixes it.

Cc Benjamin Herrenschmidt <[email protected]>

ACK.

Signature · 1 line
Thanks for all the (sleeping) penguins.
Acked-by on v1 2/3
#12 lore raw

Re: [RFC 2/3] windfarm: dont die on suspend thread signal

In reply to Johannes Berg
Quoted 5 lines · Johannes Berg

plain text document attachment (windfarm-dont-die-on-signals.patch) When the windfarm thread gets a suspend signal it will die instead of freezing. This fixes it.

Quoted 24 lines
drivers/macintosh/windfarm_core.c +2 -5
@@ -93,8 +93,6 @@ static int wf_thread_func(void *data)
 	DBG("wf: thread started\n");
 
 	while(!kthread_should_stop()) {
-		try_to_freeze();
-
 		if (time_after_eq(jiffies, next)) {
 			wf_notify(WF_EVENT_TICK, NULL);
 			if (wf_overtemp) {
@@ -117,8 +115,8 @@ static int wf_thread_func(void *data)
 		if (delay <= HZ)
 			schedule_timeout_interruptible(delay);
 
-		/* there should be no signal, but oh well */
-		if (signal_pending(current)) {
+		/* there should be no non-suspend signal, but oh well */
+		if (signal_pending(current) && !try_to_freeze()) {
 			printk(KERN_WARNING "windfarm: thread got sigl !\n");
 			break;
 		}
 
--
#13 lore raw

RFC 3/3 suspend to disk on powermac G5

In reply to Johannes Berg

This patch implements a very hacky suspend to disk for powermac G5 machines. I know it's broken in many places.

Built and tested against the tree after commit
620034c84d1d939717bdfbe02c51a3fee43541c3.

For some reason usb doesn't survive suspend even if I try to restore interrupts now... I use this script:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

#!/bin/sh

set -e

echo reboot > /sys/power/disk

rmmod ohci_hcd
rmmod ehci_hcd || true
sync
echo disk > /sys/power/state || true
modprobe ohci_hcd
modprobe ehci_hcd
sleep 30 && reboot -f
<<<<<

and simply press ctrl-c within 30 seconds if my keyboard comes back up :)

Oh and did I say this is hacky? MMIO save/restore, the need to hook many places, no proper MPIC suspend/resume functionality, snd-aoa doesn't work after resume (it plays but no sound comes out, interrupts are coming in though... go figure, eh wait, since I wrote it I guess I'll check it too).

I also ifdef'ed out

	set_context(current->active_mm->context.id, current->active_mm->pgd);

because I didn't know what it is doing and it works without :)

I've suspended and resumed a few times in a row with this now, with and without longer breaks with the machine up and with the machine off.

Ah who am I kidding... This is pretty much guaranteed to break. Parts of the assembly code are quite old (written like half a year ago) so I don't remember some things... Why, for example, the save area has holes. I shall fix these some time I guess.

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/kernel/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
 obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
+obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
kernel/power/Kconfig +2 -2
@@ -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 || PPC64) && (!SMP || SUSPEND_SMP) && !X86_PAE) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the possibility of suspending the machine.
 	  It doesn't need ACPI or APM.
@@ -128,5 +128,5 @@ config PM_STD_PARTITION
 
 config SUSPEND_SMP
 	bool
-	depends on HOTPLUG_CPU && X86 && PM
+	depends on HOTPLUG_CPU && (X86 || PPC64) && PM
 	default y
arch/powerpc/platforms/powermac/setup.c +3 -0
@@ -455,8 +455,10 @@ static int pmac_pm_finish(suspend_state_
 {
 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
 
+#ifdef CONFIG_PPC32
 	/* Restore userland MMU context */
 	set_context(current->active_mm->context.id, current->active_mm->pgd);
+#endif
 
 	return 0;
 }
@@ -488,6 +490,7 @@ static int pmac_late_init(void)
 {
 	initializing = 0;
 #ifdef CONFIG_SOFTWARE_SUSPEND
+	iommu_init_late();
 	pm_set_ops(&pmac_pm_ops);
 #endif /* CONFIG_SOFTWARE_SUSPEND */
 	/* this is udbg (which is __init) and we can later use it during
include/asm/suspend.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef __ASM_POWERPC_SUSPEND_H
+#define __ASM_POWERPC_SUSPEND_H
+
+static inline int arch_prepare_suspend(void)
+{
+	return 0;
+}
+
+#endif /* __ASM_POWERPC_SUSPEND_H */
include/linux/suspend.h +1 -1
@@ -1,7 +1,7 @@
 #ifndef _LINUX_SWSUSP_H
 #define _LINUX_SWSUSP_H
 
-#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
+#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
 #include <asm/suspend.h>
 #endif
 #include <linux/swap.h>
arch/powerpc/kernel/swsusp_64.c new file +54 -0

54 lines not on this page · raw message

arch/powerpc/kernel/swsusp_asm64.S new file +231 -0

231 lines not on this page · raw message

arch/powerpc/sysdev/dart_iommu.c +42 -0

54 lines not on this page · raw message

include/asm-powerpc/iommu.h +5 -0
@@ -108,6 +108,11 @@ static inline void pci_iommu_init(void) 
 #endif
 
 extern void alloc_dart_table(void);
+#if defined(CONFIG_SOFTWARE_SUSPEND) && defined(CONFIG_U3_DART)
+extern void iommu_init_late(void);
+extern void iommu_dart_save(void);
+extern void iommu_dart_restore(void);
+#endif
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_IOMMU_H */
arch/powerpc/kernel/asm-offsets.c +2 -2
@@ -21,12 +21,12 @@
 #include <linux/types.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
+#include <linux/suspend.h>
 #ifdef CONFIG_PPC64
 #include <linux/time.h>
 #include <linux/hardirq.h>
 #else
 #include <linux/ptrace.h>
-#include <linux/suspend.h>
 #endif
 
 #include <asm/io.h>
@@ -257,11 +257,11 @@ int main(void)
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
 	DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
 
-#ifndef CONFIG_PPC64
 	DEFINE(pbe_address, offsetof(struct pbe, address));
 	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
 	DEFINE(pbe_next, offsetof(struct pbe, next));
 
+#ifndef CONFIG_PPC64
 	DEFINE(TASK_SIZE, TASK_SIZE);
 	DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
 #endif /* ! CONFIG_PPC64 */
arch/powerpc/kernel/idle.c +4 -1
@@ -33,8 +33,11 @@
 #include <asm/smp.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
+/* this is used for software suspend, and that shuts down
+ * CPUs even while the system is still booting... */
 #define cpu_should_die()	(cpu_is_offline(smp_processor_id()) && \
-				 system_state == SYSTEM_RUNNING)
+				   (system_state == SYSTEM_RUNNING     \
+				 || system_state == SYSTEM_BOOTING))
 #else
 #define cpu_should_die()	0
 #endif
kernel/power/snapshot.c +2 -0
@@ -707,6 +707,8 @@ static struct page *saveable_page(unsign
 		return NULL;
 	if (PageNosaveFree(page))
 		return NULL;
+	if (!page_is_ram(pfn))
+		return NULL;
 
 	return page;
 }

--

#14 lore raw

RFC 3/3 suspend to disk on powermac G5

In reply to Johannes Berg

This patch implements a very hacky suspend to disk for powermac G5 machines. I know it's broken in many places.

Built and tested against the tree after commit
620034c84d1d939717bdfbe02c51a3fee43541c3.

For some reason usb doesn't survive suspend even if I try to restore interrupts now... I use this script:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

#!/bin/sh

set -e

echo reboot > /sys/power/disk

rmmod ohci_hcd
rmmod ehci_hcd || true
sync
echo disk > /sys/power/state || true
modprobe ohci_hcd
modprobe ehci_hcd
sleep 30 && reboot -f
<<<<<

and simply press ctrl-c within 30 seconds if my keyboard comes back up :)

Oh and did I say this is hacky? MMIO save/restore, the need to hook many places, no proper MPIC suspend/resume functionality, snd-aoa doesn't work after resume (it plays but no sound comes out, interrupts are coming in though... go figure, eh wait, since I wrote it I guess I'll check it too).

I also ifdef'ed out

	set_context(current->active_mm->context.id, current->active_mm->pgd);

because I didn't know what it is doing and it works without :)

I've suspended and resumed a few times in a row with this now, with and without longer breaks with the machine up and with the machine off.

Ah who am I kidding... This is pretty much guaranteed to break. Parts of the assembly code are quite old (written like half a year ago) so I don't remember some things... Why, for example, the save area has holes. I shall fix these some time I guess.

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/kernel/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
 obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
+obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
kernel/power/Kconfig +2 -2
@@ -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 || PPC64) && (!SMP || SUSPEND_SMP) && !X86_PAE) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the possibility of suspending the machine.
 	  It doesn't need ACPI or APM.
@@ -128,5 +128,5 @@ config PM_STD_PARTITION
 
 config SUSPEND_SMP
 	bool
-	depends on HOTPLUG_CPU && X86 && PM
+	depends on HOTPLUG_CPU && (X86 || PPC64) && PM
 	default y
arch/powerpc/platforms/powermac/setup.c +3 -0
@@ -455,8 +455,10 @@ static int pmac_pm_finish(suspend_state_
 {
 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
 
+#ifdef CONFIG_PPC32
 	/* Restore userland MMU context */
 	set_context(current->active_mm->context.id, current->active_mm->pgd);
+#endif
 
 	return 0;
 }
@@ -488,6 +490,7 @@ static int pmac_late_init(void)
 {
 	initializing = 0;
 #ifdef CONFIG_SOFTWARE_SUSPEND
+	iommu_init_late();
 	pm_set_ops(&pmac_pm_ops);
 #endif /* CONFIG_SOFTWARE_SUSPEND */
 	/* this is udbg (which is __init) and we can later use it during
include/asm/suspend.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef __ASM_POWERPC_SUSPEND_H
+#define __ASM_POWERPC_SUSPEND_H
+
+static inline int arch_prepare_suspend(void)
+{
+	return 0;
+}
+
+#endif /* __ASM_POWERPC_SUSPEND_H */
include/linux/suspend.h +1 -1
@@ -1,7 +1,7 @@
 #ifndef _LINUX_SWSUSP_H
 #define _LINUX_SWSUSP_H
 
-#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
+#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
 #include <asm/suspend.h>
 #endif
 #include <linux/swap.h>
arch/powerpc/kernel/swsusp_64.c new file +54 -0

54 lines not on this page · raw message

arch/powerpc/kernel/swsusp_asm64.S new file +231 -0

231 lines not on this page · raw message

arch/powerpc/sysdev/dart_iommu.c +42 -0

54 lines not on this page · raw message

include/asm-powerpc/iommu.h +5 -0
@@ -108,6 +108,11 @@ static inline void pci_iommu_init(void) 
 #endif
 
 extern void alloc_dart_table(void);
+#if defined(CONFIG_SOFTWARE_SUSPEND) && defined(CONFIG_U3_DART)
+extern void iommu_init_late(void);
+extern void iommu_dart_save(void);
+extern void iommu_dart_restore(void);
+#endif
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_IOMMU_H */
arch/powerpc/kernel/asm-offsets.c +2 -2
@@ -21,12 +21,12 @@
 #include <linux/types.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
+#include <linux/suspend.h>
 #ifdef CONFIG_PPC64
 #include <linux/time.h>
 #include <linux/hardirq.h>
 #else
 #include <linux/ptrace.h>
-#include <linux/suspend.h>
 #endif
 
 #include <asm/io.h>
@@ -257,11 +257,11 @@ int main(void)
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
 	DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
 
-#ifndef CONFIG_PPC64
 	DEFINE(pbe_address, offsetof(struct pbe, address));
 	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
 	DEFINE(pbe_next, offsetof(struct pbe, next));
 
+#ifndef CONFIG_PPC64
 	DEFINE(TASK_SIZE, TASK_SIZE);
 	DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
 #endif /* ! CONFIG_PPC64 */
arch/powerpc/kernel/idle.c +4 -1
@@ -33,8 +33,11 @@
 #include <asm/smp.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
+/* this is used for software suspend, and that shuts down
+ * CPUs even while the system is still booting... */
 #define cpu_should_die()	(cpu_is_offline(smp_processor_id()) && \
-				 system_state == SYSTEM_RUNNING)
+				   (system_state == SYSTEM_RUNNING     \
+				 || system_state == SYSTEM_BOOTING))
 #else
 #define cpu_should_die()	0
 #endif
kernel/power/snapshot.c +2 -0
@@ -707,6 +707,8 @@ static struct page *saveable_page(unsign
 		return NULL;
 	if (PageNosaveFree(page))
 		return NULL;
+	if (!page_is_ram(pfn))
+		return NULL;
 
 	return page;
 }

--

#15 lore raw

RFC 3/3 suspend to disk on powermac G5

In reply to Johannes Berg

This patch implements a very hacky suspend to disk for powermac G5 machines. I know it's broken in many places.

Built and tested against the tree after commit
620034c84d1d939717bdfbe02c51a3fee43541c3.

For some reason usb doesn't survive suspend even if I try to restore interrupts now... I use this script:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

#!/bin/sh

set -e

echo reboot > /sys/power/disk

rmmod ohci_hcd
rmmod ehci_hcd || true
sync
echo disk > /sys/power/state || true
modprobe ohci_hcd
modprobe ehci_hcd
sleep 30 && reboot -f
<<<<<

and simply press ctrl-c within 30 seconds if my keyboard comes back up :)

Oh and did I say this is hacky? MMIO save/restore, the need to hook many places, no proper MPIC suspend/resume functionality, snd-aoa doesn't work after resume (it plays but no sound comes out, interrupts are coming in though... go figure, eh wait, since I wrote it I guess I'll check it too).

I also ifdef'ed out

	set_context(current->active_mm->context.id, current->active_mm->pgd);

because I didn't know what it is doing and it works without :)

I've suspended and resumed a few times in a row with this now, with and without longer breaks with the machine up and with the machine off.

Ah who am I kidding... This is pretty much guaranteed to break. Parts of the assembly code are quite old (written like half a year ago) so I don't remember some things... Why, for example, the save area has holes. I shall fix these some time I guess.

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/kernel/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
 obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
+obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
kernel/power/Kconfig +2 -2
@@ -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 || PPC64) && (!SMP || SUSPEND_SMP) && !X86_PAE) || ((FRV || PPC32) && !SMP))
 	---help---
 	  Enable the possibility of suspending the machine.
 	  It doesn't need ACPI or APM.
@@ -128,5 +128,5 @@ config PM_STD_PARTITION
 
 config SUSPEND_SMP
 	bool
-	depends on HOTPLUG_CPU && X86 && PM
+	depends on HOTPLUG_CPU && (X86 || PPC64) && PM
 	default y
arch/powerpc/platforms/powermac/setup.c +3 -0
@@ -455,8 +455,10 @@ static int pmac_pm_finish(suspend_state_
 {
 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
 
+#ifdef CONFIG_PPC32
 	/* Restore userland MMU context */
 	set_context(current->active_mm->context.id, current->active_mm->pgd);
+#endif
 
 	return 0;
 }
@@ -488,6 +490,7 @@ static int pmac_late_init(void)
 {
 	initializing = 0;
 #ifdef CONFIG_SOFTWARE_SUSPEND
+	iommu_init_late();
 	pm_set_ops(&pmac_pm_ops);
 #endif /* CONFIG_SOFTWARE_SUSPEND */
 	/* this is udbg (which is __init) and we can later use it during
include/asm/suspend.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef __ASM_POWERPC_SUSPEND_H
+#define __ASM_POWERPC_SUSPEND_H
+
+static inline int arch_prepare_suspend(void)
+{
+	return 0;
+}
+
+#endif /* __ASM_POWERPC_SUSPEND_H */
include/linux/suspend.h +1 -1
@@ -1,7 +1,7 @@
 #ifndef _LINUX_SWSUSP_H
 #define _LINUX_SWSUSP_H
 
-#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
+#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
 #include <asm/suspend.h>
 #endif
 #include <linux/swap.h>
arch/powerpc/kernel/swsusp_64.c new file +54 -0

54 lines not on this page · raw message

arch/powerpc/kernel/swsusp_asm64.S new file +231 -0

231 lines not on this page · raw message

arch/powerpc/sysdev/dart_iommu.c +42 -0

54 lines not on this page · raw message

include/asm-powerpc/iommu.h +5 -0
@@ -108,6 +108,11 @@ static inline void pci_iommu_init(void) 
 #endif
 
 extern void alloc_dart_table(void);
+#if defined(CONFIG_SOFTWARE_SUSPEND) && defined(CONFIG_U3_DART)
+extern void iommu_init_late(void);
+extern void iommu_dart_save(void);
+extern void iommu_dart_restore(void);
+#endif
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_IOMMU_H */
arch/powerpc/kernel/asm-offsets.c +2 -2
@@ -21,12 +21,12 @@
 #include <linux/types.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
+#include <linux/suspend.h>
 #ifdef CONFIG_PPC64
 #include <linux/time.h>
 #include <linux/hardirq.h>
 #else
 #include <linux/ptrace.h>
-#include <linux/suspend.h>
 #endif
 
 #include <asm/io.h>
@@ -257,11 +257,11 @@ int main(void)
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
 	DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
 
-#ifndef CONFIG_PPC64
 	DEFINE(pbe_address, offsetof(struct pbe, address));
 	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
 	DEFINE(pbe_next, offsetof(struct pbe, next));
 
+#ifndef CONFIG_PPC64
 	DEFINE(TASK_SIZE, TASK_SIZE);
 	DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
 #endif /* ! CONFIG_PPC64 */
arch/powerpc/kernel/idle.c +4 -1
@@ -33,8 +33,11 @@
 #include <asm/smp.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
+/* this is used for software suspend, and that shuts down
+ * CPUs even while the system is still booting... */
 #define cpu_should_die()	(cpu_is_offline(smp_processor_id()) && \
-				 system_state == SYSTEM_RUNNING)
+				   (system_state == SYSTEM_RUNNING     \
+				 || system_state == SYSTEM_BOOTING))
 #else
 #define cpu_should_die()	0
 #endif
kernel/power/snapshot.c +2 -0
@@ -707,6 +707,8 @@ static struct page *saveable_page(unsign
 		return NULL;
 	if (PageNosaveFree(page))
 		return NULL;
+	if (!page_is_ram(pfn))
+		return NULL;
 
 	return page;
 }

--

#16 lore raw

Re: [linux-pm] [RFC 3/3] suspend to disk on powermac G5

Hi!

Quoted 8 lines

This patch implements a very hacky suspend to disk for powermac G5 machines. I know it's broken in many places.

Built and tested against the tree after commit
620034c84d1d939717bdfbe02c51a3fee43541c3.

For some reason usb doesn't survive suspend even if I try to restore interrupts now... I use this script:

...

Quoted 4 lines

Oh and did I say this is hacky? MMIO save/restore, the need to hook many places, no proper MPIC suspend/resume functionality, snd-aoa doesn't work after resume (it plays but no sound comes out, interrupts are coming in though... go figure, eh wait, since I wrote it I guess I'll check it too).

Does aoa module load/unload help? Does making it build-in help? Also try playing with aumix after resume.

Quoted 16 lines

I also ifdef'ed out

	set_context(current->active_mm->context.id, current->active_mm->pgd);

because I didn't know what it is doing and it works without :)

I've suspended and resumed a few times in a row with this now, with and without longer breaks with the machine up and with the machine off.

Ah who am I kidding... This is pretty much guaranteed to break. Parts of the assembly code are quite old (written like half a year ago) so I don't remember some things... Why, for example, the save area has holes. I shall fix these some time I guess.

arch/powerpc/sysdev/dart_iommu.c void iommu_init_early_dart(void) · line 362

Quoted 5 lines
arch/powerpc/sysdev/dart_iommu.c +5 -0
+	/* phew. suckers. this 16MB area is left unmapped
+	 * at another place but they don't bother to mark it so */
+	for (i = 0; i < (1<<24); i+= PAGE_SIZE)
+		SetPageNosave(virt_to_page((void*)((unsigned long)dart_tablebase + i)));
+

Can you move that marking where it belongs?

arch/powerpc/sysdev/dart_iommu.c void iommu_init_early_dart(void) · line 369

Quoted 7 lines
arch/powerpc/sysdev/dart_iommu.c +7 -0
+	if (dart_tablebase == 0 || dart_tablesize == 0)
+		return;
+
+	p = alloc_pages(GFP_KERNEL, 9);
+	BUG_ON(!p);
+	dart_copy = page_address(p);
+}

Not sure how likely is 2MB allocation to succeed. You may need to prealocate it... And you definitely will need to handle error here.

kernel/power/snapshot.c static struct page *saveable_page(unsign · line 714

Quoted 11 lines
kernel/power/snapshot.c +2 -0
@@ -707,6 +707,8 @@ static struct page *saveable_page(unsign
 		return NULL;
 	if (PageNosaveFree(page))
 		return NULL;
+	if (!page_is_ram(pfn))
+		return NULL;
 
 	return page;
 }

Could this get some testing in -mm?

Overall, it looks pretty much okay. Thanks...

Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.
#17 lore raw

Re: [linux-pm] [RFC 3/3] suspend to disk on powermac G5

Hi,

Quoted 2 lines

Does aoa module load/unload help? Does making it build-in help? Also try playing with aumix after resume.

Yeah, I tried all of that except making it built-in. It's rather strange but I suppose I'm to blame since I wrote aoa :) I'll need to look a bit further. The odd thing is that everything works, I can play, change volumes etc. just don't get any sound. I'm thinking something is wrong with the onyx codec programming but haven't really looked yet. i2sbus should be fine since it suspends/resume ok on my powerbook.

Quoted 7 lines

arch/powerpc/sysdev/dart_iommu.c void iommu_init_early_dart(void) · line 362

Quoted 5 lines
arch/powerpc/sysdev/dart_iommu.c +5 -0
+	/* phew. suckers. this 16MB area is left unmapped
+	 * at another place but they don't bother to mark it so */
+	for (i = 0; i < (1<<24); i+= PAGE_SIZE)
+		SetPageNosave(virt_to_page((void*)((unsigned long)dart_tablebase + i)));
+

Can you move that marking where it belongs?

Where does it belong? The reservation is done so early that SetPageNosave can't work yet (IIRC, I've been sitting on this code too long.)

Quoted 10 lines

arch/powerpc/sysdev/dart_iommu.c void iommu_init_early_dart(void) · line 369

Quoted 7 lines
arch/powerpc/sysdev/dart_iommu.c +7 -0
+	if (dart_tablebase == 0 || dart_tablesize == 0)
+		return;
+
+	p = alloc_pages(GFP_KERNEL, 9);
+	BUG_ON(!p);
+	dart_copy = page_address(p);
+}

Not sure how likely is 2MB allocation to succeed. You may need to prealocate it... And you definitely will need to handle error here.

Good points. I suppose I'll just preallocate it or try mapping the dart table after all and not doing anything special with it during suspend/resume... need to think about it more.

Quoted 9 lines
Quoted 9 lines
kernel/power/snapshot.c +2 -0
@@ -707,6 +707,8 @@ static struct page *saveable_page(unsign
 		return NULL;
 	if (PageNosaveFree(page))
 		return NULL;
+	if (!page_is_ram(pfn))
+		return NULL;
 
Quoted 4 lines

kernel/power/snapshot.c static struct page *saveable_page(unsign · line 714

Quoted 2 lines
kernel/power/snapshot.c +0 -0
 	return page;
 }

Could this get some testing in -mm?

I'd be much happier with it if I knew why it was necessary. On the powermac we have a 2G memory hole: first 2G memory, then a 2G hole and then the rest of the memory. It seems like the suspend code doesn't handle any memory holes at the moment but that seems strange to me.

Thanks for your comments!

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#19 lore raw
Quoted 3 lines · Johannes Berg

Date/time is restored to wherever it was when suspending. Does anyone know how to fix that? Does the RTC somehow warp the time on resume or do we somehow mark the time/date __nosave?

Clock do not tick while suspended; I guess you need to copy time suspend/resume from i386 or something.
Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.
#20 lore raw
Quoted 2 lines · Pavel Machek

Clock do not tick while suspended; I guess you need to copy time suspend/resume from i386 or something.

Well the RTC of course ticks but the system clock obviously doesn't. Yes, I'll have to look at the time suspend/resume code. Do you know where to find it?

johannes

#21 lore raw
Quoted 3 lines · Johannes Berg

Well the RTC of course ticks but the system clock obviously doesn't. Yes, I'll have to look at the time suspend/resume code. Do you know where to find it?

Never mind, found it easily enough: it's in arch/i386/kernel/time.c

johannes

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#22 lore raw
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Johannes Berg

Well the RTC of course ticks but the system clock obviously doesn't. Yes, I'll have to look at the time suspend/resume code. Do you know where to find it?

Never mind, found it easily enough: it's in arch/i386/kernel/time.c

Timer is also restored from RTC on wakeup on powerbooks, so there is already something under arch/powerpc...

Gabriel