diff options
author | Hans-Joachim Picht <hans@linux.vnet.ibm.com> | 2009-06-16 04:30:52 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-16 04:31:22 -0400 |
commit | 155af2f95f905c830688dd0ca7c7cac4107334fd (patch) | |
tree | 4304a39e713d1594903e838830c4029715cc7a2a /arch/s390/kernel | |
parent | c369527f18f8560bd3580be2676cb55b54b02ee6 (diff) |
[S390] s390: hibernation support for s390
This patch introduces the hibernation backend support to the
s390 architecture. Now it is possible to suspend a mainframe Linux
guest using the following command:
echo disk > /sys/power/state
Signed-off-by: Hans-Joachim Picht <hans@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r-- | arch/s390/kernel/early.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/mem_detect.c | 19 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 38 |
3 files changed, 43 insertions, 20 deletions
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index fb263736826c..f9b144049dc9 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/early.c | 2 | * arch/s390/kernel/early.c |
3 | * | 3 | * |
4 | * Copyright IBM Corp. 2007 | 4 | * Copyright IBM Corp. 2007, 2009 |
5 | * Author(s): Hongjie Yang <hongjie@us.ibm.com>, | 5 | * Author(s): Hongjie Yang <hongjie@us.ibm.com>, |
6 | * Heiko Carstens <heiko.carstens@de.ibm.com> | 6 | * Heiko Carstens <heiko.carstens@de.ibm.com> |
7 | */ | 7 | */ |
@@ -210,7 +210,7 @@ static noinline __init void detect_machine_type(void) | |||
210 | machine_flags |= MACHINE_FLAG_VM; | 210 | machine_flags |= MACHINE_FLAG_VM; |
211 | } | 211 | } |
212 | 212 | ||
213 | static __init void early_pgm_check_handler(void) | 213 | static void early_pgm_check_handler(void) |
214 | { | 214 | { |
215 | unsigned long addr; | 215 | unsigned long addr; |
216 | const struct exception_table_entry *fixup; | 216 | const struct exception_table_entry *fixup; |
@@ -222,7 +222,7 @@ static __init void early_pgm_check_handler(void) | |||
222 | S390_lowcore.program_old_psw.addr = fixup->fixup | PSW_ADDR_AMODE; | 222 | S390_lowcore.program_old_psw.addr = fixup->fixup | PSW_ADDR_AMODE; |
223 | } | 223 | } |
224 | 224 | ||
225 | static noinline __init void setup_lowcore_early(void) | 225 | void setup_lowcore_early(void) |
226 | { | 226 | { |
227 | psw_t psw; | 227 | psw_t psw; |
228 | 228 | ||
diff --git a/arch/s390/kernel/mem_detect.c b/arch/s390/kernel/mem_detect.c index 9872999c66d1..559af0d07878 100644 --- a/arch/s390/kernel/mem_detect.c +++ b/arch/s390/kernel/mem_detect.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2008 | 2 | * Copyright IBM Corp. 2008, 2009 |
3 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> | 3 | * |
4 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> | ||
4 | */ | 5 | */ |
5 | 6 | ||
6 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
@@ -9,20 +10,6 @@ | |||
9 | #include <asm/sclp.h> | 10 | #include <asm/sclp.h> |
10 | #include <asm/setup.h> | 11 | #include <asm/setup.h> |
11 | 12 | ||
12 | static inline int tprot(unsigned long addr) | ||
13 | { | ||
14 | int rc = -EFAULT; | ||
15 | |||
16 | asm volatile( | ||
17 | " tprot 0(%1),0\n" | ||
18 | "0: ipm %0\n" | ||
19 | " srl %0,28\n" | ||
20 | "1:\n" | ||
21 | EX_TABLE(0b,1b) | ||
22 | : "+d" (rc) : "a" (addr) : "cc"); | ||
23 | return rc; | ||
24 | } | ||
25 | |||
26 | #define ADDR2G (1ULL << 31) | 13 | #define ADDR2G (1ULL << 31) |
27 | 14 | ||
28 | static void find_memory_chunks(struct mem_chunk chunk[]) | 15 | static void find_memory_chunks(struct mem_chunk chunk[]) |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index cc8c484984e3..fd8e3111a4e8 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/s390/kernel/smp.c | 2 | * arch/s390/kernel/smp.c |
3 | * | 3 | * |
4 | * Copyright IBM Corp. 1999,2007 | 4 | * Copyright IBM Corp. 1999, 2009 |
5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), | 5 | * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
6 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 6 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
7 | * Heiko Carstens (heiko.carstens@de.ibm.com) | 7 | * Heiko Carstens (heiko.carstens@de.ibm.com) |
@@ -1031,6 +1031,42 @@ out: | |||
1031 | static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, | 1031 | static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, |
1032 | dispatching_store); | 1032 | dispatching_store); |
1033 | 1033 | ||
1034 | /* | ||
1035 | * If the resume kernel runs on another cpu than the suspended kernel, | ||
1036 | * we have to switch the cpu IDs in the logical map. | ||
1037 | */ | ||
1038 | void smp_switch_boot_cpu_in_resume(u32 resume_phys_cpu_id, | ||
1039 | struct _lowcore *suspend_lowcore) | ||
1040 | { | ||
1041 | int cpu, suspend_cpu_id, resume_cpu_id; | ||
1042 | u32 suspend_phys_cpu_id; | ||
1043 | |||
1044 | suspend_phys_cpu_id = __cpu_logical_map[suspend_lowcore->cpu_nr]; | ||
1045 | suspend_cpu_id = suspend_lowcore->cpu_nr; | ||
1046 | |||
1047 | for_each_present_cpu(cpu) { | ||
1048 | if (__cpu_logical_map[cpu] == resume_phys_cpu_id) { | ||
1049 | resume_cpu_id = cpu; | ||
1050 | goto found; | ||
1051 | } | ||
1052 | } | ||
1053 | panic("Could not find resume cpu in logical map.\n"); | ||
1054 | |||
1055 | found: | ||
1056 | printk("Resume cpu ID: %i/%i\n", resume_phys_cpu_id, resume_cpu_id); | ||
1057 | printk("Suspend cpu ID: %i/%i\n", suspend_phys_cpu_id, suspend_cpu_id); | ||
1058 | |||
1059 | __cpu_logical_map[resume_cpu_id] = suspend_phys_cpu_id; | ||
1060 | __cpu_logical_map[suspend_cpu_id] = resume_phys_cpu_id; | ||
1061 | |||
1062 | lowcore_ptr[suspend_cpu_id]->cpu_addr = resume_phys_cpu_id; | ||
1063 | } | ||
1064 | |||
1065 | u32 smp_get_phys_cpu_id(void) | ||
1066 | { | ||
1067 | return __cpu_logical_map[smp_processor_id()]; | ||
1068 | } | ||
1069 | |||
1034 | static int __init topology_init(void) | 1070 | static int __init topology_init(void) |
1035 | { | 1071 | { |
1036 | int cpu; | 1072 | int cpu; |