-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In commit 0fba3a1 (a very long time ago, May 2006), I fixed a bug that caused powermacs to crash when you tried entering standby/mem suspend states. As I'm now getting more familiar with the suspend code I notice a few more things: 1. we previously misunderstood what pm_ops is for, it isn't supposed to be for doing platform dependent suspend/resume stuff that needs to be done for suspend to disk (as we currently try to use it!), it is instead for entering platform dependent suspend states ("standby", "mem"). 2. due to the first point, we never properly save FPU and altivec states when suspending to disk. It probably hasn't hurt yet because the process that writes the "disk" to /sys/power/state uses neither and its context is used. This patch addresses these points as follows: 1. remove all pm_ops from powermac, powermac suspend to ram isn't currently usable via /sys/power/state but is done via the PMU instead. 2. move the code responsible for storing FPU/altivec state into save_processor_state and the set_context() call to restore_processor_state. 3. add a call to kernel_enable_spe() It may look like there is some code removal missing but that is actually because the new suspend.h file overrides the ppc/suspend.h one which was previously used. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
- Loading branch information
Johannes Berg
authored and
Paul Mackerras
committed
May 2, 2007
1 parent
f88df14
commit be9c94d
Showing
4 changed files
with
44 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Common powerpc suspend code for 32 and 64 bits | ||
* | ||
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
*/ | ||
|
||
#include <linux/sched.h> | ||
#include <asm/suspend.h> | ||
#include <asm/system.h> | ||
#include <asm/current.h> | ||
#include <asm/mmu_context.h> | ||
|
||
void save_processor_state(void) | ||
{ | ||
/* | ||
* flush out all the special registers so we don't need | ||
* to save them in the snapshot | ||
*/ | ||
flush_fp_to_thread(current); | ||
flush_altivec_to_thread(current); | ||
flush_spe_to_thread(current); | ||
} | ||
|
||
void restore_processor_state(void) | ||
{ | ||
#ifdef CONFIG_PPC32 | ||
set_context(current->active_mm->context.id, current->active_mm->pgd); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef __ASM_POWERPC_SUSPEND_H | ||
#define __ASM_POWERPC_SUSPEND_H | ||
|
||
static inline int arch_prepare_suspend(void) { return 0; } | ||
|
||
void save_processor_state(void); | ||
void restore_processor_state(void); | ||
|
||
#endif /* __ASM_POWERPC_SUSPEND_H */ |