aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r--arch/s390/kernel/smp.c38
1 files changed, 37 insertions, 1 deletions
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:
1031static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, 1031static 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 */
1038void 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
1055found:
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
1065u32 smp_get_phys_cpu_id(void)
1066{
1067 return __cpu_logical_map[smp_processor_id()];
1068}
1069
1034static int __init topology_init(void) 1070static int __init topology_init(void)
1035{ 1071{
1036 int cpu; 1072 int cpu;