aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/power
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/x86/power
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/x86/power')
-rw-r--r--arch/x86/power/cpu.c88
-rw-r--r--arch/x86/power/hibernate_32.c1
2 files changed, 3 insertions, 86 deletions
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
index 120cee1c3f8..87bb35e34ef 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <linux/export.h>
13#include <linux/smp.h> 12#include <linux/smp.h>
14 13
15#include <asm/pgtable.h> 14#include <asm/pgtable.h>
@@ -20,8 +19,6 @@
20#include <asm/xcr.h> 19#include <asm/xcr.h>
21#include <asm/suspend.h> 20#include <asm/suspend.h>
22#include <asm/debugreg.h> 21#include <asm/debugreg.h>
23#include <asm/fpu-internal.h> /* pcntxt_mask */
24#include <asm/cpu.h>
25 22
26#ifdef CONFIG_X86_32 23#ifdef CONFIG_X86_32
27static struct saved_context saved_context; 24static struct saved_context saved_context;
@@ -116,7 +113,7 @@ static void __save_processor_state(struct saved_context *ctxt)
116void save_processor_state(void) 113void save_processor_state(void)
117{ 114{
118 __save_processor_state(&saved_context); 115 __save_processor_state(&saved_context);
119 x86_platform.save_sched_clock_state(); 116 save_sched_clock_state();
120} 117}
121#ifdef CONFIG_X86_32 118#ifdef CONFIG_X86_32
122EXPORT_SYMBOL(save_processor_state); 119EXPORT_SYMBOL(save_processor_state);
@@ -226,7 +223,6 @@ static void __restore_processor_state(struct saved_context *ctxt)
226 fix_processor_context(); 223 fix_processor_context();
227 224
228 do_fpu_end(); 225 do_fpu_end();
229 x86_platform.restore_sched_clock_state();
230 mtrr_bp_restore(); 226 mtrr_bp_restore();
231} 227}
232 228
@@ -234,88 +230,8 @@ static void __restore_processor_state(struct saved_context *ctxt)
234void restore_processor_state(void) 230void restore_processor_state(void)
235{ 231{
236 __restore_processor_state(&saved_context); 232 __restore_processor_state(&saved_context);
233 restore_sched_clock_state();
237} 234}
238#ifdef CONFIG_X86_32 235#ifdef CONFIG_X86_32
239EXPORT_SYMBOL(restore_processor_state); 236EXPORT_SYMBOL(restore_processor_state);
240#endif 237#endif
241
242/*
243 * When bsp_check() is called in hibernate and suspend, cpu hotplug
244 * is disabled already. So it's unnessary to handle race condition between
245 * cpumask query and cpu hotplug.
246 */
247static int bsp_check(void)
248{
249 if (cpumask_first(cpu_online_mask) != 0) {
250 pr_warn("CPU0 is offline.\n");
251 return -ENODEV;
252 }
253
254 return 0;
255}
256
257static int bsp_pm_callback(struct notifier_block *nb, unsigned long action,
258 void *ptr)
259{
260 int ret = 0;
261
262 switch (action) {
263 case PM_SUSPEND_PREPARE:
264 case PM_HIBERNATION_PREPARE:
265 ret = bsp_check();
266 break;
267#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
268 case PM_RESTORE_PREPARE:
269 /*
270 * When system resumes from hibernation, online CPU0 because
271 * 1. it's required for resume and
272 * 2. the CPU was online before hibernation
273 */
274 if (!cpu_online(0))
275 _debug_hotplug_cpu(0, 1);
276 break;
277 case PM_POST_RESTORE:
278 /*
279 * When a resume really happens, this code won't be called.
280 *
281 * This code is called only when user space hibernation software
282 * prepares for snapshot device during boot time. So we just
283 * call _debug_hotplug_cpu() to restore to CPU0's state prior to
284 * preparing the snapshot device.
285 *
286 * This works for normal boot case in our CPU0 hotplug debug
287 * mode, i.e. CPU0 is offline and user mode hibernation
288 * software initializes during boot time.
289 *
290 * If CPU0 is online and user application accesses snapshot
291 * device after boot time, this will offline CPU0 and user may
292 * see different CPU0 state before and after accessing
293 * the snapshot device. But hopefully this is not a case when
294 * user debugging CPU0 hotplug. Even if users hit this case,
295 * they can easily online CPU0 back.
296 *
297 * To simplify this debug code, we only consider normal boot
298 * case. Otherwise we need to remember CPU0's state and restore
299 * to that state and resolve racy conditions etc.
300 */
301 _debug_hotplug_cpu(0, 0);
302 break;
303#endif
304 default:
305 break;
306 }
307 return notifier_from_errno(ret);
308}
309
310static int __init bsp_pm_check_init(void)
311{
312 /*
313 * Set this bsp_pm_callback as lower priority than
314 * cpu_hotplug_pm_callback. So cpu_hotplug_pm_callback will be called
315 * earlier to disable cpu hotplug before bsp online check.
316 */
317 pm_notifier(bsp_pm_callback, -INT_MAX);
318 return 0;
319}
320
321core_initcall(bsp_pm_check_init);
diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index 74202c1910c..3769079874d 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -10,6 +10,7 @@
10#include <linux/suspend.h> 10#include <linux/suspend.h>
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12 12
13#include <asm/system.h>
13#include <asm/page.h> 14#include <asm/page.h>
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/mmzone.h> 16#include <asm/mmzone.h>