mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 15:35:04 +07:00
cc456c4e7c
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>
49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
/*
|
|
* Copyright 2001-2003 Pavel Machek <pavel@suse.cz>
|
|
* Based on code
|
|
* Copyright 2001 Patrick Mochel <mochel@osdl.org>
|
|
*/
|
|
#ifndef _ASM_X86_SUSPEND_64_H
|
|
#define _ASM_X86_SUSPEND_64_H
|
|
|
|
#include <asm/desc.h>
|
|
#include <asm/i387.h>
|
|
|
|
/*
|
|
* Image of the saved processor state, used by the low level ACPI suspend to
|
|
* RAM code and by the low level hibernation code.
|
|
*
|
|
* If you modify it, fix arch/x86/kernel/acpi/wakeup_64.S and make sure that
|
|
* __save/__restore_processor_state(), defined in arch/x86/kernel/suspend_64.c,
|
|
* still work as required.
|
|
*/
|
|
struct saved_context {
|
|
struct pt_regs regs;
|
|
u16 ds, es, fs, gs, ss;
|
|
unsigned long gs_base, gs_kernel_base, fs_base;
|
|
unsigned long cr0, cr2, cr3, cr4, cr8;
|
|
u64 misc_enable;
|
|
bool misc_enable_saved;
|
|
unsigned long efer;
|
|
u16 gdt_pad; /* Unused */
|
|
struct desc_ptr gdt_desc;
|
|
u16 idt_pad;
|
|
u16 idt_limit;
|
|
unsigned long idt_base;
|
|
u16 ldt;
|
|
u16 tss;
|
|
unsigned long tr;
|
|
unsigned long safety;
|
|
unsigned long return_address;
|
|
} __attribute__((packed));
|
|
|
|
#define loaddebug(thread,register) \
|
|
set_debugreg((thread)->debugreg##register, register)
|
|
|
|
/* routines for saving/restoring kernel state */
|
|
extern int acpi_save_state_mem(void);
|
|
extern char core_restore_code;
|
|
extern char restore_registers;
|
|
|
|
#endif /* _ASM_X86_SUSPEND_64_H */
|