Skip to content

Commit

Permalink
s390/sigp: use sigp order code defines in assembly code
Browse files Browse the repository at this point in the history
Use sigp order code defines in assembly code as well.
With this change all places that use sigp constants should
have been converted to use self describing defines instead
of directly using constants.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Jun 5, 2012
1 parent a095a8a commit eb54619
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 21 deletions.
3 changes: 2 additions & 1 deletion arch/s390/kernel/base.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/ptrace.h>
#include <asm/sigp.h>

#ifdef CONFIG_64BIT

Expand Down Expand Up @@ -100,7 +101,7 @@ ENTRY(diag308_reset)
.Lrestart_part2:
lhi %r0,0 # Load r0 with zero
lhi %r1,2 # Use mode 2 = ESAME (dump)
sigp %r1,%r0,0x12 # Switch to ESAME mode
sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to ESAME mode
sam64 # Switch to 64 bit addressing mode
larl %r4,.Lctlregs # Restore control registers
lctlg %c0,%c15,0(%r4)
Expand Down
5 changes: 3 additions & 2 deletions arch/s390/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#include <asm/page.h>
#include <asm/sigp.h>

__PT_R0 = __PT_GPRS
__PT_R1 = __PT_GPRS + 4
Expand Down Expand Up @@ -726,12 +727,12 @@ ENTRY(restart_int_handler)
lm %r1,%r3,__LC_RESTART_FN # load fn, parm & source cpu
ltr %r3,%r3 # test source cpu address
jm 1f # negative -> skip source stop
0: sigp %r4,%r3,1 # sigp sense to source cpu
0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
brc 10,0b # wait for status stored
1: basr %r14,%r1 # call function
stap __SF_EMPTY(%r15) # store cpu address
lh %r3,__SF_EMPTY(%r15)
2: sigp %r4,%r3,5 # sigp stop to current cpu
2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
brc 2,2b
3: j 3b

Expand Down
5 changes: 3 additions & 2 deletions arch/s390/kernel/entry64.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#include <asm/page.h>
#include <asm/sigp.h>

__PT_R0 = __PT_GPRS
__PT_R1 = __PT_GPRS + 8
Expand Down Expand Up @@ -753,12 +754,12 @@ ENTRY(restart_int_handler)
lmg %r1,%r3,__LC_RESTART_FN # load fn, parm & source cpu
ltgr %r3,%r3 # test source cpu address
jm 1f # negative -> skip source stop
0: sigp %r4,%r3,1 # sigp sense to source cpu
0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
brc 10,0b # wait for status stored
1: basr %r14,%r1 # call function
stap __SF_EMPTY(%r15) # store cpu address
llgh %r3,__SF_EMPTY(%r15)
2: sigp %r4,%r3,5 # sigp stop to current cpu
2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
brc 2,2b
3: j 3b

Expand Down
6 changes: 4 additions & 2 deletions arch/s390/kernel/head_kdump.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
*/

#include <asm/sigp.h>

#define DATAMOVER_ADDR 0x4000
#define COPY_PAGE_ADDR 0x6000

Expand All @@ -19,7 +21,7 @@
.align 2
.Lep_startup_kdump:
lhi %r1,2 # mode 2 = esame (dump)
sigp %r1,%r0,0x12 # Switch to esame mode
sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to esame mode
sam64 # Switch to 64 bit addressing
basr %r13,0
.Lbase:
Expand Down Expand Up @@ -88,7 +90,7 @@ startup_kdump_relocated:
sam31 # Switch to 31 bit addr mode
sr %r1,%r1 # Erase register r1
sr %r2,%r2 # Erase register r2
sigp %r1,%r2,0x12 # Switch to 31 bit arch mode
sigp %r1,%r2,SIGP_SET_ARCHITECTURE # Switch to 31 bit arch mode
lpsw 0 # Start new kernel...
.align 8
.Lrestart_psw:
Expand Down
3 changes: 2 additions & 1 deletion arch/s390/kernel/reipl.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/sigp.h>

#
# store_status: Empty implementation until kdump is supported on 31 bit
Expand Down Expand Up @@ -60,7 +61,7 @@ ENTRY(do_reipl_asm)
bas %r14,.Ldisab-.Lpg0(%r13)
.L003: st %r1,__LC_SUBCHANNEL_ID
lpsw 0
sigp 0,0,0(6)
sigp 0,0,SIGP_RESTART
.Ldisab: st %r14,.Ldispsw+4-.Lpg0(%r13)
lpsw .Ldispsw-.Lpg0(%r13)
.align 8
Expand Down
3 changes: 2 additions & 1 deletion arch/s390/kernel/reipl64.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/sigp.h>

#
# store_status
Expand Down Expand Up @@ -106,7 +107,7 @@ ENTRY(do_reipl_asm)
.L003: st %r1,__LC_SUBCHANNEL_ID
lhi %r1,0 # mode 0 = esa
slr %r0,%r0 # set cpuid to zero
sigp %r1,%r0,0x12 # switch to esa mode
sigp %r1,%r0,SIGP_SET_ARCHITECTURE # switch to esa mode
lpsw 0
.Ldisab: sll %r14,1
srl %r14,1 # need to kill hi bit to avoid specification exceptions.
Expand Down
3 changes: 2 additions & 1 deletion arch/s390/kernel/relocate_kernel.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include <linux/linkage.h>
#include <asm/sigp.h>

/*
* moves the new kernel to its destination...
Expand Down Expand Up @@ -93,7 +94,7 @@ ENTRY(relocate_kernel)
.no_diag308:
sr %r1,%r1 # clear %r1
sr %r2,%r2 # clear %r2
sigp %r1,%r2,0x12 # set cpuid to zero
sigp %r1,%r2,SIGP_SET_ARCHITECTURE # set cpuid to zero
lpsw 0 # hopefully start new kernel...

.align 8
Expand Down
5 changes: 3 additions & 2 deletions arch/s390/kernel/relocate_kernel64.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include <linux/linkage.h>
#include <asm/sigp.h>

/*
* moves the new kernel to its destination...
Expand Down Expand Up @@ -45,7 +46,7 @@ ENTRY(relocate_kernel)
diag %r0,%r0,0x308
.back:
lhi %r1,1 # mode 1 = esame
sigp %r1,%r0,0x12 # switch to esame mode
sigp %r1,%r0,SIGP_SET_ARCHITECTURE # switch to esame mode
sam64 # switch to 64 bit addressing mode
basr %r13,0
.back_base:
Expand Down Expand Up @@ -96,7 +97,7 @@ ENTRY(relocate_kernel)
sam31 # 31 bit mode
sr %r1,%r1 # erase register r1
sr %r2,%r2 # erase register r2
sigp %r1,%r2,0x12 # set cpuid to zero
sigp %r1,%r2,SIGP_SET_ARCHITECTURE # set cpuid to zero
lpsw 0 # hopefully start new kernel...

.align 8
Expand Down
8 changes: 5 additions & 3 deletions arch/s390/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,13 @@ static void pcpu_delegate(struct pcpu *pcpu, void (*func)(void *),
/* Restart func on the target cpu and stop the current cpu. */
memcpy_absolute(&lc->restart_stack, &restart, sizeof(restart));
asm volatile(
"0: sigp 0,%0,6 # sigp restart to target cpu\n"
"0: sigp 0,%0,%2 # sigp restart to target cpu\n"
" brc 2,0b # busy, try again\n"
"1: sigp 0,%1,5 # sigp stop to current cpu\n"
"1: sigp 0,%1,%3 # sigp stop to current cpu\n"
" brc 2,1b # busy, try again\n"
: : "d" (pcpu->address), "d" (restart.source) : "0", "1", "cc");
: : "d" (pcpu->address), "d" (restart.source),
"K" (SIGP_RESTART), "K" (SIGP_STOP)
: "0", "1", "cc");
for (;;) ;
}

Expand Down
13 changes: 7 additions & 6 deletions arch/s390/kernel/swsusp_asm64.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <asm/ptrace.h>
#include <asm/thread_info.h>
#include <asm/asm-offsets.h>
#include <asm/sigp.h>

/*
* Save register context in absolute 0 lowcore and call swsusp_save() to
Expand Down Expand Up @@ -163,7 +164,7 @@ ENTRY(swsusp_arch_resume)
diag %r0,%r0,0x308
restart_entry:
lhi %r1,1
sigp %r1,%r0,0x12
sigp %r1,%r0,SIGP_SET_ARCHITECTURE
sam64
larl %r1,.Lnew_pgm_check_psw
lpswe 0(%r1)
Expand All @@ -179,7 +180,7 @@ pgm_check_entry:
larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
mvc __LC_RST_NEW_PSW(16,%r0),0(%r4)
3:
sigp %r9,%r1,11 /* sigp initial cpu reset */
sigp %r9,%r1,SIGP_INITIAL_CPU_RESET /* sigp initial cpu reset */
brc 8,4f /* accepted */
brc 2,3b /* busy, try again */

Expand All @@ -190,24 +191,24 @@ pgm_check_entry:
larl %r3,_sclp_print_early
lghi %r1,0
sam31
sigp %r1,%r0,0x12
sigp %r1,%r0,SIGP_SET_ARCHITECTURE
basr %r14,%r3
larl %r3,.Ldisabled_wait_31
lpsw 0(%r3)
4:
/* Switch to suspend CPU */
sigp %r9,%r1,6 /* sigp restart to suspend CPU */
sigp %r9,%r1,SIGP_RESTART /* sigp restart to suspend CPU */
brc 2,4b /* busy, try again */
5:
sigp %r9,%r2,5 /* sigp stop to current resume CPU */
sigp %r9,%r2,SIGP_STOP /* sigp stop to current resume CPU */
brc 2,5b /* busy, try again */
6: j 6b

restart_suspend:
larl %r1,.Lresume_cpu
llgh %r2,0(%r1)
7:
sigp %r9,%r2,1 /* sigp sense, wait for resume CPU */
sigp %r9,%r2,SIGP_SENSE /* sigp sense, wait for resume CPU */
brc 8,7b /* accepted, status 0, still running */
brc 2,7b /* busy, try again */
tmll %r9,0x40 /* Test if resume CPU is stopped */
Expand Down

0 comments on commit eb54619

Please sign in to comment.