From patchwork Sat Mar 26 11:29:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 665621 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2QBVrxS001294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 26 Mar 2011 11:32:13 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2QBTkRk017752; Sat, 26 Mar 2011 04:29:47 -0700 Received: from ogre.sisk.pl (ogre.sisk.pl [217.79.144.158]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2QBTgKj017743 for ; Sat, 26 Mar 2011 04:29:44 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id CDC221A590B; Sat, 26 Mar 2011 12:12:41 +0100 (CET) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02999-04; Sat, 26 Mar 2011 12:12:22 +0100 (CET) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 4FE381A56C9; Sat, 26 Mar 2011 12:12:22 +0100 (CET) From: "Rafael J. Wysocki" To: linux-pm@lists.linux-foundation.org Date: Sat, 26 Mar 2011 12:29:44 +0100 User-Agent: KMail/1.13.6 (Linux/2.6.38+; KDE/4.6.0; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201103261229.44770.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-5.441 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: Shriram Rajagopalan , xen-devel@lists.xensource.com, LKML Subject: [linux-pm] [PATCH] PM / Hibernate: Introduce CONFIG_HIBERNATE_INTERFACE X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 26 Mar 2011 11:32:16 +0000 (UTC) Index: linux-2.6/kernel/power/Kconfig =================================================================== --- linux-2.6.orig/kernel/power/Kconfig +++ linux-2.6/kernel/power/Kconfig @@ -19,8 +19,12 @@ config SUSPEND_FREEZER Turning OFF this setting is NOT recommended! If in doubt, say Y. config HIBERNATION + bool + +config HIBERNATE_INTERFACE bool "Hibernation (aka 'suspend to disk')" depends on SWAP && ARCH_HIBERNATION_POSSIBLE + select HIBERNATION select LZO_COMPRESS select LZO_DECOMPRESS ---help--- Index: linux-2.6/kernel/power/Makefile =================================================================== --- linux-2.6.orig/kernel/power/Makefile +++ linux-2.6/kernel/power/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_PM_SLEEP) += console.o obj-$(CONFIG_FREEZER) += process.o obj-$(CONFIG_SUSPEND) += suspend.o obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o -obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ - block_io.o +obj-$(CONFIG_HIBERNATE_INTERFACE) += hibernate.o snapshot.o swap.o \ + user.o block_io.o obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o Index: linux-2.6/include/linux/suspend.h =================================================================== --- linux-2.6.orig/include/linux/suspend.h +++ linux-2.6/include/linux/suspend.h @@ -229,7 +229,7 @@ struct platform_hibernation_ops { void (*recover)(void); }; -#ifdef CONFIG_HIBERNATION +#ifdef CONFIG_HIBERNATE_INTERFACE /* kernel/power/snapshot.c */ extern void __register_nosave_region(unsigned long b, unsigned long e, int km); static inline void __init register_nosave_region(unsigned long b, unsigned long e) @@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); extern int hibernate(void); extern bool system_entering_hibernation(void); -#else /* CONFIG_HIBERNATION */ +#else /* !CONFIG_HIBERNATE_INTERFACE */ +static inline void register_nosave_region(unsigned long b, unsigned long e) {} +static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } static inline void swsusp_set_page_free(struct page *p) {} static inline void swsusp_unset_page_free(struct page *p) {} @@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {} static inline int hibernate(void) { return -ENOSYS; } static inline bool system_entering_hibernation(void) { return false; } -#endif /* CONFIG_HIBERNATION */ +#endif /* !CONFIG_HIBERNATE_INTERFACE */ #ifdef CONFIG_PM_SLEEP void save_processor_state(void); @@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi extern struct mutex pm_mutex; #ifndef CONFIG_HIBERNATION -static inline void register_nosave_region(unsigned long b, unsigned long e) -{ -} -static inline void register_nosave_region_late(unsigned long b, unsigned long e) -{ -} - static inline void lock_system_sleep(void) {} static inline void unlock_system_sleep(void) {} Index: linux-2.6/arch/x86/power/Makefile =================================================================== --- linux-2.6.orig/arch/x86/power/Makefile +++ linux-2.6/arch/x86/power/Makefile @@ -4,4 +4,5 @@ nostackp := $(call cc-option, -fno-stack CFLAGS_cpu.o := $(nostackp) obj-$(CONFIG_PM_SLEEP) += cpu.o -obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o +obj-$(CONFIG_HIBERNATE_INTERFACE) += hibernate_$(BITS).o \ + hibernate_asm_$(BITS).o Index: linux-2.6/kernel/power/main.c =================================================================== --- linux-2.6.orig/kernel/power/main.c +++ linux-2.6/kernel/power/main.c @@ -156,7 +156,7 @@ static ssize_t state_show(struct kobject s += sprintf(s,"%s ", pm_states[i]); } #endif -#ifdef CONFIG_HIBERNATION +#ifdef CONFIG_HIBERNATE_INTERFACE s += sprintf(s, "%s\n", "disk"); #else if (s != buf) Index: linux-2.6/kernel/power/power.h =================================================================== --- linux-2.6.orig/kernel/power/power.h +++ linux-2.6/kernel/power/power.h @@ -13,7 +13,7 @@ struct swsusp_info { unsigned long size; } __attribute__((aligned(PAGE_SIZE))); -#ifdef CONFIG_HIBERNATION +#ifdef CONFIG_HIBERNATE_INTERFACE /* kernel/power/snapshot.c */ extern void __init hibernate_image_size_init(void); @@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat extern int hibernation_restore(int platform_mode); extern int hibernation_platform_enter(void); -#else /* !CONFIG_HIBERNATION */ +#else /* !CONFIG_HIBERNATE_INTERFACE */ static inline void hibernate_image_size_init(void) {} -#endif /* !CONFIG_HIBERNATION */ +#endif /* !CONFIG_HIBERNATE_INTERFACE */ extern int pfn_is_nosave(unsigned long);