suspend.c (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) | suspend.c (8252ca87c7a2111502ee13994956f8c309faad7f) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 | 1// SPDX-License-Identifier: GPL-2.0 |
2#include <linux/ftrace.h> |
|
2#include <linux/init.h> 3#include <linux/slab.h> 4#include <linux/mm_types.h> 5#include <linux/pgtable.h> 6 7#include <asm/bugs.h> 8#include <asm/cacheflush.h> 9#include <asm/idmap.h> --- 11 unchanged lines hidden (view full) --- 21 struct mm_struct *mm = current->active_mm; 22 u32 __mpidr = cpu_logical_map(smp_processor_id()); 23 int ret; 24 25 if (!idmap_pgd) 26 return -EINVAL; 27 28 /* | 3#include <linux/init.h> 4#include <linux/slab.h> 5#include <linux/mm_types.h> 6#include <linux/pgtable.h> 7 8#include <asm/bugs.h> 9#include <asm/cacheflush.h> 10#include <asm/idmap.h> --- 11 unchanged lines hidden (view full) --- 22 struct mm_struct *mm = current->active_mm; 23 u32 __mpidr = cpu_logical_map(smp_processor_id()); 24 int ret; 25 26 if (!idmap_pgd) 27 return -EINVAL; 28 29 /* |
30 * Function graph tracer state gets incosistent when the kernel 31 * calls functions that never return (aka suspend finishers) hence 32 * disable graph tracing during their execution. 33 */ 34 pause_graph_tracing(); 35 36 /* |
|
29 * Provide a temporary page table with an identity mapping for 30 * the MMU-enable code, required for resuming. On successful 31 * resume (indicated by a zero return code), we need to switch 32 * back to the correct page tables. 33 */ 34 ret = __cpu_suspend(arg, fn, __mpidr); | 37 * Provide a temporary page table with an identity mapping for 38 * the MMU-enable code, required for resuming. On successful 39 * resume (indicated by a zero return code), we need to switch 40 * back to the correct page tables. 41 */ 42 ret = __cpu_suspend(arg, fn, __mpidr); |
43 44 unpause_graph_tracing(); 45 |
|
35 if (ret == 0) { 36 cpu_switch_mm(mm->pgd, mm); 37 local_flush_bp_all(); 38 local_flush_tlb_all(); 39 check_other_bugs(); 40 } 41 42 return ret; 43} 44#else 45int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) 46{ 47 u32 __mpidr = cpu_logical_map(smp_processor_id()); | 46 if (ret == 0) { 47 cpu_switch_mm(mm->pgd, mm); 48 local_flush_bp_all(); 49 local_flush_tlb_all(); 50 check_other_bugs(); 51 } 52 53 return ret; 54} 55#else 56int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) 57{ 58 u32 __mpidr = cpu_logical_map(smp_processor_id()); |
48 return __cpu_suspend(arg, fn, __mpidr); | 59 int ret; 60 61 pause_graph_tracing(); 62 ret = __cpu_suspend(arg, fn, __mpidr); 63 unpause_graph_tracing(); 64 65 return ret; |
49} 50#define idmap_pgd NULL 51#endif 52 53/* 54 * This is called by __cpu_suspend() to save the state, and do whatever 55 * flushing is required to ensure that when the CPU goes to sleep we have 56 * the necessary data available when the caches are not searched. --- 49 unchanged lines hidden --- | 66} 67#define idmap_pgd NULL 68#endif 69 70/* 71 * This is called by __cpu_suspend() to save the state, and do whatever 72 * flushing is required to ensure that when the CPU goes to sleep we have 73 * the necessary data available when the caches are not searched. --- 49 unchanged lines hidden --- |