aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/asm-offsets.c12
-rw-r--r--arch/s390/kernel/base.S5
-rw-r--r--arch/s390/kernel/bitmap.c2
-rw-r--r--arch/s390/kernel/compat_exec_domain.c2
-rw-r--r--arch/s390/kernel/compat_linux.c4
-rw-r--r--arch/s390/kernel/compat_signal.c4
-rw-r--r--arch/s390/kernel/compat_wrapper.S3
-rw-r--r--arch/s390/kernel/cpcmd.c4
-rw-r--r--arch/s390/kernel/crash.c4
-rw-r--r--arch/s390/kernel/debug.c1
-rw-r--r--arch/s390/kernel/dis.c3
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/ebcdic.c3
-rw-r--r--arch/s390/kernel/entry.S49
-rw-r--r--arch/s390/kernel/entry.h4
-rw-r--r--arch/s390/kernel/entry64.S52
-rw-r--r--arch/s390/kernel/head.S2
-rw-r--r--arch/s390/kernel/head31.S4
-rw-r--r--arch/s390/kernel/head64.S4
-rw-r--r--arch/s390/kernel/head_kdump.S6
-rw-r--r--arch/s390/kernel/ipl.c16
-rw-r--r--arch/s390/kernel/irq.c2
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/s390/kernel/lgr.c15
-rw-r--r--arch/s390/kernel/machine_kexec.c4
-rw-r--r--arch/s390/kernel/mcount.S2
-rw-r--r--arch/s390/kernel/mcount64.S2
-rw-r--r--arch/s390/kernel/module.c5
-rw-r--r--arch/s390/kernel/nmi.c2
-rw-r--r--arch/s390/kernel/os_info.c2
-rw-r--r--arch/s390/kernel/process.c4
-rw-r--r--arch/s390/kernel/processor.c6
-rw-r--r--arch/s390/kernel/ptrace.c2
-rw-r--r--arch/s390/kernel/reipl.S7
-rw-r--r--arch/s390/kernel/reipl64.S5
-rw-r--r--arch/s390/kernel/relocate_kernel.S7
-rw-r--r--arch/s390/kernel/relocate_kernel64.S9
-rw-r--r--arch/s390/kernel/sclp.S2
-rw-r--r--arch/s390/kernel/setup.c29
-rw-r--r--arch/s390/kernel/signal.c4
-rw-r--r--arch/s390/kernel/smp.c116
-rw-r--r--arch/s390/kernel/stacktrace.c4
-rw-r--r--arch/s390/kernel/swsusp_asm64.S13
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--arch/s390/kernel/time.c3
-rw-r--r--arch/s390/kernel/topology.c2
-rw-r--r--arch/s390/kernel/traps.c4
-rw-r--r--arch/s390/kernel/vtime.c370
48 files changed, 311 insertions, 502 deletions
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 83e6edf5cf17..45ef1a7b08f9 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -9,7 +9,6 @@
9#include <linux/kbuild.h> 9#include <linux/kbuild.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <asm/cputime.h> 11#include <asm/cputime.h>
12#include <asm/timer.h>
13#include <asm/vdso.h> 12#include <asm/vdso.h>
14#include <asm/pgtable.h> 13#include <asm/pgtable.h>
15 14
@@ -72,11 +71,10 @@ int main(void)
72 DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 71 DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
73 BLANK(); 72 BLANK();
74 /* idle data offsets */ 73 /* idle data offsets */
75 DEFINE(__IDLE_ENTER, offsetof(struct s390_idle_data, idle_enter)); 74 DEFINE(__CLOCK_IDLE_ENTER, offsetof(struct s390_idle_data, clock_idle_enter));
76 DEFINE(__IDLE_EXIT, offsetof(struct s390_idle_data, idle_exit)); 75 DEFINE(__CLOCK_IDLE_EXIT, offsetof(struct s390_idle_data, clock_idle_exit));
77 /* vtimer queue offsets */ 76 DEFINE(__TIMER_IDLE_ENTER, offsetof(struct s390_idle_data, timer_idle_enter));
78 DEFINE(__VQ_IDLE_ENTER, offsetof(struct vtimer_queue, idle_enter)); 77 DEFINE(__TIMER_IDLE_EXIT, offsetof(struct s390_idle_data, timer_idle_exit));
79 DEFINE(__VQ_IDLE_EXIT, offsetof(struct vtimer_queue, idle_exit));
80 /* lowcore offsets */ 78 /* lowcore offsets */
81 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params)); 79 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params));
82 DEFINE(__LC_EXT_CPU_ADDR, offsetof(struct _lowcore, ext_cpu_addr)); 80 DEFINE(__LC_EXT_CPU_ADDR, offsetof(struct _lowcore, ext_cpu_addr));
@@ -131,6 +129,8 @@ int main(void)
131 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack)); 129 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
132 DEFINE(__LC_RESTART_STACK, offsetof(struct _lowcore, restart_stack)); 130 DEFINE(__LC_RESTART_STACK, offsetof(struct _lowcore, restart_stack));
133 DEFINE(__LC_RESTART_FN, offsetof(struct _lowcore, restart_fn)); 131 DEFINE(__LC_RESTART_FN, offsetof(struct _lowcore, restart_fn));
132 DEFINE(__LC_RESTART_DATA, offsetof(struct _lowcore, restart_data));
133 DEFINE(__LC_RESTART_SOURCE, offsetof(struct _lowcore, restart_source));
134 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce)); 134 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
135 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock)); 135 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
136 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock)); 136 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock));
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S
index c880ff72db44..797a823a2275 100644
--- a/arch/s390/kernel/base.S
+++ b/arch/s390/kernel/base.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/base.S 2 * arch/s390/kernel/base.S
3 * 3 *
4 * Copyright IBM Corp. 2006,2007 4 * Copyright IBM Corp. 2006, 2007
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> 5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 * Michael Holzheu <holzheu@de.ibm.com> 6 * Michael Holzheu <holzheu@de.ibm.com>
7 */ 7 */
@@ -9,6 +9,7 @@
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <asm/asm-offsets.h> 10#include <asm/asm-offsets.h>
11#include <asm/ptrace.h> 11#include <asm/ptrace.h>
12#include <asm/sigp.h>
12 13
13#ifdef CONFIG_64BIT 14#ifdef CONFIG_64BIT
14 15
@@ -100,7 +101,7 @@ ENTRY(diag308_reset)
100.Lrestart_part2: 101.Lrestart_part2:
101 lhi %r0,0 # Load r0 with zero 102 lhi %r0,0 # Load r0 with zero
102 lhi %r1,2 # Use mode 2 = ESAME (dump) 103 lhi %r1,2 # Use mode 2 = ESAME (dump)
103 sigp %r1,%r0,0x12 # Switch to ESAME mode 104 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to ESAME mode
104 sam64 # Switch to 64 bit addressing mode 105 sam64 # Switch to 64 bit addressing mode
105 larl %r4,.Lctlregs # Restore control registers 106 larl %r4,.Lctlregs # Restore control registers
106 lctlg %c0,%c15,0(%r4) 107 lctlg %c0,%c15,0(%r4)
diff --git a/arch/s390/kernel/bitmap.c b/arch/s390/kernel/bitmap.c
index 3ae4757b006a..102da5e23037 100644
--- a/arch/s390/kernel/bitmap.c
+++ b/arch/s390/kernel/bitmap.c
@@ -2,7 +2,7 @@
2 * Bitmaps for set_bit, clear_bit, test_and_set_bit, ... 2 * Bitmaps for set_bit, clear_bit, test_and_set_bit, ...
3 * See include/asm/{bitops.h|posix_types.h} for details 3 * See include/asm/{bitops.h|posix_types.h} for details
4 * 4 *
5 * Copyright IBM Corp. 1999,2009 5 * Copyright IBM Corp. 1999, 2009
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>, 6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 */ 7 */
8 8
diff --git a/arch/s390/kernel/compat_exec_domain.c b/arch/s390/kernel/compat_exec_domain.c
index 914d49444f92..765fabdada9f 100644
--- a/arch/s390/kernel/compat_exec_domain.c
+++ b/arch/s390/kernel/compat_exec_domain.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Support for 32-bit Linux for S390 personality. 2 * Support for 32-bit Linux for S390 personality.
3 * 3 *
4 * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 4 * Copyright IBM Corp. 2000
5 * Author(s): Gerhard Tonn (ton@de.ibm.com) 5 * Author(s): Gerhard Tonn (ton@de.ibm.com)
6 * 6 *
7 * 7 *
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 65426525d9f2..d1225089a4bb 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * arch/s390x/kernel/linux32.c
3 *
4 * S390 version 2 * S390 version
5 * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 3 * Copyright IBM Corp. 2000
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Gerhard Tonn (ton@de.ibm.com) 5 * Gerhard Tonn (ton@de.ibm.com)
8 * Thomas Spatzier (tspat@de.ibm.com) 6 * Thomas Spatzier (tspat@de.ibm.com)
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 3c0c19830c37..a1e8a8694bb7 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/compat_signal.c 2 * Copyright IBM Corp. 2000, 2006
3 *
4 * Copyright (C) IBM Corp. 2000,2006
5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 3 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
6 * Gerhard Tonn (ton@de.ibm.com) 4 * Gerhard Tonn (ton@de.ibm.com)
7 * 5 *
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ff605a39cf43..e835d6d5b7fd 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1,8 +1,7 @@
1/* 1/*
2* arch/s390/kernel/compat_wrapper.S
3* wrapper for 31 bit compatible system calls. 2* wrapper for 31 bit compatible system calls.
4* 3*
5* Copyright (C) IBM Corp. 2000,2006 4* Copyright IBM Corp. 2000, 2006
6* Author(s): Gerhard Tonn (ton@de.ibm.com), 5* Author(s): Gerhard Tonn (ton@de.ibm.com),
7* Thomas Spatzier (tspat@de.ibm.com) 6* Thomas Spatzier (tspat@de.ibm.com)
8*/ 7*/
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index e3dd886e1b32..d7b0c4d27880 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * arch/s390/kernel/cpcmd.c
3 *
4 * S390 version 2 * S390 version
5 * Copyright IBM Corp. 1999,2007 3 * Copyright IBM Corp. 1999, 2007
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Christian Borntraeger (cborntra@de.ibm.com), 5 * Christian Borntraeger (cborntra@de.ibm.com),
8 */ 6 */
diff --git a/arch/s390/kernel/crash.c b/arch/s390/kernel/crash.c
index 8cc7c9fa64f5..3819153de8bd 100644
--- a/arch/s390/kernel/crash.c
+++ b/arch/s390/kernel/crash.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/crash.c 2 * Copyright IBM Corp. 2005
3 *
4 * (C) Copyright IBM Corp. 2005
5 * 3 *
6 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> 4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
7 * 5 *
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 19e5e9eba546..21be961e8a43 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * arch/s390/kernel/debug.c
3 * S/390 debug facility 2 * S/390 debug facility
4 * 3 *
5 * Copyright IBM Corp. 1999, 2012 4 * Copyright IBM Corp. 1999, 2012
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 3221c6fca8bb..1f6b428e2762 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/s390/kernel/dis.c
3 *
4 * Disassemble s390 instructions. 2 * Disassemble s390 instructions.
5 * 3 *
6 * Copyright IBM Corp. 2007 4 * Copyright IBM Corp. 2007
@@ -613,6 +611,7 @@ static struct insn opcode_b2[] = {
613 { "sie", 0x14, INSTR_S_RD }, 611 { "sie", 0x14, INSTR_S_RD },
614 { "pc", 0x18, INSTR_S_RD }, 612 { "pc", 0x18, INSTR_S_RD },
615 { "sac", 0x19, INSTR_S_RD }, 613 { "sac", 0x19, INSTR_S_RD },
614 { "servc", 0x20, INSTR_RRE_RR },
616 { "cfc", 0x1a, INSTR_S_RD }, 615 { "cfc", 0x1a, INSTR_S_RD },
617 { "ipte", 0x21, INSTR_RRE_RR }, 616 { "ipte", 0x21, INSTR_RRE_RR },
618 { "ipm", 0x22, INSTR_RRE_R0 }, 617 { "ipm", 0x22, INSTR_RRE_R0 },
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 6684fff17558..bc95a8ebd9cc 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/s390/kernel/early.c
3 *
4 * Copyright IBM Corp. 2007, 2009 2 * Copyright IBM Corp. 2007, 2009
5 * Author(s): Hongjie Yang <hongjie@us.ibm.com>, 3 * Author(s): Hongjie Yang <hongjie@us.ibm.com>,
6 * Heiko Carstens <heiko.carstens@de.ibm.com> 4 * Heiko Carstens <heiko.carstens@de.ibm.com>
diff --git a/arch/s390/kernel/ebcdic.c b/arch/s390/kernel/ebcdic.c
index cc0dc609d738..b971c6be6298 100644
--- a/arch/s390/kernel/ebcdic.c
+++ b/arch/s390/kernel/ebcdic.c
@@ -1,10 +1,9 @@
1/* 1/*
2 * arch/s390/kernel/ebcdic.c
3 * ECBDIC -> ASCII, ASCII -> ECBDIC, 2 * ECBDIC -> ASCII, ASCII -> ECBDIC,
4 * upper to lower case (EBCDIC) conversion tables. 3 * upper to lower case (EBCDIC) conversion tables.
5 * 4 *
6 * S390 version 5 * S390 version
7 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 6 * Copyright IBM Corp. 1999
8 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 7 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
9 * Martin Peschke <peschke@fh-brandenburg.de> 8 * Martin Peschke <peschke@fh-brandenburg.de>
10 */ 9 */
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 1ae93b573d7d..870bad6d56fc 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/entry.S
3 * S390 low-level entry points. 2 * S390 low-level entry points.
4 * 3 *
5 * Copyright (C) IBM Corp. 1999,2012 4 * Copyright IBM Corp. 1999, 2012
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Hartmut Penner (hp@de.ibm.com), 6 * Hartmut Penner (hp@de.ibm.com),
8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 7 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
@@ -18,6 +17,7 @@
18#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
19#include <asm/unistd.h> 18#include <asm/unistd.h>
20#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/sigp.h>
21 21
22__PT_R0 = __PT_GPRS 22__PT_R0 = __PT_GPRS
23__PT_R1 = __PT_GPRS + 4 23__PT_R1 = __PT_GPRS + 4
@@ -616,17 +616,13 @@ ext_skip:
616 * Load idle PSW. The second "half" of this function is in cleanup_idle. 616 * Load idle PSW. The second "half" of this function is in cleanup_idle.
617 */ 617 */
618ENTRY(psw_idle) 618ENTRY(psw_idle)
619 st %r4,__SF_EMPTY(%r15) 619 st %r3,__SF_EMPTY(%r15)
620 basr %r1,0 620 basr %r1,0
621 la %r1,psw_idle_lpsw+4-.(%r1) 621 la %r1,psw_idle_lpsw+4-.(%r1)
622 st %r1,__SF_EMPTY+4(%r15) 622 st %r1,__SF_EMPTY+4(%r15)
623 oi __SF_EMPTY+4(%r15),0x80 623 oi __SF_EMPTY+4(%r15),0x80
624 la %r1,.Lvtimer_max-psw_idle_lpsw-4(%r1) 624 stck __CLOCK_IDLE_ENTER(%r2)
625 stck __IDLE_ENTER(%r2) 625 stpt __TIMER_IDLE_ENTER(%r2)
626 ltr %r5,%r5
627 stpt __VQ_IDLE_ENTER(%r3)
628 jz psw_idle_lpsw
629 spt 0(%r1)
630psw_idle_lpsw: 626psw_idle_lpsw:
631 lpsw __SF_EMPTY(%r15) 627 lpsw __SF_EMPTY(%r15)
632 br %r14 628 br %r14
@@ -723,15 +719,17 @@ ENTRY(restart_int_handler)
723 mvc __PT_PSW(8,%r15),__LC_RST_OLD_PSW # store restart old psw 719 mvc __PT_PSW(8,%r15),__LC_RST_OLD_PSW # store restart old psw
724 ahi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack 720 ahi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack
725 xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15) 721 xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
726 lm %r1,%r3,__LC_RESTART_FN # load fn, parm & source cpu 722 l %r1,__LC_RESTART_FN # load fn, parm & source cpu
723 l %r2,__LC_RESTART_DATA
724 l %r3,__LC_RESTART_SOURCE
727 ltr %r3,%r3 # test source cpu address 725 ltr %r3,%r3 # test source cpu address
728 jm 1f # negative -> skip source stop 726 jm 1f # negative -> skip source stop
7290: sigp %r4,%r3,1 # sigp sense to source cpu 7270: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
730 brc 10,0b # wait for status stored 728 brc 10,0b # wait for status stored
7311: basr %r14,%r1 # call function 7291: basr %r14,%r1 # call function
732 stap __SF_EMPTY(%r15) # store cpu address 730 stap __SF_EMPTY(%r15) # store cpu address
733 lh %r3,__SF_EMPTY(%r15) 731 lh %r3,__SF_EMPTY(%r15)
7342: sigp %r4,%r3,5 # sigp stop to current cpu 7322: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
735 brc 2,2b 733 brc 2,2b
7363: j 3b 7343: j 3b
737 735
@@ -883,33 +881,28 @@ cleanup_io_restore_insn:
883 881
884cleanup_idle: 882cleanup_idle:
885 # copy interrupt clock & cpu timer 883 # copy interrupt clock & cpu timer
886 mvc __IDLE_EXIT(8,%r2),__LC_INT_CLOCK 884 mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_INT_CLOCK
887 mvc __VQ_IDLE_EXIT(8,%r3),__LC_ASYNC_ENTER_TIMER 885 mvc __TIMER_IDLE_EXIT(8,%r2),__LC_ASYNC_ENTER_TIMER
888 chi %r11,__LC_SAVE_AREA_ASYNC 886 chi %r11,__LC_SAVE_AREA_ASYNC
889 je 0f 887 je 0f
890 mvc __IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK 888 mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK
891 mvc __VQ_IDLE_EXIT(8,%r3),__LC_MCCK_ENTER_TIMER 889 mvc __TIMER_IDLE_EXIT(8,%r2),__LC_MCCK_ENTER_TIMER
8920: # check if stck has been executed 8900: # check if stck has been executed
893 cl %r9,BASED(cleanup_idle_insn) 891 cl %r9,BASED(cleanup_idle_insn)
894 jhe 1f 892 jhe 1f
895 mvc __IDLE_ENTER(8,%r2),__IDLE_EXIT(%r2) 893 mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2)
896 mvc __VQ_IDLE_ENTER(8,%r3),__VQ_IDLE_EXIT(%r3) 894 mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r3)
897 j 2f 8951: # account system time going idle
8981: # check if the cpu timer has been reprogrammed
899 ltr %r5,%r5
900 jz 2f
901 spt __VQ_IDLE_ENTER(%r3)
9022: # account system time going idle
903 lm %r9,%r10,__LC_STEAL_TIMER 896 lm %r9,%r10,__LC_STEAL_TIMER
904 ADD64 %r9,%r10,__IDLE_ENTER(%r2) 897 ADD64 %r9,%r10,__CLOCK_IDLE_ENTER(%r2)
905 SUB64 %r9,%r10,__LC_LAST_UPDATE_CLOCK 898 SUB64 %r9,%r10,__LC_LAST_UPDATE_CLOCK
906 stm %r9,%r10,__LC_STEAL_TIMER 899 stm %r9,%r10,__LC_STEAL_TIMER
907 mvc __LC_LAST_UPDATE_CLOCK(8),__IDLE_EXIT(%r2) 900 mvc __LC_LAST_UPDATE_CLOCK(8),__CLOCK_IDLE_EXIT(%r2)
908 lm %r9,%r10,__LC_SYSTEM_TIMER 901 lm %r9,%r10,__LC_SYSTEM_TIMER
909 ADD64 %r9,%r10,__LC_LAST_UPDATE_TIMER 902 ADD64 %r9,%r10,__LC_LAST_UPDATE_TIMER
910 SUB64 %r9,%r10,__VQ_IDLE_ENTER(%r3) 903 SUB64 %r9,%r10,__TIMER_IDLE_ENTER(%r2)
911 stm %r9,%r10,__LC_SYSTEM_TIMER 904 stm %r9,%r10,__LC_SYSTEM_TIMER
912 mvc __LC_LAST_UPDATE_TIMER(8),__VQ_IDLE_EXIT(%r3) 905 mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2)
913 # prepare return psw 906 # prepare return psw
914 n %r8,BASED(cleanup_idle_wait) # clear wait state bit 907 n %r8,BASED(cleanup_idle_wait) # clear wait state bit
915 l %r9,24(%r11) # return from psw_idle 908 l %r9,24(%r11) # return from psw_idle
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index f66a229ab0b3..a5f4dc42a5db 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -5,7 +5,6 @@
5#include <linux/signal.h> 5#include <linux/signal.h>
6#include <asm/ptrace.h> 6#include <asm/ptrace.h>
7#include <asm/cputime.h> 7#include <asm/cputime.h>
8#include <asm/timer.h>
9 8
10extern void (*pgm_check_table[128])(struct pt_regs *); 9extern void (*pgm_check_table[128])(struct pt_regs *);
11extern void *restart_stack; 10extern void *restart_stack;
@@ -17,8 +16,7 @@ void io_int_handler(void);
17void mcck_int_handler(void); 16void mcck_int_handler(void);
18void restart_int_handler(void); 17void restart_int_handler(void);
19void restart_call_handler(void); 18void restart_call_handler(void);
20void psw_idle(struct s390_idle_data *, struct vtimer_queue *, 19void psw_idle(struct s390_idle_data *, unsigned long);
21 unsigned long, int);
22 20
23asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 21asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
24asmlinkage void do_syscall_trace_exit(struct pt_regs *regs); 22asmlinkage void do_syscall_trace_exit(struct pt_regs *regs);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 229fe1d07749..349b7eeb348a 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/entry64.S
3 * S390 low-level entry points. 2 * S390 low-level entry points.
4 * 3 *
5 * Copyright (C) IBM Corp. 1999,2012 4 * Copyright IBM Corp. 1999, 2012
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Hartmut Penner (hp@de.ibm.com), 6 * Hartmut Penner (hp@de.ibm.com),
8 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 7 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
@@ -18,6 +17,7 @@
18#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
19#include <asm/unistd.h> 18#include <asm/unistd.h>
20#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/sigp.h>
21 21
22__PT_R0 = __PT_GPRS 22__PT_R0 = __PT_GPRS
23__PT_R1 = __PT_GPRS + 8 23__PT_R1 = __PT_GPRS + 8
@@ -642,15 +642,11 @@ ext_skip:
642 * Load idle PSW. The second "half" of this function is in cleanup_idle. 642 * Load idle PSW. The second "half" of this function is in cleanup_idle.
643 */ 643 */
644ENTRY(psw_idle) 644ENTRY(psw_idle)
645 stg %r4,__SF_EMPTY(%r15) 645 stg %r3,__SF_EMPTY(%r15)
646 larl %r1,psw_idle_lpsw+4 646 larl %r1,psw_idle_lpsw+4
647 stg %r1,__SF_EMPTY+8(%r15) 647 stg %r1,__SF_EMPTY+8(%r15)
648 larl %r1,.Lvtimer_max 648 STCK __CLOCK_IDLE_ENTER(%r2)
649 STCK __IDLE_ENTER(%r2) 649 stpt __TIMER_IDLE_ENTER(%r2)
650 ltr %r5,%r5
651 stpt __VQ_IDLE_ENTER(%r3)
652 jz psw_idle_lpsw
653 spt 0(%r1)
654psw_idle_lpsw: 650psw_idle_lpsw:
655 lpswe __SF_EMPTY(%r15) 651 lpswe __SF_EMPTY(%r15)
656 br %r14 652 br %r14
@@ -750,15 +746,17 @@ ENTRY(restart_int_handler)
750 mvc __PT_PSW(16,%r15),__LC_RST_OLD_PSW # store restart old psw 746 mvc __PT_PSW(16,%r15),__LC_RST_OLD_PSW # store restart old psw
751 aghi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack 747 aghi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack
752 xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15) 748 xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
753 lmg %r1,%r3,__LC_RESTART_FN # load fn, parm & source cpu 749 lg %r1,__LC_RESTART_FN # load fn, parm & source cpu
750 lg %r2,__LC_RESTART_DATA
751 lg %r3,__LC_RESTART_SOURCE
754 ltgr %r3,%r3 # test source cpu address 752 ltgr %r3,%r3 # test source cpu address
755 jm 1f # negative -> skip source stop 753 jm 1f # negative -> skip source stop
7560: sigp %r4,%r3,1 # sigp sense to source cpu 7540: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
757 brc 10,0b # wait for status stored 755 brc 10,0b # wait for status stored
7581: basr %r14,%r1 # call function 7561: basr %r14,%r1 # call function
759 stap __SF_EMPTY(%r15) # store cpu address 757 stap __SF_EMPTY(%r15) # store cpu address
760 llgh %r3,__SF_EMPTY(%r15) 758 llgh %r3,__SF_EMPTY(%r15)
7612: sigp %r4,%r3,5 # sigp stop to current cpu 7592: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
762 brc 2,2b 760 brc 2,2b
7633: j 3b 7613: j 3b
764 762
@@ -916,33 +914,28 @@ cleanup_io_restore_insn:
916 914
917cleanup_idle: 915cleanup_idle:
918 # copy interrupt clock & cpu timer 916 # copy interrupt clock & cpu timer
919 mvc __IDLE_EXIT(8,%r2),__LC_INT_CLOCK 917 mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_INT_CLOCK
920 mvc __VQ_IDLE_EXIT(8,%r3),__LC_ASYNC_ENTER_TIMER 918 mvc __TIMER_IDLE_EXIT(8,%r2),__LC_ASYNC_ENTER_TIMER
921 cghi %r11,__LC_SAVE_AREA_ASYNC 919 cghi %r11,__LC_SAVE_AREA_ASYNC
922 je 0f 920 je 0f
923 mvc __IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK 921 mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK
924 mvc __VQ_IDLE_EXIT(8,%r3),__LC_MCCK_ENTER_TIMER 922 mvc __TIMER_IDLE_EXIT(8,%r2),__LC_MCCK_ENTER_TIMER
9250: # check if stck & stpt have been executed 9230: # check if stck & stpt have been executed
926 clg %r9,BASED(cleanup_idle_insn) 924 clg %r9,BASED(cleanup_idle_insn)
927 jhe 1f 925 jhe 1f
928 mvc __IDLE_ENTER(8,%r2),__IDLE_EXIT(%r2) 926 mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2)
929 mvc __VQ_IDLE_ENTER(8,%r3),__VQ_IDLE_EXIT(%r3) 927 mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2)
930 j 2f 9281: # account system time going idle
9311: # check if the cpu timer has been reprogrammed
932 ltr %r5,%r5
933 jz 2f
934 spt __VQ_IDLE_ENTER(%r3)
9352: # account system time going idle
936 lg %r9,__LC_STEAL_TIMER 929 lg %r9,__LC_STEAL_TIMER
937 alg %r9,__IDLE_ENTER(%r2) 930 alg %r9,__CLOCK_IDLE_ENTER(%r2)
938 slg %r9,__LC_LAST_UPDATE_CLOCK 931 slg %r9,__LC_LAST_UPDATE_CLOCK
939 stg %r9,__LC_STEAL_TIMER 932 stg %r9,__LC_STEAL_TIMER
940 mvc __LC_LAST_UPDATE_CLOCK(8),__IDLE_EXIT(%r2) 933 mvc __LC_LAST_UPDATE_CLOCK(8),__CLOCK_IDLE_EXIT(%r2)
941 lg %r9,__LC_SYSTEM_TIMER 934 lg %r9,__LC_SYSTEM_TIMER
942 alg %r9,__LC_LAST_UPDATE_TIMER 935 alg %r9,__LC_LAST_UPDATE_TIMER
943 slg %r9,__VQ_IDLE_ENTER(%r3) 936 slg %r9,__TIMER_IDLE_ENTER(%r2)
944 stg %r9,__LC_SYSTEM_TIMER 937 stg %r9,__LC_SYSTEM_TIMER
945 mvc __LC_LAST_UPDATE_TIMER(8),__VQ_IDLE_EXIT(%r3) 938 mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2)
946 # prepare return psw 939 # prepare return psw
947 nihh %r8,0xfffd # clear wait state bit 940 nihh %r8,0xfffd # clear wait state bit
948 lg %r9,48(%r11) # return from psw_idle 941 lg %r9,48(%r11) # return from psw_idle
@@ -958,8 +951,6 @@ cleanup_idle_insn:
958 .quad __critical_start 951 .quad __critical_start
959.Lcritical_length: 952.Lcritical_length:
960 .quad __critical_end - __critical_start 953 .quad __critical_end - __critical_start
961.Lvtimer_max:
962 .quad 0x7fffffffffffffff
963 954
964 955
965#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 956#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
@@ -974,7 +965,6 @@ ENTRY(sie64a)
974 stg %r3,__SF_EMPTY+8(%r15) # save guest register save area 965 stg %r3,__SF_EMPTY+8(%r15) # save guest register save area
975 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0 966 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0
976 lmg %r0,%r13,0(%r3) # load guest gprs 0-13 967 lmg %r0,%r13,0(%r3) # load guest gprs 0-13
977 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
978sie_loop: 968sie_loop:
979 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 969 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
980 tm __TI_flags+7(%r14),_TIF_EXIT_SIE 970 tm __TI_flags+7(%r14),_TIF_EXIT_SIE
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 4939d15375aa..805b6686b641 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 1999,2010 2 * Copyright IBM Corp. 1999, 2010
3 * 3 *
4 * Author(s): Hartmut Penner <hp@de.ibm.com> 4 * Author(s): Hartmut Penner <hp@de.ibm.com>
5 * Martin Schwidefsky <schwidefsky@de.ibm.com> 5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index d3f1ab7d90ad..a1372ae24ae1 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/head31.S 2 * Copyright IBM Corp. 2005, 2010
3 *
4 * Copyright (C) IBM Corp. 2005,2010
5 * 3 *
6 * Author(s): Hartmut Penner <hp@de.ibm.com> 4 * Author(s): Hartmut Penner <hp@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com> 5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 99348c0eaa41..c108af28bbe8 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/head64.S 2 * Copyright IBM Corp. 1999, 2010
3 *
4 * Copyright (C) IBM Corp. 1999,2010
5 * 3 *
6 * Author(s): Hartmut Penner <hp@de.ibm.com> 4 * Author(s): Hartmut Penner <hp@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com> 5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
diff --git a/arch/s390/kernel/head_kdump.S b/arch/s390/kernel/head_kdump.S
index 796c976b5fdc..acaaaf4b7055 100644
--- a/arch/s390/kernel/head_kdump.S
+++ b/arch/s390/kernel/head_kdump.S
@@ -5,6 +5,8 @@
5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com> 5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
6 */ 6 */
7 7
8#include <asm/sigp.h>
9
8#define DATAMOVER_ADDR 0x4000 10#define DATAMOVER_ADDR 0x4000
9#define COPY_PAGE_ADDR 0x6000 11#define COPY_PAGE_ADDR 0x6000
10 12
@@ -19,7 +21,7 @@
19.align 2 21.align 2
20.Lep_startup_kdump: 22.Lep_startup_kdump:
21 lhi %r1,2 # mode 2 = esame (dump) 23 lhi %r1,2 # mode 2 = esame (dump)
22 sigp %r1,%r0,0x12 # Switch to esame mode 24 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to esame mode
23 sam64 # Switch to 64 bit addressing 25 sam64 # Switch to 64 bit addressing
24 basr %r13,0 26 basr %r13,0
25.Lbase: 27.Lbase:
@@ -88,7 +90,7 @@ startup_kdump_relocated:
88 sam31 # Switch to 31 bit addr mode 90 sam31 # Switch to 31 bit addr mode
89 sr %r1,%r1 # Erase register r1 91 sr %r1,%r1 # Erase register r1
90 sr %r2,%r2 # Erase register r2 92 sr %r2,%r2 # Erase register r2
91 sigp %r1,%r2,0x12 # Switch to 31 bit arch mode 93 sigp %r1,%r2,SIGP_SET_ARCHITECTURE # Switch to 31 bit arch mode
92 lpsw 0 # Start new kernel... 94 lpsw 0 # Start new kernel...
93.align 8 95.align 8
94.Lrestart_psw: 96.Lrestart_psw:
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 2f6cfd460cb6..e64d141555ce 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/ipl.c
3 * ipl/reipl/dump support for Linux on s390. 2 * ipl/reipl/dump support for Linux on s390.
4 * 3 *
5 * Copyright IBM Corp. 2005,2012 4 * Copyright IBM Corp. 2005, 2012
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com> 6 * Heiko Carstens <heiko.carstens@de.ibm.com>
8 * Volker Sameske <sameske@de.ibm.com> 7 * Volker Sameske <sameske@de.ibm.com>
@@ -1528,15 +1527,12 @@ static struct shutdown_action __refdata dump_action = {
1528 1527
1529static void dump_reipl_run(struct shutdown_trigger *trigger) 1528static void dump_reipl_run(struct shutdown_trigger *trigger)
1530{ 1529{
1531 struct { 1530 unsigned long ipib = (unsigned long) reipl_block_actual;
1532 void *addr; 1531 unsigned int csum;
1533 __u32 csum;
1534 } __packed ipib;
1535 1532
1536 ipib.csum = csum_partial(reipl_block_actual, 1533 csum = csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0);
1537 reipl_block_actual->hdr.len, 0); 1534 mem_assign_absolute(S390_lowcore.ipib, ipib);
1538 ipib.addr = reipl_block_actual; 1535 mem_assign_absolute(S390_lowcore.ipib_checksum, csum);
1539 memcpy_absolute(&S390_lowcore.ipib, &ipib, sizeof(ipib));
1540 dump_run(trigger); 1536 dump_run(trigger);
1541} 1537}
1542 1538
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index b4f4a7133fa1..dd7630d8aab7 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 2004,2011 2 * Copyright IBM Corp. 2004, 2011
3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>, 3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
4 * Holger Smolinski <Holger.Smolinski@de.ibm.com>, 4 * Holger Smolinski <Holger.Smolinski@de.ibm.com>,
5 * Thomas Spatzier <tspat@de.ibm.com>, 5 * Thomas Spatzier <tspat@de.ibm.com>,
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 64b761aef004..8aa634f5944b 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -15,7 +15,7 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * 17 *
18 * Copyright (C) IBM Corporation, 2002, 2006 18 * Copyright IBM Corp. 2002, 2006
19 * 19 *
20 * s390 port, used ppc64 as template. Mike Grundy <grundym@us.ibm.com> 20 * s390 port, used ppc64 as template. Mike Grundy <grundym@us.ibm.com>
21 */ 21 */
diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index 87f080b17af1..eca94e74d19a 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -45,7 +45,7 @@ struct lgr_info {
45/* 45/*
46 * LGR globals 46 * LGR globals
47 */ 47 */
48static void *lgr_page; 48static char lgr_page[PAGE_SIZE] __aligned(PAGE_SIZE);
49static struct lgr_info lgr_info_last; 49static struct lgr_info lgr_info_last;
50static struct lgr_info lgr_info_cur; 50static struct lgr_info lgr_info_cur;
51static struct debug_info *lgr_dbf; 51static struct debug_info *lgr_dbf;
@@ -74,7 +74,7 @@ static void cpascii(char *dst, char *src, int size)
74 */ 74 */
75static void lgr_stsi_1_1_1(struct lgr_info *lgr_info) 75static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
76{ 76{
77 struct sysinfo_1_1_1 *si = lgr_page; 77 struct sysinfo_1_1_1 *si = (void *) lgr_page;
78 78
79 if (stsi(si, 1, 1, 1) == -ENOSYS) 79 if (stsi(si, 1, 1, 1) == -ENOSYS)
80 return; 80 return;
@@ -91,7 +91,7 @@ static void lgr_stsi_1_1_1(struct lgr_info *lgr_info)
91 */ 91 */
92static void lgr_stsi_2_2_2(struct lgr_info *lgr_info) 92static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
93{ 93{
94 struct sysinfo_2_2_2 *si = lgr_page; 94 struct sysinfo_2_2_2 *si = (void *) lgr_page;
95 95
96 if (stsi(si, 2, 2, 2) == -ENOSYS) 96 if (stsi(si, 2, 2, 2) == -ENOSYS)
97 return; 97 return;
@@ -105,7 +105,7 @@ static void lgr_stsi_2_2_2(struct lgr_info *lgr_info)
105 */ 105 */
106static void lgr_stsi_3_2_2(struct lgr_info *lgr_info) 106static void lgr_stsi_3_2_2(struct lgr_info *lgr_info)
107{ 107{
108 struct sysinfo_3_2_2 *si = lgr_page; 108 struct sysinfo_3_2_2 *si = (void *) lgr_page;
109 int i; 109 int i;
110 110
111 if (stsi(si, 3, 2, 2) == -ENOSYS) 111 if (stsi(si, 3, 2, 2) == -ENOSYS)
@@ -183,14 +183,9 @@ static void lgr_timer_set(void)
183 */ 183 */
184static int __init lgr_init(void) 184static int __init lgr_init(void)
185{ 185{
186 lgr_page = (void *) __get_free_pages(GFP_KERNEL, 0);
187 if (!lgr_page)
188 return -ENOMEM;
189 lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info)); 186 lgr_dbf = debug_register("lgr", 1, 1, sizeof(struct lgr_info));
190 if (!lgr_dbf) { 187 if (!lgr_dbf)
191 free_page((unsigned long) lgr_page);
192 return -ENOMEM; 188 return -ENOMEM;
193 }
194 debug_register_view(lgr_dbf, &debug_hex_ascii_view); 189 debug_register_view(lgr_dbf, &debug_hex_ascii_view);
195 lgr_info_get(&lgr_info_last); 190 lgr_info_get(&lgr_info_last);
196 debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); 191 debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last));
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index cdacf8f91b2d..493304bdf1c7 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/machine_kexec.c 2 * Copyright IBM Corp. 2005, 2011
3 *
4 * Copyright IBM Corp. 2005,2011
5 * 3 *
6 * Author(s): Rolf Adelsberger, 4 * Author(s): Rolf Adelsberger,
7 * Heiko Carstens <heiko.carstens@de.ibm.com> 5 * Heiko Carstens <heiko.carstens@de.ibm.com>
diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
index 7e2c38ba1373..4567ce20d900 100644
--- a/arch/s390/kernel/mcount.S
+++ b/arch/s390/kernel/mcount.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 2008,2009 2 * Copyright IBM Corp. 2008, 2009
3 * 3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, 4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
5 * 5 *
diff --git a/arch/s390/kernel/mcount64.S b/arch/s390/kernel/mcount64.S
index f70cadec68fc..11332193db30 100644
--- a/arch/s390/kernel/mcount64.S
+++ b/arch/s390/kernel/mcount64.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 2008,2009 2 * Copyright IBM Corp. 2008, 2009
3 * 3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, 4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
5 * 5 *
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index dfcb3436bad0..46412b1d7e1e 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -1,9 +1,8 @@
1/* 1/*
2 * arch/s390/kernel/module.c - Kernel module help for s390. 2 * Kernel module help for s390.
3 * 3 *
4 * S390 version 4 * S390 version
5 * Copyright (C) 2002, 2003 IBM Deutschland Entwicklung GmbH, 5 * Copyright IBM Corp. 2002, 2003
6 * IBM Corporation
7 * Author(s): Arnd Bergmann (arndb@de.ibm.com) 6 * Author(s): Arnd Bergmann (arndb@de.ibm.com)
8 * Martin Schwidefsky (schwidefsky@de.ibm.com) 7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
9 * 8 *
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index 8c372ca61350..a6daa5c5cdb0 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Machine check handler 2 * Machine check handler
3 * 3 *
4 * Copyright IBM Corp. 2000,2009 4 * Copyright IBM Corp. 2000, 2009
5 * Author(s): Ingo Adlung <adlung@de.ibm.com>, 5 * Author(s): Ingo Adlung <adlung@de.ibm.com>,
6 * Martin Schwidefsky <schwidefsky@de.ibm.com>, 6 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 * Cornelia Huck <cornelia.huck@de.ibm.com>, 7 * Cornelia Huck <cornelia.huck@de.ibm.com>,
diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c
index 95fa5ac6c4ce..46480d81df00 100644
--- a/arch/s390/kernel/os_info.c
+++ b/arch/s390/kernel/os_info.c
@@ -60,7 +60,7 @@ void __init os_info_init(void)
60 os_info.version_minor = OS_INFO_VERSION_MINOR; 60 os_info.version_minor = OS_INFO_VERSION_MINOR;
61 os_info.magic = OS_INFO_MAGIC; 61 os_info.magic = OS_INFO_MAGIC;
62 os_info.csum = os_info_csum(&os_info); 62 os_info.csum = os_info_csum(&os_info);
63 memcpy_absolute(&S390_lowcore.os_info, &ptr, sizeof(ptr)); 63 mem_assign_absolute(S390_lowcore.os_info, (unsigned long) ptr);
64} 64}
65 65
66#ifdef CONFIG_CRASH_DUMP 66#ifdef CONFIG_CRASH_DUMP
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 60055cefdd04..733175373a4c 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * This file handles the architecture dependent parts of process handling. 2 * This file handles the architecture dependent parts of process handling.
3 * 3 *
4 * Copyright IBM Corp. 1999,2009 4 * Copyright IBM Corp. 1999, 2009
5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>, 5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
6 * Hartmut Penner <hp@de.ibm.com>, 6 * Hartmut Penner <hp@de.ibm.com>,
7 * Denis Joseph Barrow, 7 * Denis Joseph Barrow,
@@ -25,8 +25,8 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/processor.h> 27#include <asm/processor.h>
28#include <asm/vtimer.h>
28#include <asm/irq.h> 29#include <asm/irq.h>
29#include <asm/timer.h>
30#include <asm/nmi.h> 30#include <asm/nmi.h>
31#include <asm/smp.h> 31#include <asm/smp.h>
32#include <asm/switch_to.h> 32#include <asm/switch_to.h>
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 6e0073e43f54..572d4c9cb33b 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/s390/kernel/processor.c
3 *
4 * Copyright IBM Corp. 2008 2 * Copyright IBM Corp. 2008
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) 3 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 */ 4 */
@@ -25,13 +23,15 @@ static DEFINE_PER_CPU(struct cpuid, cpu_id);
25 */ 23 */
26void __cpuinit cpu_init(void) 24void __cpuinit cpu_init(void)
27{ 25{
28 struct cpuid *id = &per_cpu(cpu_id, smp_processor_id()); 26 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
27 struct cpuid *id = &__get_cpu_var(cpu_id);
29 28
30 get_cpu_id(id); 29 get_cpu_id(id);
31 atomic_inc(&init_mm.mm_count); 30 atomic_inc(&init_mm.mm_count);
32 current->active_mm = &init_mm; 31 current->active_mm = &init_mm;
33 BUG_ON(current->mm); 32 BUG_ON(current->mm);
34 enter_lazy_tlb(&init_mm, current); 33 enter_lazy_tlb(&init_mm, current);
34 memset(idle, 0, sizeof(*idle));
35} 35}
36 36
37/* 37/*
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 4993e689b2c2..f4eb37680b91 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Ptrace user space interface. 2 * Ptrace user space interface.
3 * 3 *
4 * Copyright IBM Corp. 1999,2010 4 * Copyright IBM Corp. 1999, 2010
5 * Author(s): Denis Joseph Barrow 5 * Author(s): Denis Joseph Barrow
6 * Martin Schwidefsky (schwidefsky@de.ibm.com) 6 * Martin Schwidefsky (schwidefsky@de.ibm.com)
7 */ 7 */
diff --git a/arch/s390/kernel/reipl.S b/arch/s390/kernel/reipl.S
index ad67c214be04..dd8016b0477e 100644
--- a/arch/s390/kernel/reipl.S
+++ b/arch/s390/kernel/reipl.S
@@ -1,13 +1,12 @@
1/* 1/*
2 * arch/s390/kernel/reipl.S
3 *
4 * S390 version 2 * S390 version
5 * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 3 * Copyright IBM Corp. 2000
6 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com) 4 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com)
7 */ 5 */
8 6
9#include <linux/linkage.h> 7#include <linux/linkage.h>
10#include <asm/asm-offsets.h> 8#include <asm/asm-offsets.h>
9#include <asm/sigp.h>
11 10
12# 11#
13# store_status: Empty implementation until kdump is supported on 31 bit 12# store_status: Empty implementation until kdump is supported on 31 bit
@@ -60,7 +59,7 @@ ENTRY(do_reipl_asm)
60 bas %r14,.Ldisab-.Lpg0(%r13) 59 bas %r14,.Ldisab-.Lpg0(%r13)
61.L003: st %r1,__LC_SUBCHANNEL_ID 60.L003: st %r1,__LC_SUBCHANNEL_ID
62 lpsw 0 61 lpsw 0
63 sigp 0,0,0(6) 62 sigp 0,0,SIGP_RESTART
64.Ldisab: st %r14,.Ldispsw+4-.Lpg0(%r13) 63.Ldisab: st %r14,.Ldispsw+4-.Lpg0(%r13)
65 lpsw .Ldispsw-.Lpg0(%r13) 64 lpsw .Ldispsw-.Lpg0(%r13)
66 .align 8 65 .align 8
diff --git a/arch/s390/kernel/reipl64.S b/arch/s390/kernel/reipl64.S
index 36b32658fb24..dc3b1273c4dc 100644
--- a/arch/s390/kernel/reipl64.S
+++ b/arch/s390/kernel/reipl64.S
@@ -1,11 +1,12 @@
1/* 1/*
2 * Copyright IBM Corp 2000,2011 2 * Copyright IBM Corp 2000, 2011
3 * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>, 3 * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>,
4 * Denis Joseph Barrow, 4 * Denis Joseph Barrow,
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <asm/asm-offsets.h> 8#include <asm/asm-offsets.h>
9#include <asm/sigp.h>
9 10
10# 11#
11# store_status 12# store_status
@@ -106,7 +107,7 @@ ENTRY(do_reipl_asm)
106.L003: st %r1,__LC_SUBCHANNEL_ID 107.L003: st %r1,__LC_SUBCHANNEL_ID
107 lhi %r1,0 # mode 0 = esa 108 lhi %r1,0 # mode 0 = esa
108 slr %r0,%r0 # set cpuid to zero 109 slr %r0,%r0 # set cpuid to zero
109 sigp %r1,%r0,0x12 # switch to esa mode 110 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # switch to esa mode
110 lpsw 0 111 lpsw 0
111.Ldisab: sll %r14,1 112.Ldisab: sll %r14,1
112 srl %r14,1 # need to kill hi bit to avoid specification exceptions. 113 srl %r14,1 # need to kill hi bit to avoid specification exceptions.
diff --git a/arch/s390/kernel/relocate_kernel.S b/arch/s390/kernel/relocate_kernel.S
index c91d70aede91..f4e6f20e117a 100644
--- a/arch/s390/kernel/relocate_kernel.S
+++ b/arch/s390/kernel/relocate_kernel.S
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/relocate_kernel.S 2 * Copyright IBM Corp. 2005
3 *
4 * (C) Copyright IBM Corp. 2005
5 * 3 *
6 * Author(s): Rolf Adelsberger, 4 * Author(s): Rolf Adelsberger,
7 * Heiko Carstens <heiko.carstens@de.ibm.com> 5 * Heiko Carstens <heiko.carstens@de.ibm.com>
@@ -9,6 +7,7 @@
9 */ 7 */
10 8
11#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <asm/sigp.h>
12 11
13/* 12/*
14 * moves the new kernel to its destination... 13 * moves the new kernel to its destination...
@@ -93,7 +92,7 @@ ENTRY(relocate_kernel)
93 .no_diag308: 92 .no_diag308:
94 sr %r1,%r1 # clear %r1 93 sr %r1,%r1 # clear %r1
95 sr %r2,%r2 # clear %r2 94 sr %r2,%r2 # clear %r2
96 sigp %r1,%r2,0x12 # set cpuid to zero 95 sigp %r1,%r2,SIGP_SET_ARCHITECTURE # set cpuid to zero
97 lpsw 0 # hopefully start new kernel... 96 lpsw 0 # hopefully start new kernel...
98 97
99 .align 8 98 .align 8
diff --git a/arch/s390/kernel/relocate_kernel64.S b/arch/s390/kernel/relocate_kernel64.S
index 7c3ce589a7f0..cfac28330b03 100644
--- a/arch/s390/kernel/relocate_kernel64.S
+++ b/arch/s390/kernel/relocate_kernel64.S
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/relocate_kernel64.S 2 * Copyright IBM Corp. 2005
3 *
4 * (C) Copyright IBM Corp. 2005
5 * 3 *
6 * Author(s): Rolf Adelsberger, 4 * Author(s): Rolf Adelsberger,
7 * Heiko Carstens <heiko.carstens@de.ibm.com> 5 * Heiko Carstens <heiko.carstens@de.ibm.com>
@@ -9,6 +7,7 @@
9 */ 7 */
10 8
11#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <asm/sigp.h>
12 11
13/* 12/*
14 * moves the new kernel to its destination... 13 * moves the new kernel to its destination...
@@ -45,7 +44,7 @@ ENTRY(relocate_kernel)
45 diag %r0,%r0,0x308 44 diag %r0,%r0,0x308
46 .back: 45 .back:
47 lhi %r1,1 # mode 1 = esame 46 lhi %r1,1 # mode 1 = esame
48 sigp %r1,%r0,0x12 # switch to esame mode 47 sigp %r1,%r0,SIGP_SET_ARCHITECTURE # switch to esame mode
49 sam64 # switch to 64 bit addressing mode 48 sam64 # switch to 64 bit addressing mode
50 basr %r13,0 49 basr %r13,0
51 .back_base: 50 .back_base:
@@ -96,7 +95,7 @@ ENTRY(relocate_kernel)
96 sam31 # 31 bit mode 95 sam31 # 31 bit mode
97 sr %r1,%r1 # erase register r1 96 sr %r1,%r1 # erase register r1
98 sr %r2,%r2 # erase register r2 97 sr %r2,%r2 # erase register r2
99 sigp %r1,%r2,0x12 # set cpuid to zero 98 sigp %r1,%r2,SIGP_SET_ARCHITECTURE # set cpuid to zero
100 lpsw 0 # hopefully start new kernel... 99 lpsw 0 # hopefully start new kernel...
101 100
102 .align 8 101 .align 8
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index 95792d846bb6..bf053898630d 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Mini SCLP driver. 2 * Mini SCLP driver.
3 * 3 *
4 * Copyright IBM Corp. 2004,2009 4 * Copyright IBM Corp. 2004, 2009
5 * 5 *
6 * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>, 6 * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>,
7 * Heiko Carstens <heiko.carstens@de.ibm.com>, 7 * Heiko Carstens <heiko.carstens@de.ibm.com>,
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 489d1d8d96b0..743c0f32fe3b 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * arch/s390/kernel/setup.c
3 *
4 * S390 version 2 * S390 version
5 * Copyright (C) IBM Corp. 1999,2012 3 * Copyright IBM Corp. 1999, 2012
6 * Author(s): Hartmut Penner (hp@de.ibm.com), 4 * Author(s): Hartmut Penner (hp@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com) 5 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 * 6 *
@@ -63,6 +61,7 @@
63#include <asm/kvm_virtio.h> 61#include <asm/kvm_virtio.h>
64#include <asm/diag.h> 62#include <asm/diag.h>
65#include <asm/os_info.h> 63#include <asm/os_info.h>
64#include <asm/sclp.h>
66#include "entry.h" 65#include "entry.h"
67 66
68long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY | 67long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY |
@@ -138,9 +137,14 @@ __setup("condev=", condev_setup);
138 137
139static void __init set_preferred_console(void) 138static void __init set_preferred_console(void)
140{ 139{
141 if (MACHINE_IS_KVM) 140 if (MACHINE_IS_KVM) {
142 add_preferred_console("hvc", 0, NULL); 141 if (sclp_has_vt220())
143 else if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP) 142 add_preferred_console("ttyS", 1, NULL);
143 else if (sclp_has_linemode())
144 add_preferred_console("ttyS", 0, NULL);
145 else
146 add_preferred_console("hvc", 0, NULL);
147 } else if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP)
144 add_preferred_console("ttyS", 0, NULL); 148 add_preferred_console("ttyS", 0, NULL);
145 else if (CONSOLE_IS_3270) 149 else if (CONSOLE_IS_3270)
146 add_preferred_console("tty3270", 0, NULL); 150 add_preferred_console("tty3270", 0, NULL);
@@ -430,10 +434,11 @@ static void __init setup_lowcore(void)
430 lc->restart_source = -1UL; 434 lc->restart_source = -1UL;
431 435
432 /* Setup absolute zero lowcore */ 436 /* Setup absolute zero lowcore */
433 memcpy_absolute(&S390_lowcore.restart_stack, &lc->restart_stack, 437 mem_assign_absolute(S390_lowcore.restart_stack, lc->restart_stack);
434 4 * sizeof(unsigned long)); 438 mem_assign_absolute(S390_lowcore.restart_fn, lc->restart_fn);
435 memcpy_absolute(&S390_lowcore.restart_psw, &lc->restart_psw, 439 mem_assign_absolute(S390_lowcore.restart_data, lc->restart_data);
436 sizeof(lc->restart_psw)); 440 mem_assign_absolute(S390_lowcore.restart_source, lc->restart_source);
441 mem_assign_absolute(S390_lowcore.restart_psw, lc->restart_psw);
437 442
438 set_prefix((u32)(unsigned long) lc); 443 set_prefix((u32)(unsigned long) lc);
439 lowcore_ptr[0] = lc; 444 lowcore_ptr[0] = lc;
@@ -598,9 +603,7 @@ static void __init setup_memory_end(void)
598static void __init setup_vmcoreinfo(void) 603static void __init setup_vmcoreinfo(void)
599{ 604{
600#ifdef CONFIG_KEXEC 605#ifdef CONFIG_KEXEC
601 unsigned long ptr = paddr_vmcoreinfo_note(); 606 mem_assign_absolute(S390_lowcore.vmcore_info, paddr_vmcoreinfo_note());
602
603 memcpy_absolute(&S390_lowcore.vmcore_info, &ptr, sizeof(ptr));
604#endif 607#endif
605} 608}
606 609
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index ac565b44aabb..c13a2a37ef00 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/s390/kernel/signal.c 2 * Copyright IBM Corp. 1999, 2006
3 *
4 * Copyright (C) IBM Corp. 1999,2006
5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 3 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
6 * 4 *
7 * Based on Intel version 5 * Based on Intel version
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 15cca26ccb6c..720fda1620f2 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SMP related functions 2 * SMP related functions
3 * 3 *
4 * Copyright IBM Corp. 1999,2012 4 * Copyright IBM Corp. 1999, 2012
5 * Author(s): Denis Joseph Barrow, 5 * Author(s): Denis Joseph Barrow,
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>,
@@ -38,40 +38,16 @@
38#include <asm/setup.h> 38#include <asm/setup.h>
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/tlbflush.h> 40#include <asm/tlbflush.h>
41#include <asm/timer.h> 41#include <asm/vtimer.h>
42#include <asm/lowcore.h> 42#include <asm/lowcore.h>
43#include <asm/sclp.h> 43#include <asm/sclp.h>
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,20 +122,19 @@ 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 return !!(pcpu->status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED));
153 return !!(pcpu->status & 0x50);
154} 129}
155 130
156static inline int pcpu_running(struct pcpu *pcpu) 131static inline int pcpu_running(struct pcpu *pcpu)
157{ 132{
158 if (__pcpu_sigp(pcpu->address, sigp_sense_running, 133 if (__pcpu_sigp(pcpu->address, SIGP_SENSE_RUNNING,
159 0, &pcpu->status) != sigp_status_stored) 134 0, &pcpu->status) != SIGP_CC_STATUS_STORED)
160 return 1; 135 return 1;
161 /* Check for running status */ 136 /* Status stored condition code is equivalent to cpu not running. */
162 return !(pcpu->status & 0x400); 137 return 0;
163} 138}
164 139
165/* 140/*
@@ -181,7 +156,7 @@ static void pcpu_ec_call(struct pcpu *pcpu, int ec_bit)
181 156
182 set_bit(ec_bit, &pcpu->ec_mask); 157 set_bit(ec_bit, &pcpu->ec_mask);
183 order = pcpu_running(pcpu) ? 158 order = pcpu_running(pcpu) ?
184 sigp_external_call : sigp_emergency_signal; 159 SIGP_EXTERNAL_CALL : SIGP_EMERGENCY_SIGNAL;
185 pcpu_sigp_retry(pcpu, order, 0); 160 pcpu_sigp_retry(pcpu, order, 0);
186} 161}
187 162
@@ -214,7 +189,7 @@ static int __cpuinit pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu)
214 goto out; 189 goto out;
215#endif 190#endif
216 lowcore_ptr[cpu] = lc; 191 lowcore_ptr[cpu] = lc;
217 pcpu_sigp_retry(pcpu, sigp_set_prefix, (u32)(unsigned long) lc); 192 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, (u32)(unsigned long) lc);
218 return 0; 193 return 0;
219out: 194out:
220 if (pcpu != &pcpu_devices[0]) { 195 if (pcpu != &pcpu_devices[0]) {
@@ -229,7 +204,7 @@ out:
229 204
230static void pcpu_free_lowcore(struct pcpu *pcpu) 205static void pcpu_free_lowcore(struct pcpu *pcpu)
231{ 206{
232 pcpu_sigp_retry(pcpu, sigp_set_prefix, 0); 207 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, 0);
233 lowcore_ptr[pcpu - pcpu_devices] = NULL; 208 lowcore_ptr[pcpu - pcpu_devices] = NULL;
234#ifndef CONFIG_64BIT 209#ifndef CONFIG_64BIT
235 if (MACHINE_HAS_IEEE) { 210 if (MACHINE_HAS_IEEE) {
@@ -288,7 +263,7 @@ static void pcpu_start_fn(struct pcpu *pcpu, void (*func)(void *), void *data)
288 lc->restart_fn = (unsigned long) func; 263 lc->restart_fn = (unsigned long) func;
289 lc->restart_data = (unsigned long) data; 264 lc->restart_data = (unsigned long) data;
290 lc->restart_source = -1UL; 265 lc->restart_source = -1UL;
291 pcpu_sigp_retry(pcpu, sigp_restart, 0); 266 pcpu_sigp_retry(pcpu, SIGP_RESTART, 0);
292} 267}
293 268
294/* 269/*
@@ -298,26 +273,26 @@ static void pcpu_delegate(struct pcpu *pcpu, void (*func)(void *),
298 void *data, unsigned long stack) 273 void *data, unsigned long stack)
299{ 274{
300 struct _lowcore *lc = lowcore_ptr[pcpu - pcpu_devices]; 275 struct _lowcore *lc = lowcore_ptr[pcpu - pcpu_devices];
301 struct { 276 unsigned long source_cpu = stap();
302 unsigned long stack;
303 void *func;
304 void *data;
305 unsigned long source;
306 } restart = { stack, func, data, stap() };
307 277
308 __load_psw_mask(psw_kernel_bits); 278 __load_psw_mask(psw_kernel_bits);
309 if (pcpu->address == restart.source) 279 if (pcpu->address == source_cpu)
310 func(data); /* should not return */ 280 func(data); /* should not return */
311 /* Stop target cpu (if func returns this stops the current cpu). */ 281 /* Stop target cpu (if func returns this stops the current cpu). */
312 pcpu_sigp_retry(pcpu, sigp_stop, 0); 282 pcpu_sigp_retry(pcpu, SIGP_STOP, 0);
313 /* Restart func on the target cpu and stop the current cpu. */ 283 /* Restart func on the target cpu and stop the current cpu. */
314 memcpy_absolute(&lc->restart_stack, &restart, sizeof(restart)); 284 mem_assign_absolute(lc->restart_stack, stack);
285 mem_assign_absolute(lc->restart_fn, (unsigned long) func);
286 mem_assign_absolute(lc->restart_data, (unsigned long) data);
287 mem_assign_absolute(lc->restart_source, source_cpu);
315 asm volatile( 288 asm volatile(
316 "0: sigp 0,%0,6 # sigp restart to target cpu\n" 289 "0: sigp 0,%0,%2 # sigp restart to target cpu\n"
317 " brc 2,0b # busy, try again\n" 290 " brc 2,0b # busy, try again\n"
318 "1: sigp 0,%1,5 # sigp stop to current cpu\n" 291 "1: sigp 0,%1,%3 # sigp stop to current cpu\n"
319 " brc 2,1b # busy, try again\n" 292 " brc 2,1b # busy, try again\n"
320 : : "d" (pcpu->address), "d" (restart.source) : "0", "1", "cc"); 293 : : "d" (pcpu->address), "d" (source_cpu),
294 "K" (SIGP_RESTART), "K" (SIGP_STOP)
295 : "0", "1", "cc");
321 for (;;) ; 296 for (;;) ;
322} 297}
323 298
@@ -388,8 +363,8 @@ void smp_emergency_stop(cpumask_t *cpumask)
388 for_each_cpu(cpu, cpumask) { 363 for_each_cpu(cpu, cpumask) {
389 struct pcpu *pcpu = pcpu_devices + cpu; 364 struct pcpu *pcpu = pcpu_devices + cpu;
390 set_bit(ec_stop_cpu, &pcpu->ec_mask); 365 set_bit(ec_stop_cpu, &pcpu->ec_mask);
391 while (__pcpu_sigp(pcpu->address, sigp_emergency_signal, 366 while (__pcpu_sigp(pcpu->address, SIGP_EMERGENCY_SIGNAL,
392 0, NULL) == sigp_busy && 367 0, NULL) == SIGP_CC_BUSY &&
393 get_clock() < end) 368 get_clock() < end)
394 cpu_relax(); 369 cpu_relax();
395 } 370 }
@@ -425,7 +400,7 @@ void smp_send_stop(void)
425 /* stop all processors */ 400 /* stop all processors */
426 for_each_cpu(cpu, &cpumask) { 401 for_each_cpu(cpu, &cpumask) {
427 struct pcpu *pcpu = pcpu_devices + cpu; 402 struct pcpu *pcpu = pcpu_devices + cpu;
428 pcpu_sigp_retry(pcpu, sigp_stop, 0); 403 pcpu_sigp_retry(pcpu, SIGP_STOP, 0);
429 while (!pcpu_stopped(pcpu)) 404 while (!pcpu_stopped(pcpu))
430 cpu_relax(); 405 cpu_relax();
431 } 406 }
@@ -436,7 +411,7 @@ void smp_send_stop(void)
436 */ 411 */
437void smp_stop_cpu(void) 412void smp_stop_cpu(void)
438{ 413{
439 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), sigp_stop, 0); 414 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), SIGP_STOP, 0);
440 for (;;) ; 415 for (;;) ;
441} 416}
442 417
@@ -590,7 +565,7 @@ static void __init smp_get_save_area(int cpu, u16 address)
590 } 565 }
591#endif 566#endif
592 /* Get the registers of a non-boot cpu. */ 567 /* Get the registers of a non-boot cpu. */
593 __pcpu_sigp_relax(address, sigp_stop_and_store_status, 0, NULL); 568 __pcpu_sigp_relax(address, SIGP_STOP_AND_STORE_STATUS, 0, NULL);
594 memcpy_real(save_area, lc + SAVE_AREA_BASE, sizeof(*save_area)); 569 memcpy_real(save_area, lc + SAVE_AREA_BASE, sizeof(*save_area));
595} 570}
596 571
@@ -599,8 +574,8 @@ int smp_store_status(int cpu)
599 struct pcpu *pcpu; 574 struct pcpu *pcpu;
600 575
601 pcpu = pcpu_devices + cpu; 576 pcpu = pcpu_devices + cpu;
602 if (__pcpu_sigp_relax(pcpu->address, sigp_stop_and_store_status, 577 if (__pcpu_sigp_relax(pcpu->address, SIGP_STOP_AND_STORE_STATUS,
603 0, NULL) != sigp_order_code_accepted) 578 0, NULL) != SIGP_CC_ORDER_CODE_ACCEPTED)
604 return -EIO; 579 return -EIO;
605 return 0; 580 return 0;
606} 581}
@@ -621,8 +596,8 @@ static struct sclp_cpu_info *smp_get_cpu_info(void)
621 if (info && (use_sigp_detection || sclp_get_cpu_info(info))) { 596 if (info && (use_sigp_detection || sclp_get_cpu_info(info))) {
622 use_sigp_detection = 1; 597 use_sigp_detection = 1;
623 for (address = 0; address <= MAX_CPU_ADDRESS; address++) { 598 for (address = 0; address <= MAX_CPU_ADDRESS; address++) {
624 if (__pcpu_sigp_relax(address, sigp_sense, 0, NULL) == 599 if (__pcpu_sigp_relax(address, SIGP_SENSE, 0, NULL) ==
625 sigp_not_operational) 600 SIGP_CC_NOT_OPERATIONAL)
626 continue; 601 continue;
627 info->cpu[info->configured].address = address; 602 info->cpu[info->configured].address = address;
628 info->configured++; 603 info->configured++;
@@ -717,9 +692,7 @@ static void __cpuinit smp_start_secondary(void *cpuvoid)
717 init_cpu_vtimer(); 692 init_cpu_vtimer();
718 pfault_init(); 693 pfault_init();
719 notify_cpu_starting(smp_processor_id()); 694 notify_cpu_starting(smp_processor_id());
720 ipi_call_lock();
721 set_cpu_online(smp_processor_id(), true); 695 set_cpu_online(smp_processor_id(), true);
722 ipi_call_unlock();
723 local_irq_enable(); 696 local_irq_enable();
724 /* cpu_idle will call schedule for us */ 697 /* cpu_idle will call schedule for us */
725 cpu_idle(); 698 cpu_idle();
@@ -734,8 +707,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
734 pcpu = pcpu_devices + cpu; 707 pcpu = pcpu_devices + cpu;
735 if (pcpu->state != CPU_STATE_CONFIGURED) 708 if (pcpu->state != CPU_STATE_CONFIGURED)
736 return -EIO; 709 return -EIO;
737 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != 710 if (pcpu_sigp_retry(pcpu, SIGP_INITIAL_CPU_RESET, 0) !=
738 sigp_order_code_accepted) 711 SIGP_CC_ORDER_CODE_ACCEPTED)
739 return -EIO; 712 return -EIO;
740 713
741 rc = pcpu_alloc_lowcore(pcpu, cpu); 714 rc = pcpu_alloc_lowcore(pcpu, cpu);
@@ -795,7 +768,7 @@ void __cpu_die(unsigned int cpu)
795void __noreturn cpu_die(void) 768void __noreturn cpu_die(void)
796{ 769{
797 idle_task_exit(); 770 idle_task_exit();
798 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), sigp_stop, 0); 771 pcpu_sigp_retry(pcpu_devices + smp_processor_id(), SIGP_STOP, 0);
799 for (;;) ; 772 for (;;) ;
800} 773}
801 774
@@ -942,7 +915,7 @@ static ssize_t show_idle_count(struct device *dev,
942 do { 915 do {
943 sequence = ACCESS_ONCE(idle->sequence); 916 sequence = ACCESS_ONCE(idle->sequence);
944 idle_count = ACCESS_ONCE(idle->idle_count); 917 idle_count = ACCESS_ONCE(idle->idle_count);
945 if (ACCESS_ONCE(idle->idle_enter)) 918 if (ACCESS_ONCE(idle->clock_idle_enter))
946 idle_count++; 919 idle_count++;
947 } while ((sequence & 1) || (idle->sequence != sequence)); 920 } while ((sequence & 1) || (idle->sequence != sequence));
948 return sprintf(buf, "%llu\n", idle_count); 921 return sprintf(buf, "%llu\n", idle_count);
@@ -960,8 +933,8 @@ static ssize_t show_idle_time(struct device *dev,
960 now = get_clock(); 933 now = get_clock();
961 sequence = ACCESS_ONCE(idle->sequence); 934 sequence = ACCESS_ONCE(idle->sequence);
962 idle_time = ACCESS_ONCE(idle->idle_time); 935 idle_time = ACCESS_ONCE(idle->idle_time);
963 idle_enter = ACCESS_ONCE(idle->idle_enter); 936 idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
964 idle_exit = ACCESS_ONCE(idle->idle_exit); 937 idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
965 } while ((sequence & 1) || (idle->sequence != sequence)); 938 } while ((sequence & 1) || (idle->sequence != sequence));
966 idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0; 939 idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;
967 return sprintf(buf, "%llu\n", idle_time >> 12); 940 return sprintf(buf, "%llu\n", idle_time >> 12);
@@ -984,14 +957,11 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
984 unsigned int cpu = (unsigned int)(long)hcpu; 957 unsigned int cpu = (unsigned int)(long)hcpu;
985 struct cpu *c = &pcpu_devices[cpu].cpu; 958 struct cpu *c = &pcpu_devices[cpu].cpu;
986 struct device *s = &c->dev; 959 struct device *s = &c->dev;
987 struct s390_idle_data *idle;
988 int err = 0; 960 int err = 0;
989 961
990 switch (action) { 962 switch (action) {
991 case CPU_ONLINE: 963 case CPU_ONLINE:
992 case CPU_ONLINE_FROZEN: 964 case CPU_ONLINE_FROZEN:
993 idle = &per_cpu(s390_idle, cpu);
994 memset(idle, 0, sizeof(struct s390_idle_data));
995 err = sysfs_create_group(&s->kobj, &cpu_online_attr_group); 965 err = sysfs_create_group(&s->kobj, &cpu_online_attr_group);
996 break; 966 break;
997 case CPU_DEAD: 967 case CPU_DEAD:
diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c
index 8841919ef7e6..1785cd82253c 100644
--- a/arch/s390/kernel/stacktrace.c
+++ b/arch/s390/kernel/stacktrace.c
@@ -1,9 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/stacktrace.c
3 *
4 * Stack trace management functions 2 * Stack trace management functions
5 * 3 *
6 * Copyright (C) IBM Corp. 2006 4 * Copyright IBM Corp. 2006
7 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> 5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
8 */ 6 */
9 7
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index dd70ef046058..d4ca4e0617b5 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -12,6 +12,7 @@
12#include <asm/ptrace.h> 12#include <asm/ptrace.h>
13#include <asm/thread_info.h> 13#include <asm/thread_info.h>
14#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
15#include <asm/sigp.h>
15 16
16/* 17/*
17 * Save register context in absolute 0 lowcore and call swsusp_save() to 18 * Save register context in absolute 0 lowcore and call swsusp_save() to
@@ -163,7 +164,7 @@ ENTRY(swsusp_arch_resume)
163 diag %r0,%r0,0x308 164 diag %r0,%r0,0x308
164restart_entry: 165restart_entry:
165 lhi %r1,1 166 lhi %r1,1
166 sigp %r1,%r0,0x12 167 sigp %r1,%r0,SIGP_SET_ARCHITECTURE
167 sam64 168 sam64
168 larl %r1,.Lnew_pgm_check_psw 169 larl %r1,.Lnew_pgm_check_psw
169 lpswe 0(%r1) 170 lpswe 0(%r1)
@@ -179,7 +180,7 @@ pgm_check_entry:
179 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */ 180 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
180 mvc __LC_RST_NEW_PSW(16,%r0),0(%r4) 181 mvc __LC_RST_NEW_PSW(16,%r0),0(%r4)
1813: 1823:
182 sigp %r9,%r1,11 /* sigp initial cpu reset */ 183 sigp %r9,%r1,SIGP_INITIAL_CPU_RESET /* sigp initial cpu reset */
183 brc 8,4f /* accepted */ 184 brc 8,4f /* accepted */
184 brc 2,3b /* busy, try again */ 185 brc 2,3b /* busy, try again */
185 186
@@ -190,16 +191,16 @@ pgm_check_entry:
190 larl %r3,_sclp_print_early 191 larl %r3,_sclp_print_early
191 lghi %r1,0 192 lghi %r1,0
192 sam31 193 sam31
193 sigp %r1,%r0,0x12 194 sigp %r1,%r0,SIGP_SET_ARCHITECTURE
194 basr %r14,%r3 195 basr %r14,%r3
195 larl %r3,.Ldisabled_wait_31 196 larl %r3,.Ldisabled_wait_31
196 lpsw 0(%r3) 197 lpsw 0(%r3)
1974: 1984:
198 /* Switch to suspend CPU */ 199 /* Switch to suspend CPU */
199 sigp %r9,%r1,6 /* sigp restart to suspend CPU */ 200 sigp %r9,%r1,SIGP_RESTART /* sigp restart to suspend CPU */
200 brc 2,4b /* busy, try again */ 201 brc 2,4b /* busy, try again */
2015: 2025:
202 sigp %r9,%r2,5 /* sigp stop to current resume CPU */ 203 sigp %r9,%r2,SIGP_STOP /* sigp stop to current resume CPU */
203 brc 2,5b /* busy, try again */ 204 brc 2,5b /* busy, try again */
2046: j 6b 2056: j 6b
205 206
@@ -207,7 +208,7 @@ restart_suspend:
207 larl %r1,.Lresume_cpu 208 larl %r1,.Lresume_cpu
208 llgh %r2,0(%r1) 209 llgh %r2,0(%r1)
2097: 2107:
210 sigp %r9,%r2,1 /* sigp sense, wait for resume CPU */ 211 sigp %r9,%r2,SIGP_SENSE /* sigp sense, wait for resume CPU */
211 brc 8,7b /* accepted, status 0, still running */ 212 brc 8,7b /* accepted, status 0, still running */
212 brc 2,7b /* busy, try again */ 213 brc 2,7b /* busy, try again */
213 tmll %r9,0x40 /* Test if resume CPU is stopped */ 214 tmll %r9,0x40 /* Test if resume CPU is stopped */
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 78ea1948ff51..b4a29eee41b8 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * arch/s390/kernel/sys_s390.c
3 *
4 * S390 version 2 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 3 * Copyright IBM Corp. 1999, 2000
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Thomas Spatzier (tspat@de.ibm.com) 5 * Thomas Spatzier (tspat@de.ibm.com)
8 * 6 *
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index d4e1cb1dbcd1..dcec960fc724 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * arch/s390/kernel/time.c
3 * Time of day based timer functions. 2 * Time of day based timer functions.
4 * 3 *
5 * S390 version 4 * S390 version
@@ -45,7 +44,7 @@
45#include <asm/vdso.h> 44#include <asm/vdso.h>
46#include <asm/irq.h> 45#include <asm/irq.h>
47#include <asm/irq_regs.h> 46#include <asm/irq_regs.h>
48#include <asm/timer.h> 47#include <asm/vtimer.h>
49#include <asm/etr.h> 48#include <asm/etr.h>
50#include <asm/cio.h> 49#include <asm/cio.h>
51#include "entry.h" 50#include "entry.h"
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4f8dc942257c..05151e06c388 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 2007,2011 2 * Copyright IBM Corp. 2007, 2011
3 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> 3 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
4 */ 4 */
5 5
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 77cdf4234ebc..af2421a0f315 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * arch/s390/kernel/traps.c
3 *
4 * S390 version 2 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 3 * Copyright IBM Corp. 1999, 2000
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 5 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
8 * 6 *
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 39ebff506946..4fc97b40a6e1 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -1,71 +1,82 @@
1/* 1/*
2 * arch/s390/kernel/vtime.c
3 * Virtual cpu timer based timer functions. 2 * Virtual cpu timer based timer functions.
4 * 3 *
5 * S390 version 4 * Copyright IBM Corp. 2004, 2012
6 * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Jan Glauber <jan.glauber@de.ibm.com> 5 * Author(s): Jan Glauber <jan.glauber@de.ibm.com>
8 */ 6 */
9 7
10#include <linux/module.h> 8#include <linux/kernel_stat.h>
9#include <linux/notifier.h>
10#include <linux/kprobes.h>
11#include <linux/export.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
12#include <linux/time.h>
13#include <linux/delay.h>
14#include <linux/init.h>
15#include <linux/smp.h>
16#include <linux/types.h>
17#include <linux/timex.h> 13#include <linux/timex.h>
18#include <linux/notifier.h> 14#include <linux/types.h>
19#include <linux/kernel_stat.h> 15#include <linux/time.h>
20#include <linux/rcupdate.h>
21#include <linux/posix-timers.h>
22#include <linux/cpu.h> 16#include <linux/cpu.h>
23#include <linux/kprobes.h> 17#include <linux/smp.h>
24 18
25#include <asm/timer.h>
26#include <asm/irq_regs.h> 19#include <asm/irq_regs.h>
27#include <asm/cputime.h> 20#include <asm/cputime.h>
21#include <asm/vtimer.h>
28#include <asm/irq.h> 22#include <asm/irq.h>
29#include "entry.h" 23#include "entry.h"
30 24
31static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); 25static void virt_timer_expire(void);
32 26
33DEFINE_PER_CPU(struct s390_idle_data, s390_idle); 27DEFINE_PER_CPU(struct s390_idle_data, s390_idle);
34 28
35static inline __u64 get_vtimer(void) 29static LIST_HEAD(virt_timer_list);
30static DEFINE_SPINLOCK(virt_timer_lock);
31static atomic64_t virt_timer_current;
32static atomic64_t virt_timer_elapsed;
33
34static inline u64 get_vtimer(void)
36{ 35{
37 __u64 timer; 36 u64 timer;
38 37
39 asm volatile("STPT %0" : "=m" (timer)); 38 asm volatile("stpt %0" : "=m" (timer));
40 return timer; 39 return timer;
41} 40}
42 41
43static inline void set_vtimer(__u64 expires) 42static inline void set_vtimer(u64 expires)
44{ 43{
45 __u64 timer; 44 u64 timer;
46 45
47 asm volatile (" STPT %0\n" /* Store current cpu timer value */ 46 asm volatile(
48 " SPT %1" /* Set new value immediately afterwards */ 47 " stpt %0\n" /* Store current cpu timer value */
49 : "=m" (timer) : "m" (expires) ); 48 " spt %1" /* Set new value imm. afterwards */
49 : "=m" (timer) : "m" (expires));
50 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer; 50 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer;
51 S390_lowcore.last_update_timer = expires; 51 S390_lowcore.last_update_timer = expires;
52} 52}
53 53
54static inline int virt_timer_forward(u64 elapsed)
55{
56 BUG_ON(!irqs_disabled());
57
58 if (list_empty(&virt_timer_list))
59 return 0;
60 elapsed = atomic64_add_return(elapsed, &virt_timer_elapsed);
61 return elapsed >= atomic64_read(&virt_timer_current);
62}
63
54/* 64/*
55 * Update process times based on virtual cpu times stored by entry.S 65 * Update process times based on virtual cpu times stored by entry.S
56 * to the lowcore fields user_timer, system_timer & steal_clock. 66 * to the lowcore fields user_timer, system_timer & steal_clock.
57 */ 67 */
58static void do_account_vtime(struct task_struct *tsk, int hardirq_offset) 68static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
59{ 69{
60 struct thread_info *ti = task_thread_info(tsk); 70 struct thread_info *ti = task_thread_info(tsk);
61 __u64 timer, clock, user, system, steal; 71 u64 timer, clock, user, system, steal;
62 72
63 timer = S390_lowcore.last_update_timer; 73 timer = S390_lowcore.last_update_timer;
64 clock = S390_lowcore.last_update_clock; 74 clock = S390_lowcore.last_update_clock;
65 asm volatile (" STPT %0\n" /* Store current cpu timer value */ 75 asm volatile(
66 " STCK %1" /* Store current tod clock value */ 76 " stpt %0\n" /* Store current cpu timer value */
67 : "=m" (S390_lowcore.last_update_timer), 77 " stck %1" /* Store current tod clock value */
68 "=m" (S390_lowcore.last_update_clock) ); 78 : "=m" (S390_lowcore.last_update_timer),
79 "=m" (S390_lowcore.last_update_clock));
69 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 80 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
70 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock; 81 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock;
71 82
@@ -84,6 +95,8 @@ static void do_account_vtime(struct task_struct *tsk, int hardirq_offset)
84 S390_lowcore.steal_timer = 0; 95 S390_lowcore.steal_timer = 0;
85 account_steal_time(steal); 96 account_steal_time(steal);
86 } 97 }
98
99 return virt_timer_forward(user + system);
87} 100}
88 101
89void account_vtime(struct task_struct *prev, struct task_struct *next) 102void account_vtime(struct task_struct *prev, struct task_struct *next)
@@ -101,7 +114,8 @@ void account_vtime(struct task_struct *prev, struct task_struct *next)
101 114
102void account_process_tick(struct task_struct *tsk, int user_tick) 115void account_process_tick(struct task_struct *tsk, int user_tick)
103{ 116{
104 do_account_vtime(tsk, HARDIRQ_OFFSET); 117 if (do_account_vtime(tsk, HARDIRQ_OFFSET))
118 virt_timer_expire();
105} 119}
106 120
107/* 121/*
@@ -111,7 +125,7 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
111void account_system_vtime(struct task_struct *tsk) 125void account_system_vtime(struct task_struct *tsk)
112{ 126{
113 struct thread_info *ti = task_thread_info(tsk); 127 struct thread_info *ti = task_thread_info(tsk);
114 __u64 timer, system; 128 u64 timer, system;
115 129
116 timer = S390_lowcore.last_update_timer; 130 timer = S390_lowcore.last_update_timer;
117 S390_lowcore.last_update_timer = get_vtimer(); 131 S390_lowcore.last_update_timer = get_vtimer();
@@ -121,13 +135,14 @@ void account_system_vtime(struct task_struct *tsk)
121 S390_lowcore.steal_timer -= system; 135 S390_lowcore.steal_timer -= system;
122 ti->system_timer = S390_lowcore.system_timer; 136 ti->system_timer = S390_lowcore.system_timer;
123 account_system_time(tsk, 0, system, system); 137 account_system_time(tsk, 0, system, system);
138
139 virt_timer_forward(system);
124} 140}
125EXPORT_SYMBOL_GPL(account_system_vtime); 141EXPORT_SYMBOL_GPL(account_system_vtime);
126 142
127void __kprobes vtime_stop_cpu(void) 143void __kprobes vtime_stop_cpu(void)
128{ 144{
129 struct s390_idle_data *idle = &__get_cpu_var(s390_idle); 145 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
130 struct vtimer_queue *vq = &__get_cpu_var(virt_cpu_timer);
131 unsigned long long idle_time; 146 unsigned long long idle_time;
132 unsigned long psw_mask; 147 unsigned long psw_mask;
133 148
@@ -141,7 +156,7 @@ void __kprobes vtime_stop_cpu(void)
141 idle->nohz_delay = 0; 156 idle->nohz_delay = 0;
142 157
143 /* Call the assembler magic in entry.S */ 158 /* Call the assembler magic in entry.S */
144 psw_idle(idle, vq, psw_mask, !list_empty(&vq->list)); 159 psw_idle(idle, psw_mask);
145 160
146 /* Reenable preemption tracer. */ 161 /* Reenable preemption tracer. */
147 start_critical_timings(); 162 start_critical_timings();
@@ -149,9 +164,9 @@ void __kprobes vtime_stop_cpu(void)
149 /* Account time spent with enabled wait psw loaded as idle time. */ 164 /* Account time spent with enabled wait psw loaded as idle time. */
150 idle->sequence++; 165 idle->sequence++;
151 smp_wmb(); 166 smp_wmb();
152 idle_time = idle->idle_exit - idle->idle_enter; 167 idle_time = idle->clock_idle_exit - idle->clock_idle_enter;
168 idle->clock_idle_enter = idle->clock_idle_exit = 0ULL;
153 idle->idle_time += idle_time; 169 idle->idle_time += idle_time;
154 idle->idle_enter = idle->idle_exit = 0ULL;
155 idle->idle_count++; 170 idle->idle_count++;
156 account_idle_time(idle_time); 171 account_idle_time(idle_time);
157 smp_wmb(); 172 smp_wmb();
@@ -167,10 +182,10 @@ cputime64_t s390_get_idle_time(int cpu)
167 do { 182 do {
168 now = get_clock(); 183 now = get_clock();
169 sequence = ACCESS_ONCE(idle->sequence); 184 sequence = ACCESS_ONCE(idle->sequence);
170 idle_enter = ACCESS_ONCE(idle->idle_enter); 185 idle_enter = ACCESS_ONCE(idle->clock_idle_enter);
171 idle_exit = ACCESS_ONCE(idle->idle_exit); 186 idle_exit = ACCESS_ONCE(idle->clock_idle_exit);
172 } while ((sequence & 1) || (idle->sequence != sequence)); 187 } while ((sequence & 1) || (idle->sequence != sequence));
173 return idle_enter ? ((idle_exit ? : now) - idle_enter) : 0; 188 return idle_enter ? ((idle_exit ?: now) - idle_enter) : 0;
174} 189}
175 190
176/* 191/*
@@ -179,11 +194,11 @@ cputime64_t s390_get_idle_time(int cpu)
179 */ 194 */
180static void list_add_sorted(struct vtimer_list *timer, struct list_head *head) 195static void list_add_sorted(struct vtimer_list *timer, struct list_head *head)
181{ 196{
182 struct vtimer_list *event; 197 struct vtimer_list *tmp;
183 198
184 list_for_each_entry(event, head, entry) { 199 list_for_each_entry(tmp, head, entry) {
185 if (event->expires > timer->expires) { 200 if (tmp->expires > timer->expires) {
186 list_add_tail(&timer->entry, &event->entry); 201 list_add_tail(&timer->entry, &tmp->entry);
187 return; 202 return;
188 } 203 }
189 } 204 }
@@ -191,82 +206,45 @@ static void list_add_sorted(struct vtimer_list *timer, struct list_head *head)
191} 206}
192 207
193/* 208/*
194 * Do the callback functions of expired vtimer events. 209 * Handler for expired virtual CPU timer.
195 * Called from within the interrupt handler.
196 */
197static void do_callbacks(struct list_head *cb_list)
198{
199 struct vtimer_queue *vq;
200 struct vtimer_list *event, *tmp;
201
202 if (list_empty(cb_list))
203 return;
204
205 vq = &__get_cpu_var(virt_cpu_timer);
206
207 list_for_each_entry_safe(event, tmp, cb_list, entry) {
208 list_del_init(&event->entry);
209 (event->function)(event->data);
210 if (event->interval) {
211 /* Recharge interval timer */
212 event->expires = event->interval + vq->elapsed;
213 spin_lock(&vq->lock);
214 list_add_sorted(event, &vq->list);
215 spin_unlock(&vq->lock);
216 }
217 }
218}
219
220/*
221 * Handler for the virtual CPU timer.
222 */ 210 */
223static void do_cpu_timer_interrupt(struct ext_code ext_code, 211static void virt_timer_expire(void)
224 unsigned int param32, unsigned long param64)
225{ 212{
226 struct vtimer_queue *vq; 213 struct vtimer_list *timer, *tmp;
227 struct vtimer_list *event, *tmp; 214 unsigned long elapsed;
228 struct list_head cb_list; /* the callback queue */ 215 LIST_HEAD(cb_list);
229 __u64 elapsed, next; 216
230 217 /* walk timer list, fire all expired timers */
231 kstat_cpu(smp_processor_id()).irqs[EXTINT_TMR]++; 218 spin_lock(&virt_timer_lock);
232 INIT_LIST_HEAD(&cb_list); 219 elapsed = atomic64_read(&virt_timer_elapsed);
233 vq = &__get_cpu_var(virt_cpu_timer); 220 list_for_each_entry_safe(timer, tmp, &virt_timer_list, entry) {
234 221 if (timer->expires < elapsed)
235 /* walk timer list, fire all expired events */
236 spin_lock(&vq->lock);
237
238 elapsed = vq->elapsed + (vq->timer - S390_lowcore.async_enter_timer);
239 BUG_ON((s64) elapsed < 0);
240 vq->elapsed = 0;
241 list_for_each_entry_safe(event, tmp, &vq->list, entry) {
242 if (event->expires < elapsed)
243 /* move expired timer to the callback queue */ 222 /* move expired timer to the callback queue */
244 list_move_tail(&event->entry, &cb_list); 223 list_move_tail(&timer->entry, &cb_list);
245 else 224 else
246 event->expires -= elapsed; 225 timer->expires -= elapsed;
247 } 226 }
248 spin_unlock(&vq->lock); 227 if (!list_empty(&virt_timer_list)) {
249 228 timer = list_first_entry(&virt_timer_list,
250 do_callbacks(&cb_list); 229 struct vtimer_list, entry);
251 230 atomic64_set(&virt_timer_current, timer->expires);
252 /* next event is first in list */ 231 }
253 next = VTIMER_MAX_SLICE; 232 atomic64_sub(elapsed, &virt_timer_elapsed);
254 spin_lock(&vq->lock); 233 spin_unlock(&virt_timer_lock);
255 if (!list_empty(&vq->list)) { 234
256 event = list_first_entry(&vq->list, struct vtimer_list, entry); 235 /* Do callbacks and recharge periodic timers */
257 next = event->expires; 236 list_for_each_entry_safe(timer, tmp, &cb_list, entry) {
237 list_del_init(&timer->entry);
238 timer->function(timer->data);
239 if (timer->interval) {
240 /* Recharge interval timer */
241 timer->expires = timer->interval +
242 atomic64_read(&virt_timer_elapsed);
243 spin_lock(&virt_timer_lock);
244 list_add_sorted(timer, &virt_timer_list);
245 spin_unlock(&virt_timer_lock);
246 }
258 } 247 }
259 spin_unlock(&vq->lock);
260 /*
261 * To improve precision add the time spent by the
262 * interrupt handler to the elapsed time.
263 * Note: CPU timer counts down and we got an interrupt,
264 * the current content is negative
265 */
266 elapsed = S390_lowcore.async_enter_timer - get_vtimer();
267 set_vtimer(next - elapsed);
268 vq->timer = next - elapsed;
269 vq->elapsed = elapsed;
270} 248}
271 249
272void init_virt_timer(struct vtimer_list *timer) 250void init_virt_timer(struct vtimer_list *timer)
@@ -278,179 +256,108 @@ EXPORT_SYMBOL(init_virt_timer);
278 256
279static inline int vtimer_pending(struct vtimer_list *timer) 257static inline int vtimer_pending(struct vtimer_list *timer)
280{ 258{
281 return (!list_empty(&timer->entry)); 259 return !list_empty(&timer->entry);
282} 260}
283 261
284/*
285 * this function should only run on the specified CPU
286 */
287static void internal_add_vtimer(struct vtimer_list *timer) 262static void internal_add_vtimer(struct vtimer_list *timer)
288{ 263{
289 struct vtimer_queue *vq; 264 if (list_empty(&virt_timer_list)) {
290 unsigned long flags; 265 /* First timer, just program it. */
291 __u64 left, expires; 266 atomic64_set(&virt_timer_current, timer->expires);
292 267 atomic64_set(&virt_timer_elapsed, 0);
293 vq = &per_cpu(virt_cpu_timer, timer->cpu); 268 list_add(&timer->entry, &virt_timer_list);
294 spin_lock_irqsave(&vq->lock, flags);
295
296 BUG_ON(timer->cpu != smp_processor_id());
297
298 if (list_empty(&vq->list)) {
299 /* First timer on this cpu, just program it. */
300 list_add(&timer->entry, &vq->list);
301 set_vtimer(timer->expires);
302 vq->timer = timer->expires;
303 vq->elapsed = 0;
304 } else { 269 } else {
305 /* Check progress of old timers. */ 270 /* Update timer against current base. */
306 expires = timer->expires; 271 timer->expires += atomic64_read(&virt_timer_elapsed);
307 left = get_vtimer(); 272 if (likely((s64) timer->expires <
308 if (likely((s64) expires < (s64) left)) { 273 (s64) atomic64_read(&virt_timer_current)))
309 /* The new timer expires before the current timer. */ 274 /* The new timer expires before the current timer. */
310 set_vtimer(expires); 275 atomic64_set(&virt_timer_current, timer->expires);
311 vq->elapsed += vq->timer - left; 276 /* Insert new timer into the list. */
312 vq->timer = expires; 277 list_add_sorted(timer, &virt_timer_list);
313 } else {
314 vq->elapsed += vq->timer - left;
315 vq->timer = left;
316 }
317 /* Insert new timer into per cpu list. */
318 timer->expires += vq->elapsed;
319 list_add_sorted(timer, &vq->list);
320 } 278 }
321
322 spin_unlock_irqrestore(&vq->lock, flags);
323 /* release CPU acquired in prepare_vtimer or mod_virt_timer() */
324 put_cpu();
325} 279}
326 280
327static inline void prepare_vtimer(struct vtimer_list *timer) 281static void __add_vtimer(struct vtimer_list *timer, int periodic)
328{ 282{
329 BUG_ON(!timer->function); 283 unsigned long flags;
330 BUG_ON(!timer->expires || timer->expires > VTIMER_MAX_SLICE); 284
331 BUG_ON(vtimer_pending(timer)); 285 timer->interval = periodic ? timer->expires : 0;
332 timer->cpu = get_cpu(); 286 spin_lock_irqsave(&virt_timer_lock, flags);
287 internal_add_vtimer(timer);
288 spin_unlock_irqrestore(&virt_timer_lock, flags);
333} 289}
334 290
335/* 291/*
336 * add_virt_timer - add an oneshot virtual CPU timer 292 * add_virt_timer - add an oneshot virtual CPU timer
337 */ 293 */
338void add_virt_timer(void *new) 294void add_virt_timer(struct vtimer_list *timer)
339{ 295{
340 struct vtimer_list *timer; 296 __add_vtimer(timer, 0);
341
342 timer = (struct vtimer_list *)new;
343 prepare_vtimer(timer);
344 timer->interval = 0;
345 internal_add_vtimer(timer);
346} 297}
347EXPORT_SYMBOL(add_virt_timer); 298EXPORT_SYMBOL(add_virt_timer);
348 299
349/* 300/*
350 * add_virt_timer_int - add an interval virtual CPU timer 301 * add_virt_timer_int - add an interval virtual CPU timer
351 */ 302 */
352void add_virt_timer_periodic(void *new) 303void add_virt_timer_periodic(struct vtimer_list *timer)
353{ 304{
354 struct vtimer_list *timer; 305 __add_vtimer(timer, 1);
355
356 timer = (struct vtimer_list *)new;
357 prepare_vtimer(timer);
358 timer->interval = timer->expires;
359 internal_add_vtimer(timer);
360} 306}
361EXPORT_SYMBOL(add_virt_timer_periodic); 307EXPORT_SYMBOL(add_virt_timer_periodic);
362 308
363static int __mod_vtimer(struct vtimer_list *timer, __u64 expires, int periodic) 309static int __mod_vtimer(struct vtimer_list *timer, u64 expires, int periodic)
364{ 310{
365 struct vtimer_queue *vq;
366 unsigned long flags; 311 unsigned long flags;
367 int cpu; 312 int rc;
368 313
369 BUG_ON(!timer->function); 314 BUG_ON(!timer->function);
370 BUG_ON(!expires || expires > VTIMER_MAX_SLICE);
371 315
372 if (timer->expires == expires && vtimer_pending(timer)) 316 if (timer->expires == expires && vtimer_pending(timer))
373 return 1; 317 return 1;
374 318 spin_lock_irqsave(&virt_timer_lock, flags);
375 cpu = get_cpu(); 319 rc = vtimer_pending(timer);
376 vq = &per_cpu(virt_cpu_timer, cpu); 320 if (rc)
377 321 list_del_init(&timer->entry);
378 /* disable interrupts before test if timer is pending */ 322 timer->interval = periodic ? expires : 0;
379 spin_lock_irqsave(&vq->lock, flags);
380
381 /* if timer isn't pending add it on the current CPU */
382 if (!vtimer_pending(timer)) {
383 spin_unlock_irqrestore(&vq->lock, flags);
384
385 if (periodic)
386 timer->interval = expires;
387 else
388 timer->interval = 0;
389 timer->expires = expires;
390 timer->cpu = cpu;
391 internal_add_vtimer(timer);
392 return 0;
393 }
394
395 /* check if we run on the right CPU */
396 BUG_ON(timer->cpu != cpu);
397
398 list_del_init(&timer->entry);
399 timer->expires = expires; 323 timer->expires = expires;
400 if (periodic)
401 timer->interval = expires;
402
403 /* the timer can't expire anymore so we can release the lock */
404 spin_unlock_irqrestore(&vq->lock, flags);
405 internal_add_vtimer(timer); 324 internal_add_vtimer(timer);
406 return 1; 325 spin_unlock_irqrestore(&virt_timer_lock, flags);
326 return rc;
407} 327}
408 328
409/* 329/*
410 * If we change a pending timer the function must be called on the CPU
411 * where the timer is running on.
412 *
413 * returns whether it has modified a pending timer (1) or not (0) 330 * returns whether it has modified a pending timer (1) or not (0)
414 */ 331 */
415int mod_virt_timer(struct vtimer_list *timer, __u64 expires) 332int mod_virt_timer(struct vtimer_list *timer, u64 expires)
416{ 333{
417 return __mod_vtimer(timer, expires, 0); 334 return __mod_vtimer(timer, expires, 0);
418} 335}
419EXPORT_SYMBOL(mod_virt_timer); 336EXPORT_SYMBOL(mod_virt_timer);
420 337
421/* 338/*
422 * If we change a pending timer the function must be called on the CPU
423 * where the timer is running on.
424 *
425 * returns whether it has modified a pending timer (1) or not (0) 339 * returns whether it has modified a pending timer (1) or not (0)
426 */ 340 */
427int mod_virt_timer_periodic(struct vtimer_list *timer, __u64 expires) 341int mod_virt_timer_periodic(struct vtimer_list *timer, u64 expires)
428{ 342{
429 return __mod_vtimer(timer, expires, 1); 343 return __mod_vtimer(timer, expires, 1);
430} 344}
431EXPORT_SYMBOL(mod_virt_timer_periodic); 345EXPORT_SYMBOL(mod_virt_timer_periodic);
432 346
433/* 347/*
434 * delete a virtual timer 348 * Delete a virtual timer.
435 * 349 *
436 * returns whether the deleted timer was pending (1) or not (0) 350 * returns whether the deleted timer was pending (1) or not (0)
437 */ 351 */
438int del_virt_timer(struct vtimer_list *timer) 352int del_virt_timer(struct vtimer_list *timer)
439{ 353{
440 unsigned long flags; 354 unsigned long flags;
441 struct vtimer_queue *vq;
442 355
443 /* check if timer is pending */
444 if (!vtimer_pending(timer)) 356 if (!vtimer_pending(timer))
445 return 0; 357 return 0;
446 358 spin_lock_irqsave(&virt_timer_lock, flags);
447 vq = &per_cpu(virt_cpu_timer, timer->cpu);
448 spin_lock_irqsave(&vq->lock, flags);
449
450 /* we don't interrupt a running timer, just let it expire! */
451 list_del_init(&timer->entry); 359 list_del_init(&timer->entry);
452 360 spin_unlock_irqrestore(&virt_timer_lock, flags);
453 spin_unlock_irqrestore(&vq->lock, flags);
454 return 1; 361 return 1;
455} 362}
456EXPORT_SYMBOL(del_virt_timer); 363EXPORT_SYMBOL(del_virt_timer);
@@ -458,20 +365,10 @@ EXPORT_SYMBOL(del_virt_timer);
458/* 365/*
459 * Start the virtual CPU timer on the current CPU. 366 * Start the virtual CPU timer on the current CPU.
460 */ 367 */
461void init_cpu_vtimer(void) 368void __cpuinit init_cpu_vtimer(void)
462{ 369{
463 struct vtimer_queue *vq;
464
465 /* initialize per cpu vtimer structure */
466 vq = &__get_cpu_var(virt_cpu_timer);
467 INIT_LIST_HEAD(&vq->list);
468 spin_lock_init(&vq->lock);
469
470 /* enable cpu timer interrupts */
471 __ctl_set_bit(0,10);
472
473 /* set initial cpu timer */ 370 /* set initial cpu timer */
474 set_vtimer(0x7fffffffffffffffULL); 371 set_vtimer(VTIMER_MAX_SLICE);
475} 372}
476 373
477static int __cpuinit s390_nohz_notify(struct notifier_block *self, 374static int __cpuinit s390_nohz_notify(struct notifier_block *self,
@@ -493,12 +390,7 @@ static int __cpuinit s390_nohz_notify(struct notifier_block *self,
493 390
494void __init vtime_init(void) 391void __init vtime_init(void)
495{ 392{
496 /* request the cpu timer external interrupt */
497 if (register_external_interrupt(0x1005, do_cpu_timer_interrupt))
498 panic("Couldn't request external interrupt 0x1005");
499
500 /* Enable cpu timer interrupts on the boot cpu. */ 393 /* Enable cpu timer interrupts on the boot cpu. */
501 init_cpu_vtimer(); 394 init_cpu_vtimer();
502 cpu_notifier(s390_nohz_notify, 0); 395 cpu_notifier(s390_nohz_notify, 0);
503} 396}
504