linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] Implement arch disable/enable irq hooks.
@ 2007-10-23 21:24 Scott Wood
  2007-10-23 21:24 ` [PATCH 2/7] pm: Add TLF_SLEEPING hack to delay interrupt delivery when waking from sleep Scott Wood
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Scott Wood @ 2007-10-23 21:24 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

These hooks ensure that a decrementer interrupt is not pending when
suspending; otherwise, problems may occur.  For example, with deep sleep
on the 831x, a pending decrementer will cause a system freeze because the
SoC thinks the decrementer interrupt would have woken the system, but the
core must have interrupts disabled due to the setup required for deep
sleep.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
Please queue these patches for 2.6.25 if they do not offend.

 arch/powerpc/kernel/time.c    |   41 +++++++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/machdep.h |   13 +++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 9eb3284..5e2a39b 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -647,6 +647,47 @@ void wakeup_decrementer(void)
 	set_dec(ticks);
 }
 
+#ifdef CONFIG_SUSPEND
+void generic_suspend_disable_irqs(void)
+{
+	preempt_disable();
+
+	/* Disable the decrementer, so that it doesn't interfere
+	 * with suspending.
+	 */
+
+	set_dec(0x7fffffff);
+	hard_irq_disable();
+	set_dec(0x7fffffff);
+}
+
+void generic_suspend_enable_irqs(void)
+{
+	wakeup_decrementer();
+
+	local_irq_enable();
+	preempt_enable();
+}
+
+/* Overrides the weak version in kernel/power/main.c */
+void arch_suspend_disable_irqs(void)
+{
+	if (ppc_md.suspend_disable_irqs)
+		ppc_md.suspend_disable_irqs();
+	else
+		generic_suspend_disable_irqs();
+}
+
+/* Overrides the weak version in kernel/power/main.c */
+void arch_suspend_enable_irqs(void)
+{
+	if (ppc_md.suspend_enable_irqs)
+		ppc_md.suspend_enable_irqs();
+	else
+		generic_suspend_enable_irqs();
+}
+#endif
+
 #ifdef CONFIG_SMP
 void __init smp_space_timers(unsigned int max_cpus)
 {
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 6968f43..15ba15a 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -253,6 +253,16 @@ struct machdep_calls {
 	 */
 	void (*machine_kexec)(struct kimage *image);
 #endif /* CONFIG_KEXEC */
+
+#ifdef CONFIG_SUSPEND
+	/* These are called to disable and enable, respectively, IRQs when
+	 * entering a suspend state.  If NULL, then the generic versions
+	 * will be called.  The generic versions disable/enable the
+	 * decrementer along with interrupts.
+	 */
+	void (*suspend_disable_irqs)(void);
+	void (*suspend_enable_irqs)(void);
+#endif
 };
 
 extern void power4_idle(void);
@@ -326,5 +336,8 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal)
 		ppc_md.log_error(buf, err_type, fatal);
 }
 
+void generic_suspend_disable_irqs(void);
+void generic_suspend_enable_irqs(void);
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_MACHDEP_H */
-- 
1.5.3.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-04-30 22:17 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-23 21:24 [PATCH 1/7] Implement arch disable/enable irq hooks Scott Wood
2007-10-23 21:24 ` [PATCH 2/7] pm: Add TLF_SLEEPING hack to delay interrupt delivery when waking from sleep Scott Wood
2007-10-23 21:24 ` [PATCH 3/7] Add 6xx-style HID0_SLEEP support Scott Wood
2007-10-23 21:24 ` [PATCH 4/7] fsl_soc: Factor fsl_get_sys_freq() out of the wdt init Scott Wood
2007-10-23 21:25 ` [PATCH 5/7] mpc83xx: Power Management support Scott Wood
2007-10-23 21:25 ` [PATCH 6/7] mpc83xx: timer driver for PM wakeup Scott Wood
2007-10-27 10:46   ` Anton Vorontsov
2007-10-23 21:25 ` [PATCH 7/7] gianfar: Add flags for magic packet and MDIO Scott Wood
2007-10-23 21:33 ` [PATCH 1/7] Implement arch disable/enable irq hooks Josh Boyer
2007-10-23 21:34   ` Scott Wood
2007-10-23 22:45     ` Josh Boyer
2007-10-25 18:01 ` Scott Wood
2008-04-25 12:57 ` Guennadi Liakhovetski
2008-04-28 20:33   ` Scott Wood
2008-04-29  4:44     ` Paul Mackerras
2008-04-29  5:04       ` Paul Mackerras
2008-04-30 10:33       ` Guennadi Liakhovetski
2008-04-30 22:17         ` Paul Mackerras
2008-04-30 17:22       ` Scott Wood
2008-04-30 21:01         ` Segher Boessenkool
2008-04-30 21:07           ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).