1*2874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 2be9c94ddSJohannes Berg /* 3be9c94ddSJohannes Berg * Common powerpc suspend code for 32 and 64 bits 4be9c94ddSJohannes Berg * 5be9c94ddSJohannes Berg * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6be9c94ddSJohannes Berg */ 7be9c94ddSJohannes Berg 8be9c94ddSJohannes Berg #include <linux/sched.h> 91fc439c8STobin C. Harding #include <linux/suspend.h> 10be9c94ddSJohannes Berg #include <asm/current.h> 11be9c94ddSJohannes Berg #include <asm/mmu_context.h> 12ae3a197eSDavid Howells #include <asm/switch_to.h> 13be9c94ddSJohannes Berg save_processor_state(void)14be9c94ddSJohannes Bergvoid save_processor_state(void) 15be9c94ddSJohannes Berg { 16be9c94ddSJohannes Berg /* 17be9c94ddSJohannes Berg * flush out all the special registers so we don't need 18be9c94ddSJohannes Berg * to save them in the snapshot 19be9c94ddSJohannes Berg */ 20579e633eSAnton Blanchard flush_all_to_thread(current); 21543b9fd3SJohannes Berg 22543b9fd3SJohannes Berg #ifdef CONFIG_PPC64 23543b9fd3SJohannes Berg hard_irq_disable(); 24543b9fd3SJohannes Berg #endif 25543b9fd3SJohannes Berg 26be9c94ddSJohannes Berg } 27be9c94ddSJohannes Berg restore_processor_state(void)28be9c94ddSJohannes Bergvoid restore_processor_state(void) 29be9c94ddSJohannes Berg { 30be9c94ddSJohannes Berg #ifdef CONFIG_PPC32 31d2adba3fSAneesh Kumar K.V switch_mmu_context(current->active_mm, current->active_mm, NULL); 32be9c94ddSJohannes Berg #endif 33be9c94ddSJohannes Berg } 34