From d158cbdf39ffaec9dd5299fdfdfdd2c7897a71dc Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Thu, 18 Oct 2007 03:04:53 -0700 Subject: Hibernation: Arbitrary boot kernel support on x86_64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to restore a hibernation image on x86_64 with the help of a kernel different from the one in the image. The idea is to split the core restoration code into two separate parts and to place each of them in a different page.  The first part belongs to the boot kernel and is executed as the last step of the image kernel's memory restoration procedure.  Before being executed, it is relocated to a safe page that won't be overwritten while copying the image kernel pages. The final operation performed by it is a jump to the second part of the core restoration code that belongs to the image kernel and has just been restored. This code makes the CPU switch to the image kernel's page tables and restores the state of general purpose registers (including the stack pointer) from before the hibernation. The main issue with this idea is that in order to jump to the second part of the core restoration code the boot kernel needs to know its address.  However, this address may be passed to it in the image header.  Namely, the part of the image header previously used for checking if the version of the image kernel is correct can be replaced with some architecture specific data that will allow the boot kernel to jump to the right address within the image kernel.  These data should also be used for checking if the image kernel is compatible with the boot kernel (as far as the memory restroration procedure is concerned). It can be done, for example, with the help of a "magic" value that has to be equal in both kernels, so that they can be regarded as compatible. Signed-off-by: Rafael J. Wysocki Acked-by: Pavel Machek Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/x86_64/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/x86_64/Kconfig') diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 43fafe9e9c0..78cb68f2ebb 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig @@ -716,6 +716,11 @@ menu "Power management options" source kernel/power/Kconfig +config ARCH_HIBERNATION_HEADER + bool + depends on HIBERNATION + default y + source "drivers/acpi/Kconfig" source "arch/x86/kernel/cpufreq/Kconfig" -- cgit v1.2.3-18-g5258