~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/kernel/hibernate.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm/kernel/hibernate.c (Version linux-6.12-rc7) and /arch/i386/kernel/hibernate.c (Version linux-4.9.337)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Hibernation support specific for ARM           
  4  *                                                
  5  * Derived from work on ARM hibernation suppor    
  6  *                                                
  7  * Ubuntu project, hibernation support for mac    
  8  * Copyright (C) 2010 Nokia Corporation (Hiros    
  9  * Copyright (C) 2010 Texas Instruments, Inc.     
 10  *  https://lkml.org/lkml/2010/6/18/4             
 11  *  https://lists.linux-foundation.org/piperma    
 12  *  https://patchwork.kernel.org/patch/96442/     
 13  *                                                
 14  * Copyright (C) 2006 Rafael J. Wysocki <rjw@s    
 15  */                                               
 16                                                   
 17 #include <linux/mm.h>                             
 18 #include <linux/suspend.h>                        
 19 #include <asm/system_misc.h>                      
 20 #include <asm/idmap.h>                            
 21 #include <asm/suspend.h>                          
 22 #include <asm/page.h>                             
 23 #include <asm/sections.h>                         
 24 #include "reboot.h"                               
 25                                                   
 26 int pfn_is_nosave(unsigned long pfn)              
 27 {                                                 
 28         unsigned long nosave_begin_pfn = virt_    
 29         unsigned long nosave_end_pfn = virt_to    
 30                                                   
 31         return (pfn >= nosave_begin_pfn) && (p    
 32 }                                                 
 33                                                   
 34 void notrace save_processor_state(void)           
 35 {                                                 
 36         WARN_ON(num_online_cpus() != 1);          
 37         local_fiq_disable();                      
 38 }                                                 
 39                                                   
 40 void notrace restore_processor_state(void)        
 41 {                                                 
 42         local_fiq_enable();                       
 43 }                                                 
 44                                                   
 45 /*                                                
 46  * Snapshot kernel memory and reset the system    
 47  *                                                
 48  * swsusp_save() is executed in the suspend fi    
 49  * context pointer and memory are part of the     
 50  * required by the resume kernel image to rest    
 51  * swsusp_arch_suspend().                         
 52  *                                                
 53  * soft_restart is not technically needed, but    
 54  * returned from cpu_suspend.                     
 55  *                                                
 56  * When soft reboot completes, the hibernation    
 57  */                                               
 58 static int notrace arch_save_image(unsigned lo    
 59 {                                                 
 60         int ret;                                  
 61                                                   
 62         ret = swsusp_save();                      
 63         if (ret == 0)                             
 64                 _soft_restart(virt_to_idmap(cp    
 65         return ret;                               
 66 }                                                 
 67                                                   
 68 /*                                                
 69  * Save the current CPU state before suspend /    
 70  */                                               
 71 int notrace swsusp_arch_suspend(void)             
 72 {                                                 
 73         return cpu_suspend(0, arch_save_image)    
 74 }                                                 
 75                                                   
 76 /*                                                
 77  * Restore page contents for physical pages th    
 78  * hibernation image.  Switch to idmap_pgd so     
 79  * are overwritten with the same contents.        
 80  */                                               
 81 static void notrace arch_restore_image(void *u    
 82 {                                                 
 83         struct pbe *pbe;                          
 84                                                   
 85         cpu_switch_mm(idmap_pgd, &init_mm);       
 86         for (pbe = restore_pblist; pbe; pbe =     
 87                 copy_page(pbe->orig_address, p    
 88                                                   
 89         _soft_restart(virt_to_idmap(cpu_resume    
 90 }                                                 
 91                                                   
 92 static u64 resume_stack[PAGE_SIZE/2/sizeof(u64    
 93                                                   
 94 /*                                                
 95  * Resume from the hibernation image.             
 96  * Due to the kernel heap / data restore, stac    
 97  * and that would make function calls impossib    
 98  * stack within the nosave region to avoid tha    
 99  */                                               
100 int swsusp_arch_resume(void)                      
101 {                                                 
102         call_with_stack(arch_restore_image, 0,    
103                 resume_stack + ARRAY_SIZE(resu    
104         return 0;                                 
105 }                                                 
106                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php