diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-05-01 21:53:30 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-05-02 14:27:35 -0400 |
commit | cc456c4e7cac3837a86aaa7ca3cb9f488d44d196 (patch) | |
tree | ba510e7fcb4baab33f5853299fef12d73d23343a /arch/x86/include | |
parent | 5a148af66932c31814e263366094b5812210b501 (diff) |
x86, gdt, hibernate: Store/load GDT for hibernate path.
The git commite7a5cd063c7b4c58417f674821d63f5eb6747e37
("x86-64, gdt: Store/load GDT for ACPI S3 or hibernate/resume path
is not needed.") assumes that for the hibernate path the booting
kernel and the resuming kernel MUST be the same. That is certainly
the case for a 32-bit kernel (see check_image_kernel and
CONFIG_ARCH_HIBERNATION_HEADER config option).
However for 64-bit kernels it is OK to have a different kernel
version (and size of the image) of the booting and resuming kernels.
Hence the above mentioned git commit introduces an regression.
This patch fixes it by introducing a 'struct desc_ptr gdt_desc'
back in the 'struct saved_context'. However instead of having in the
'save_processor_state' and 'restore_processor_state' the
store/load_gdt calls, we are only saving the GDT in the
save_processor_state.
For the restore path the lgdt operation is done in
hibernate_asm_[32|64].S in the 'restore_registers' path.
The apt reader of this description will recognize that only 64-bit
kernels need this treatment, not 32-bit. This patch adds the logic
in the 32-bit path to be more similar to 64-bit so that in the future
the unification process can take advantage of this.
[ hpa: this also reverts an inadvertent on-disk format change ]
Suggested-by: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Link: http://lkml.kernel.org/r/1367459610-9656-2-git-send-email-konrad.wilk@oracle.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/suspend_32.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/suspend_64.h | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/include/asm/suspend_32.h b/arch/x86/include/asm/suspend_32.h index f6064b7385b0..552d6c90a6d4 100644 --- a/arch/x86/include/asm/suspend_32.h +++ b/arch/x86/include/asm/suspend_32.h | |||
@@ -15,6 +15,7 @@ struct saved_context { | |||
15 | unsigned long cr0, cr2, cr3, cr4; | 15 | unsigned long cr0, cr2, cr3, cr4; |
16 | u64 misc_enable; | 16 | u64 misc_enable; |
17 | bool misc_enable_saved; | 17 | bool misc_enable_saved; |
18 | struct desc_ptr gdt_desc; | ||
18 | struct desc_ptr idt; | 19 | struct desc_ptr idt; |
19 | u16 ldt; | 20 | u16 ldt; |
20 | u16 tss; | 21 | u16 tss; |
diff --git a/arch/x86/include/asm/suspend_64.h b/arch/x86/include/asm/suspend_64.h index 97b84e08a211..bc6232834bab 100644 --- a/arch/x86/include/asm/suspend_64.h +++ b/arch/x86/include/asm/suspend_64.h | |||
@@ -25,6 +25,8 @@ struct saved_context { | |||
25 | u64 misc_enable; | 25 | u64 misc_enable; |
26 | bool misc_enable_saved; | 26 | bool misc_enable_saved; |
27 | unsigned long efer; | 27 | unsigned long efer; |
28 | u16 gdt_pad; /* Unused */ | ||
29 | struct desc_ptr gdt_desc; | ||
28 | u16 idt_pad; | 30 | u16 idt_pad; |
29 | u16 idt_limit; | 31 | u16 idt_limit; |
30 | unsigned long idt_base; | 32 | unsigned long idt_base; |