aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/smp.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2012-06-26 10:06:37 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-07-03 13:55:33 -0400
commit9b747530d928800c9eb7f0c131dffd2cc868c475 (patch)
tree12ba4acabb160112ad9e159200f7745b8225fd6a /arch/s390/kernel/smp.c
parent9d04edd23e6ab368d25ca0adde6f1676185d49f8 (diff)
s390/smp/kvm: unifiy sigp definitions
The smp and the kvm code have different defines for the sigp order codes. Let's just have a single place where these are defined. Also move the sigp condition code and sigp cpu status bits to the new sigp.h header file. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r--arch/s390/kernel/smp.c72
1 files changed, 24 insertions, 48 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index c78074c6cc1d..6e4047e4b498 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -44,34 +44,10 @@
44#include <asm/vdso.h> 44#include <asm/vdso.h>
45#include <asm/debug.h> 45#include <asm/debug.h>
46#include <asm/os_info.h> 46#include <asm/os_info.h>
47#include <asm/sigp.h>
47#include "entry.h" 48#include "entry.h"
48 49
49enum { 50enum {
50 sigp_sense = 1,
51 sigp_external_call = 2,
52 sigp_emergency_signal = 3,
53 sigp_start = 4,
54 sigp_stop = 5,
55 sigp_restart = 6,
56 sigp_stop_and_store_status = 9,
57 sigp_initial_cpu_reset = 11,
58 sigp_cpu_reset = 12,
59 sigp_set_prefix = 13,
60 sigp_store_status_at_address = 14,
61 sigp_store_extended_status_at_address = 15,
62 sigp_set_architecture = 18,
63 sigp_conditional_emergency_signal = 19,
64 sigp_sense_running = 21,
65};
66
67enum {
68 sigp_order_code_accepted = 0,
69 sigp_status_stored = 1,
70 sigp_busy = 2,
71 sigp_not_operational = 3,
72};
73
74enum {
75 ec_schedule = 0, 51 ec_schedule = 0,
76 ec_call_function, 52 ec_call_function,
77 ec_call_function_single, 53 ec_call_function_single,
@@ -124,7 +100,7 @@ static inline int __pcpu_sigp_relax(u16 addr, u8 order, u32 parm, u32 *status)
124 100
125 while (1) { 101 while (1) {
126 cc = __pcpu_sigp(addr, order, parm, status); 102 cc = __pcpu_sigp(addr, order, parm, status);
127 if (cc != sigp_busy) 103 if (cc != SIGP_CC_BUSY)
128 return cc; 104 return cc;
129 cpu_relax(); 105 cpu_relax();
130 } 106 }
@@ -136,7 +112,7 @@ static int pcpu_sigp_retry(struct pcpu *pcpu, u8 order, u32 parm)
136 112
137 for (retry = 0; ; retry++) { 113 for (retry = 0; ; retry++) {
138 cc = __pcpu_sigp(pcpu->address, order, parm, &pcpu->status); 114 cc = __pcpu_sigp(pcpu->address, order, parm, &pcpu->status);
139 if (cc != sigp_busy) 115 if (cc != SIGP_CC_BUSY)
140 break; 116 break;
141 if (retry >= 3) 117 if (retry >= 3)
142 udelay(10); 118 udelay(10);
@@ -146,8 +122,8 @@ static int pcpu_sigp_retry(struct pcpu *pcpu, u8 order, u32 parm)
146 122
147static inline int pcpu_stopped(struct pcpu *pcpu) 123static inline int pcpu_stopped(struct pcpu *pcpu)
148{ 124{
149 if (__pcpu_sigp(pcpu->address, sigp_sense, 125 if (__pcpu_sigp(pcpu->address, SIGP_SENSE,
150 0, &pcpu->status) != sigp_status_stored) 126 0, &pcpu->status) != SIGP_CC_STATUS_STORED)
151 return 0; 127 return 0;
152 /* Check for stopped and check stop state */ 128 /* Check for stopped and check stop state */
153 return !!(pcpu->status & 0x50); 129 return !!(pcpu->status & 0x50);
@@ -155,8 +131,8 @@ static inline int pcpu_stopped(struct pcpu *pcpu)
155 131
156static inline int pcpu_running(struct pcpu *pcpu) 132static inline int pcpu_running(struct pcpu *pcpu)
157{ 133{
158 if (__pcpu_sigp(pcpu->address, sigp_sense_running, 134 if (__pcpu_sigp(pcpu->address, SIGP_SENSE_RUNNING,
159 0, &pcpu->status) != sigp_status_stored) 135 0, &pcpu->status) != SIGP_CC_STATUS_STORED)
160 return 1; 136 return 1;
161 /* Status stored condition code is equivalent to cpu not running. */ 137 /* Status stored condition code is equivalent to cpu not running. */
162 return 0; 138 return 0;
@@ -181,7 +157,7 @@ static void pcpu_ec_call(struct pcpu *pcpu, int ec_bit)
181 157
182 set_bit(ec_bit, &pcpu->ec_mask); 158 set_bit(ec_bit, &pcpu->ec_mask);
183 order = pcpu_running(pcpu) ? 159 order = pcpu_running(pcpu) ?
184 sigp_external_call : sigp_emergency_signal; 160 SIGP_EXTERNAL_CALL : SIGP_EMERGENCY_SIGNAL;
185 pcpu_sigp_retry(pcpu, order, 0); 161 pcpu_sigp_retry(pcpu, order, 0);
186} 162}
187 163
@@ -214,7 +190,7 @@ static int __cpuinit pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu)
214 goto out; 190 goto out;
215#endif 191#endif
216 lowcore_ptr[cpu] = lc; 192 lowcore_ptr[cpu] = lc;
217 pcpu_sigp_retry(pcpu, sigp_set_prefix, (u32)(unsigned long) lc); 193 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, (u32)(unsigned long) lc);
218 return 0; 194 return 0;
219out: 195out:
220 if (pcpu != &pcpu_devices[0]) { 196 if (pcpu != &pcpu_devices[0]) {
@@ -229,7 +205,7 @@ out:
229 205
230static void pcpu_free_lowcore(struct pcpu *pcpu) 206static void pcpu_free_lowcore(struct pcpu *pcpu)
231{ 207{
232 pcpu_sigp_retry(pcpu, sigp_set_prefix, 0); 208 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, 0);
233 lowcore_ptr[pcpu - pcpu_devices] = NULL; 209 lowcore_ptr[pcpu - pcpu_devices] = NULL;
234#ifndef CONFIG_64BIT 210#ifndef CONFIG_64BIT
235 if (MACHINE_HAS_IEEE) { 211 if (MACHINE_HAS_IEEE) {
@@ -288,7 +264,7 @@ static void pcpu_start_fn(struct pcpu *pcpu, void (*func)(void *), void *data)
288 lc->restart_fn = (unsigned long) func; 264 lc->restart_fn = (unsigned long) func;
289 lc->restart_data = (unsigned long) data; 265 lc->restart_data = (unsigned long) data;
290 lc->restart_source = -1UL; 266 lc->restart_source = -1UL;
291 pcpu_sigp_retry(pcpu, sigp_restart, 0); 267 pcpu_sigp_retry(pcpu, SIGP_RESTART, 0);
292} 268}
293 269
294/* 270/*
@@ -309,7 +285,7 @@ static void pcpu_delegate(struct pcpu *pcpu, void (*func)(void *),
309 if (pcpu->address == restart.source) 285 if (pcpu->address == restart.source)
310 func(data); /* should not return */ 286 func(data); /* should not return */
311 /* Stop target cpu (if func returns this stops the current cpu). */ 287 /* Stop target cpu (if func returns this stops the current cpu). */
312 pcpu_sigp_retry(pcpu, sigp_stop, 0); 288 pcpu_sigp_retry(pcpu, SIGP_STOP, 0);
313 /* Restart func on the target cpu and stop the current cpu. */ 289 /* Restart func on the target cpu and stop the current cpu. */
314 memcpy_absolute(&lc->restart_stack, &restart, sizeof(restart)); 290 memcpy_absolute(&lc->restart_stack, &restart, sizeof(restart));
315 asm volatile( 291 asm volatile(
@@ -388,8 +364,8 @@ void smp_emergency_stop(cpumask_t *cpumask)
388 for_each_cpu(cpu, cpumask) { 364 for_each_cpu(cpu, cpumask) {
389 struct pcpu *pcpu = pcpu_devices + cpu; 365 struct pcpu *pcpu = pcpu_devices + cpu;
390 set_bit(ec_stop_cpu, &pcpu->ec_mask); 366 set_bit(ec_stop_cpu, &pcpu->ec_mask);
391 while (__pcpu_sigp(pcpu->address, sigp_emergency_signal, 367 while (__pcpu_sigp(pcpu->address, SIGP_EMERGENCY_SIGNAL,
392 0, NULL) == sigp_busy && 368 0, NULL) == SIGP_CC_BUSY &&
393 get_clock() < end) 369 get_clock() < end)
394 cpu_relax(); 370 cpu_relax();
395 } 371 }
@@ -425,7 +401,7 @@ void smp_send_stop(void)
425 /* stop all processors */ 401 /* stop all processors */
426 for_each_cpu(cpu, &cpumask) { 402 for_each_cpu(cpu, &cpumask) {
427 struct pcpu *pcpu = pcpu_devices + cpu; 403 struct pcpu *pcpu = pcpu_devices + cpu;
428 pcpu_sigp_retry(pcpu, sigp_stop, 0); 404 pcpu_sigp_retry(pcpu, SIGP_STOP, 0);
429 while (!pcpu_stopped(pcpu)) 405 while (!pcpu_stopped(pcpu))
430 cpu_relax(); 406 cpu_relax();
431 } 407 }
@@ -436,7 +412,7 @@ void smp_send_stop(void)
436 */ 412 */
437void smp_stop_cpu(void) 413void smp_stop_cpu(void)
438{ 414{
439 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), sigp_stop, 0); 415 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), SIGP_STOP, 0);
440 for (;;) ; 416 for (;;) ;
441} 417}
442 418
@@ -590,7 +566,7 @@ static void __init smp_get_save_area(int cpu, u16 address)
590 } 566 }
591#endif 567#endif
592 /* Get the registers of a non-boot cpu. */ 568 /* Get the registers of a non-boot cpu. */
593 __pcpu_sigp_relax(address, sigp_stop_and_store_status, 0, NULL); 569 __pcpu_sigp_relax(address, SIGP_STOP_AND_STORE_STATUS, 0, NULL);
594 memcpy_real(save_area, lc + SAVE_AREA_BASE, sizeof(*save_area)); 570 memcpy_real(save_area, lc + SAVE_AREA_BASE, sizeof(*save_area));
595} 571}
596 572
@@ -599,8 +575,8 @@ int smp_store_status(int cpu)
599 struct pcpu *pcpu; 575 struct pcpu *pcpu;
600 576
601 pcpu = pcpu_devices + cpu; 577 pcpu = pcpu_devices + cpu;
602 if (__pcpu_sigp_relax(pcpu->address, sigp_stop_and_store_status, 578 if (__pcpu_sigp_relax(pcpu->address, SIGP_STOP_AND_STORE_STATUS,
603 0, NULL) != sigp_order_code_accepted) 579 0, NULL) != SIGP_CC_ORDER_CODE_ACCEPTED)
604 return -EIO; 580 return -EIO;
605 return 0; 581 return 0;
606} 582}
@@ -621,8 +597,8 @@ static struct sclp_cpu_info *smp_get_cpu_info(void)
621 if (info && (use_sigp_detection || sclp_get_cpu_info(info))) { 597 if (info && (use_sigp_detection || sclp_get_cpu_info(info))) {
622 use_sigp_detection = 1; 598 use_sigp_detection = 1;
623 for (address = 0; address <= MAX_CPU_ADDRESS; address++) { 599 for (address = 0; address <= MAX_CPU_ADDRESS; address++) {
624 if (__pcpu_sigp_relax(address, sigp_sense, 0, NULL) == 600 if (__pcpu_sigp_relax(address, SIGP_SENSE, 0, NULL) ==
625 sigp_not_operational) 601 SIGP_CC_NOT_OPERATIONAL)
626 continue; 602 continue;
627 info->cpu[info->configured].address = address; 603 info->cpu[info->configured].address = address;
628 info->configured++; 604 info->configured++;
@@ -734,8 +710,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
734 pcpu = pcpu_devices + cpu; 710 pcpu = pcpu_devices + cpu;
735 if (pcpu->state != CPU_STATE_CONFIGURED) 711 if (pcpu->state != CPU_STATE_CONFIGURED)
736 return -EIO; 712 return -EIO;
737 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != 713 if (pcpu_sigp_retry(pcpu, SIGP_INITIAL_CPU_RESET, 0) !=
738 sigp_order_code_accepted) 714 SIGP_CC_ORDER_CODE_ACCEPTED)
739 return -EIO; 715 return -EIO;
740 716
741 rc = pcpu_alloc_lowcore(pcpu, cpu); 717 rc = pcpu_alloc_lowcore(pcpu, cpu);
@@ -795,7 +771,7 @@ void __cpu_die(unsigned int cpu)
795void __noreturn cpu_die(void) 771void __noreturn cpu_die(void)
796{ 772{
797 idle_task_exit(); 773 idle_task_exit();
798 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), sigp_stop, 0); 774 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), SIGP_STOP, 0);
799 for (;;) ; 775 for (;;) ;
800} 776}
801 777