sparc64: Hibernation support
v2 cover sparc64: Hibernation support
This patch adds CONFIG_HIBERNATION support for sparc64 architecture. The suspend function is the same as on another platforms. The restore function uses Bypass feature of MMU which allows to make the process more comfortable and plesant.
Signed-off-by Kirill Tkhai <[email protected]>
CC David Miller <[email protected]>
CC Sam Ravnborg <[email protected]>
--- arch/sparc/Kconfig | 7 ++ arch/sparc/Makefile | 1 + arch/sparc/include/asm/hibernate.h | 23 +++++++ arch/sparc/kernel/asm-offsets.c | 15 +++++ arch/sparc/power/Makefile | 3 + arch/sparc/power/hibernate.c | 42 ++++++++++++ arch/sparc/power/hibernate_asm.S | 131 ++++++++++++++++++++++++++++++++++++ 7 files changed, 222 insertions(+) create mode 100644 arch/sparc/include/asm/hibernate.h create mode 100644 arch/sparc/power/Makefile create mode 100644 arch/sparc/power/hibernate.c create mode 100644 arch/sparc/power/hibernate_asm.S
arch/sparc/Kconfig +7 -0
@@ -103,6 +103,9 @@ config HAVE_LATENCYTOP_SUPPORT bool default y if SPARC64 +config ARCH_HIBERNATION_POSSIBLE + def_bool y if SPARC64 + config AUDIT_ARCH bool default y
@@ -333,6 +336,10 @@ config ARCH_SPARSEMEM_DEFAULT source "mm/Kconfig" +if SPARC64 +source "kernel/power/Kconfig" +endif + config SCHED_SMT bool "SMT (Hyperthreading) scheduler support" depends on SPARC64 && SMP
arch/sparc/Makefile +1 -0
@@ -57,6 +57,7 @@ core-y += arch/sparc/ libs-y += arch/sparc/prom/ libs-y += arch/sparc/lib/ +drivers-$(CONFIG_PM) += arch/sparc/power/ drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ boot := arch/sparc/boot
arch/sparc/include/asm/hibernate.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* hibernate.h: Hibernaton support specific for sparc64. +* +* Copyright (C) 2013 Kirill V Tkhai ([email protected]) +*/ + +#ifndef ___SPARC_HIBERNATE_H +#define ___SPARC_HIBERNATE_H + +struct saved_context { +unsigned long fp; +unsigned long cwp; +unsigned long wstate; + +unsigned long tick; +unsigned long pstate; + +unsigned long g4; +unsigned long g5; +unsigned long g6; +}; + +#endif
arch/sparc/kernel/asm-offsets.c +15 -0
@@ -14,6 +14,8 @@// #include <linux/mm.h> #include <linux/kbuild.h> +#include <asm/hibernate.h> +#ifdef CONFIG_SPARC32 int sparc32_foo (void ) {
@@ -24,6 +26,19 @@ int sparc32_foo(void)#else int sparc64_foo (void ) { +#ifdef CONFIG_HIBERNATION +BLANK (); +OFFSET (SC_REG_FP , saved_context, fp); +OFFSET (SC_REG_CWP , saved_context, cwp); +OFFSET (SC_REG_WSTATE , saved_context, wstate); + +OFFSET (SC_REG_TICK , saved_context, tick); +OFFSET (SC_REG_PSTATE , saved_context, pstate); + +OFFSET (SC_REG_G4 , saved_context, g4); +OFFSET (SC_REG_G5 , saved_context, g5); +OFFSET (SC_REG_G6 , saved_context, g6); +#endif return 0 ; }#endif
arch/sparc/power/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# Makefile for Sparc-specific hibernate files. + +obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate_asm.o
arch/sparc/power/hibernate.c new file +42 -0
42 lines not on this page · raw message
arch/sparc/power/hibernate_asm.S new file +131 -0
131 lines not on this page · raw message
From: Kirill Tkhai <[email protected]>
Date: Wed, 20 Mar 2013 05:11:07 +0400
Quoted 6 lines
This patch adds
CONFIG_HIBERNATIONsupport for sparc64 architecture. The suspend function is the same as on another platforms. The restore function uses Bypass feature of MMU which allows to make the process more comfortable and plesant.Signed-off-by Kirill Tkhai <[email protected]>
Applied.