]> bbs.cooldavid.org Git - net-next-2.6.git/blob - arch/s390/kernel/switch_cpu.S
[S390] smp: always reboot on cpu 0
[net-next-2.6.git] / arch / s390 / kernel / switch_cpu.S
1 /*
2  * 31-bit switch cpu code
3  *
4  * Copyright IBM Corp. 2009
5  *
6  */
7
8 #include <asm/asm-offsets.h>
9 #include <asm/lowcore.h>
10 #include <asm/ptrace.h>
11
12 # smp_switch_to_cpu switches to destination cpu and executes the passed function
13 # Parameter: %r2 - function to call
14 #            %r3 - function parameter
15 #            %r4 - stack poiner
16 #            %r5 - current cpu
17 #            %r6 - destination cpu
18
19         .section .text
20         .align 4
21         .globl smp_switch_to_cpu
22 smp_switch_to_cpu:
23         stm     %r6,%r15,__SF_GPRS(%r15)
24         lr      %r1,%r15
25         ahi     %r15,-STACK_FRAME_OVERHEAD
26         st      %r1,__SF_BACKCHAIN(%r15)
27         basr    %r13,0
28 0:      la      %r1,.gprregs_addr-0b(%r13)
29         l       %r1,0(%r1)
30         stm     %r0,%r15,0(%r1)
31 1:      sigp    %r0,%r6,__SIGP_RESTART  /* start destination CPU */
32         brc     2,1b                    /* busy, try again */
33 2:      sigp    %r0,%r5,__SIGP_STOP     /* stop current CPU */
34         brc     2,2b                    /* busy, try again */
35 3:      j       3b
36
37         .globl  smp_restart_cpu
38 smp_restart_cpu:
39         basr    %r13,0
40 0:      la      %r1,.gprregs_addr-0b(%r13)
41         l       %r1,0(%r1)
42         lm      %r0,%r15,0(%r1)
43 1:      sigp    %r0,%r5,__SIGP_SENSE    /* Wait for calling CPU */
44         brc     10,1b                   /* busy, accepted (status 0), running */
45         tmll    %r0,0x40                /* Test if calling CPU is stopped */
46         jz      1b
47         ltr     %r4,%r4                 /* New stack ? */
48         jz      1f
49         lr      %r15,%r4
50 1:      basr    %r14,%r2
51
52 .gprregs_addr:
53         .long   .gprregs
54
55         .section .data,"aw",@progbits
56 .gprregs:
57         .rept   16
58         .long   0
59         .endr