Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 2 | /* |
| 3 | * Common powerpc suspend code for 32 and 64 bits |
| 4 | * |
| 5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <linux/sched.h> |
Tobin C. Harding | 1fc439c | 2017-03-06 19:25:31 +1100 | [diff] [blame] | 9 | #include <linux/suspend.h> |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 10 | #include <asm/current.h> |
| 11 | #include <asm/mmu_context.h> |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 12 | #include <asm/switch_to.h> |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 13 | |
| 14 | void save_processor_state(void) |
| 15 | { |
| 16 | /* |
| 17 | * flush out all the special registers so we don't need |
| 18 | * to save them in the snapshot |
| 19 | */ |
Anton Blanchard | 579e633 | 2015-10-29 11:44:09 +1100 | [diff] [blame] | 20 | flush_all_to_thread(current); |
Johannes Berg | 543b9fd | 2007-05-03 22:31:38 +1000 | [diff] [blame] | 21 | |
| 22 | #ifdef CONFIG_PPC64 |
| 23 | hard_irq_disable(); |
| 24 | #endif |
| 25 | |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | void restore_processor_state(void) |
| 29 | { |
| 30 | #ifdef CONFIG_PPC32 |
Aneesh Kumar K.V | d2adba3 | 2016-04-29 23:26:01 +1000 | [diff] [blame] | 31 | switch_mmu_context(current->active_mm, current->active_mm, NULL); |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 32 | #endif |
Johannes Berg | be9c94d | 2007-04-30 21:37:15 +1000 | [diff] [blame] | 33 | } |