Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86-32, hibernate: Enable CONFIG_ARCH_HIBERNATION_HEADER on 32bit system

Enable CONFIG_ARCH_HIBERNATION_HEADER for 32bit system so that

1. arch_hibernation_header_save/restore() are invoked across
hibernation on 32bit system.

2. The checksum handling as well as 'magic' number checking
for 32bit system are enabled.

Controlled by CONFIG_X86_64 in hibernate.c

Signed-off-by: Zhimin Gu <kookoo.gu@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Zhimin Gu and committed by
Rafael J. Wysocki
44556530 25862a04

+10 -2
+1 -1
arch/x86/Kconfig
··· 2422 2422 2423 2423 config ARCH_HIBERNATION_HEADER 2424 2424 def_bool y 2425 - depends on X86_64 && HIBERNATION 2425 + depends on HIBERNATION 2426 2426 2427 2427 source "kernel/power/Kconfig" 2428 2428
+9 -1
arch/x86/power/hibernate.c
··· 53 53 return pfn >= nosave_begin_pfn && pfn < nosave_end_pfn; 54 54 } 55 55 56 - #ifdef CONFIG_X86_64 57 56 58 57 #define MD5_DIGEST_SIZE 16 59 58 ··· 139 140 } 140 141 #endif 141 142 143 + #ifdef CONFIG_X86_64 142 144 #define RESTORE_MAGIC 0x23456789ABCDEF01UL 145 + #else 146 + #define RESTORE_MAGIC 0x12345678UL 147 + #endif 143 148 144 149 /** 145 150 * arch_hibernation_header_save - populate the architecture specific part ··· 157 154 if (max_size < sizeof(struct restore_data_record)) 158 155 return -EOVERFLOW; 159 156 rdr->magic = RESTORE_MAGIC; 157 + #ifdef CONFIG_X86_64 160 158 rdr->jump_address = (unsigned long)restore_registers; 161 159 rdr->jump_address_phys = __pa_symbol(restore_registers); 162 160 ··· 179 175 * have any of the PCID bits set. 180 176 */ 181 177 rdr->cr3 = restore_cr3 & ~CR3_PCID_MASK; 178 + #endif 182 179 183 180 return hibernation_e820_save(rdr->e820_digest); 184 181 } ··· 198 193 return -EINVAL; 199 194 } 200 195 196 + #ifdef CONFIG_X86_64 201 197 restore_jump_address = rdr->jump_address; 202 198 jump_address_phys = rdr->jump_address_phys; 203 199 restore_cr3 = rdr->cr3; 200 + #endif 204 201 205 202 if (hibernation_e820_mismatch(rdr->e820_digest)) { 206 203 pr_crit("Hibernate inconsistent memory map detected!\n"); ··· 212 205 return 0; 213 206 } 214 207 208 + #ifdef CONFIG_X86_64 215 209 int relocate_restore_code(void) 216 210 { 217 211 pgd_t *pgd;