Skip to content

sparc64: Hibernation support

Kirill Tkhai sparclinux 2 versions – Applied

Status from this message: Applied.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest0 of 1 patch 1 replyApplied
  2. v11 patch 2 repliesSuperseded

Patches in v2 Applied

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/1]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.

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
index 9bff3db..9e1256f 100644
@@ -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
index 541b8b0..9ff4236 100644
@@ -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
new file mode 100644
index 0000000..2ec34f8
@@ -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
index 68f7e11..961b87f 100644
@@ -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
new file mode 100644
index 0000000..3201ace
@@ -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