aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/Makefile4
-rw-r--r--arch/s390/kernel/asm-offsets.c100
-rw-r--r--arch/s390/kernel/base.S2
-rw-r--r--arch/s390/kernel/compat_linux.c133
-rw-r--r--arch/s390/kernel/compat_linux.h6
-rw-r--r--arch/s390/kernel/compat_wrapper.S8
-rw-r--r--arch/s390/kernel/debug.c16
-rw-r--r--arch/s390/kernel/dis.c369
-rw-r--r--arch/s390/kernel/early.c25
-rw-r--r--arch/s390/kernel/entry.S10
-rw-r--r--arch/s390/kernel/entry.h10
-rw-r--r--arch/s390/kernel/entry64.S11
-rw-r--r--arch/s390/kernel/ftrace.c75
-rw-r--r--arch/s390/kernel/head.S63
-rw-r--r--arch/s390/kernel/head31.S18
-rw-r--r--arch/s390/kernel/head64.S93
-rw-r--r--arch/s390/kernel/ipl.c48
-rw-r--r--arch/s390/kernel/kprobes.c1
-rw-r--r--arch/s390/kernel/machine_kexec.c10
-rw-r--r--arch/s390/kernel/process.c5
-rw-r--r--arch/s390/kernel/ptrace.c73
-rw-r--r--arch/s390/kernel/reipl.S2
-rw-r--r--arch/s390/kernel/reipl64.S2
-rw-r--r--arch/s390/kernel/s390_ext.c2
-rw-r--r--arch/s390/kernel/sclp.S38
-rw-r--r--arch/s390/kernel/setup.c58
-rw-r--r--arch/s390/kernel/signal.c12
-rw-r--r--arch/s390/kernel/smp.c132
-rw-r--r--arch/s390/kernel/switch_cpu.S58
-rw-r--r--arch/s390/kernel/switch_cpu64.S51
-rw-r--r--arch/s390/kernel/swsusp_asm64.S5
-rw-r--r--arch/s390/kernel/sys_s390.c71
-rw-r--r--arch/s390/kernel/syscalls.S6
-rw-r--r--arch/s390/kernel/sysinfo.c1
-rw-r--r--arch/s390/kernel/time.c76
-rw-r--r--arch/s390/kernel/topology.c5
-rw-r--r--arch/s390/kernel/traps.c6
-rw-r--r--arch/s390/kernel/vdso.c10
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S12
-rw-r--r--arch/s390/kernel/vdso32/gettimeofday.S6
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S4
-rw-r--r--arch/s390/kernel/vdso64/gettimeofday.S2
-rw-r--r--arch/s390/kernel/vtime.c2
43 files changed, 956 insertions, 685 deletions
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index c7be8e10b87e..64230bc392fa 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -29,9 +29,12 @@ obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
30 30
31extra-y += head.o init_task.o vmlinux.lds 31extra-y += head.o init_task.o vmlinux.lds
32extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o)
32 33
33obj-$(CONFIG_MODULES) += s390_ksyms.o module.o 34obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
34obj-$(CONFIG_SMP) += smp.o topology.o 35obj-$(CONFIG_SMP) += smp.o topology.o
36obj-$(CONFIG_SMP) += $(if $(CONFIG_64BIT),switch_cpu64.o, \
37 switch_cpu.o)
35obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o 38obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o
36obj-$(CONFIG_AUDIT) += audit.o 39obj-$(CONFIG_AUDIT) += audit.o
37compat-obj-$(CONFIG_AUDIT) += compat_audit.o 40compat-obj-$(CONFIG_AUDIT) += compat_audit.o
@@ -44,6 +47,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o
44obj-$(CONFIG_FUNCTION_TRACER) += $(if $(CONFIG_64BIT),mcount64.o,mcount.o) 47obj-$(CONFIG_FUNCTION_TRACER) += $(if $(CONFIG_64BIT),mcount64.o,mcount.o)
45obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 48obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
46obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 49obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
50obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
47 51
48# Kexec part 52# Kexec part
49S390_KEXEC_OBJS := machine_kexec.o crash.o 53S390_KEXEC_OBJS := machine_kexec.o crash.o
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 63e46433e81d..a09408952ed0 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -4,18 +4,27 @@
4 * and format the required data. 4 * and format the required data.
5 */ 5 */
6 6
7#include <linux/sched.h> 7#define ASM_OFFSETS_C
8
8#include <linux/kbuild.h> 9#include <linux/kbuild.h>
10#include <linux/sched.h>
9#include <asm/vdso.h> 11#include <asm/vdso.h>
10#include <asm/sigp.h> 12#include <asm/sigp.h>
11 13
14/*
15 * Make sure that the compiler is new enough. We want a compiler that
16 * is known to work with the "Q" assembler constraint.
17 */
18#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
19#error Your compiler is too old; please use version 3.3.3 or newer
20#endif
21
12int main(void) 22int main(void)
13{ 23{
14 DEFINE(__THREAD_info, offsetof(struct task_struct, stack)); 24 DEFINE(__THREAD_info, offsetof(struct task_struct, stack));
15 DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp)); 25 DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp));
16 DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info)); 26 DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info));
17 DEFINE(__THREAD_mm_segment, 27 DEFINE(__THREAD_mm_segment, offsetof(struct task_struct, thread.mm_segment));
18 offsetof(struct task_struct, thread.mm_segment));
19 BLANK(); 28 BLANK();
20 DEFINE(__TASK_pid, offsetof(struct task_struct, pid)); 29 DEFINE(__TASK_pid, offsetof(struct task_struct, pid));
21 BLANK(); 30 BLANK();
@@ -52,18 +61,95 @@ int main(void)
52 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 61 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
53 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest)); 62 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
54 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available)); 63 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available));
55 DEFINE(__VDSO_ECTG_BASE, 64 DEFINE(__VDSO_NTP_MULT, offsetof(struct vdso_data, ntp_mult));
56 offsetof(struct vdso_per_cpu_data, ectg_timer_base)); 65 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base));
57 DEFINE(__VDSO_ECTG_USER, 66 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time));
58 offsetof(struct vdso_per_cpu_data, ectg_user_time));
59 /* constants used by the vdso */ 67 /* constants used by the vdso */
60 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); 68 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
61 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); 69 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
62 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 70 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
71 BLANK();
63 /* constants for SIGP */ 72 /* constants for SIGP */
64 DEFINE(__SIGP_STOP, sigp_stop); 73 DEFINE(__SIGP_STOP, sigp_stop);
65 DEFINE(__SIGP_RESTART, sigp_restart); 74 DEFINE(__SIGP_RESTART, sigp_restart);
66 DEFINE(__SIGP_SENSE, sigp_sense); 75 DEFINE(__SIGP_SENSE, sigp_sense);
67 DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset); 76 DEFINE(__SIGP_INITIAL_CPU_RESET, sigp_initial_cpu_reset);
77 BLANK();
78 /* lowcore offsets */
79 DEFINE(__LC_EXT_PARAMS, offsetof(struct _lowcore, ext_params));
80 DEFINE(__LC_CPU_ADDRESS, offsetof(struct _lowcore, cpu_addr));
81 DEFINE(__LC_EXT_INT_CODE, offsetof(struct _lowcore, ext_int_code));
82 DEFINE(__LC_SVC_ILC, offsetof(struct _lowcore, svc_ilc));
83 DEFINE(__LC_SVC_INT_CODE, offsetof(struct _lowcore, svc_code));
84 DEFINE(__LC_PGM_ILC, offsetof(struct _lowcore, pgm_ilc));
85 DEFINE(__LC_PGM_INT_CODE, offsetof(struct _lowcore, pgm_code));
86 DEFINE(__LC_PER_ATMID, offsetof(struct _lowcore, per_perc_atmid));
87 DEFINE(__LC_PER_ADDRESS, offsetof(struct _lowcore, per_address));
88 DEFINE(__LC_PER_ACCESS_ID, offsetof(struct _lowcore, per_access_id));
89 DEFINE(__LC_AR_MODE_ID, offsetof(struct _lowcore, ar_access_id));
90 DEFINE(__LC_SUBCHANNEL_ID, offsetof(struct _lowcore, subchannel_id));
91 DEFINE(__LC_SUBCHANNEL_NR, offsetof(struct _lowcore, subchannel_nr));
92 DEFINE(__LC_IO_INT_PARM, offsetof(struct _lowcore, io_int_parm));
93 DEFINE(__LC_IO_INT_WORD, offsetof(struct _lowcore, io_int_word));
94 DEFINE(__LC_STFL_FAC_LIST, offsetof(struct _lowcore, stfl_fac_list));
95 DEFINE(__LC_MCCK_CODE, offsetof(struct _lowcore, mcck_interruption_code));
96 DEFINE(__LC_DUMP_REIPL, offsetof(struct _lowcore, ipib));
97 BLANK();
98 DEFINE(__LC_RST_NEW_PSW, offsetof(struct _lowcore, restart_psw));
99 DEFINE(__LC_RST_OLD_PSW, offsetof(struct _lowcore, restart_old_psw));
100 DEFINE(__LC_EXT_OLD_PSW, offsetof(struct _lowcore, external_old_psw));
101 DEFINE(__LC_SVC_OLD_PSW, offsetof(struct _lowcore, svc_old_psw));
102 DEFINE(__LC_PGM_OLD_PSW, offsetof(struct _lowcore, program_old_psw));
103 DEFINE(__LC_MCK_OLD_PSW, offsetof(struct _lowcore, mcck_old_psw));
104 DEFINE(__LC_IO_OLD_PSW, offsetof(struct _lowcore, io_old_psw));
105 DEFINE(__LC_EXT_NEW_PSW, offsetof(struct _lowcore, external_new_psw));
106 DEFINE(__LC_SVC_NEW_PSW, offsetof(struct _lowcore, svc_new_psw));
107 DEFINE(__LC_PGM_NEW_PSW, offsetof(struct _lowcore, program_new_psw));
108 DEFINE(__LC_MCK_NEW_PSW, offsetof(struct _lowcore, mcck_new_psw));
109 DEFINE(__LC_IO_NEW_PSW, offsetof(struct _lowcore, io_new_psw));
110 DEFINE(__LC_SAVE_AREA, offsetof(struct _lowcore, save_area));
111 DEFINE(__LC_RETURN_PSW, offsetof(struct _lowcore, return_psw));
112 DEFINE(__LC_RETURN_MCCK_PSW, offsetof(struct _lowcore, return_mcck_psw));
113 DEFINE(__LC_SYNC_ENTER_TIMER, offsetof(struct _lowcore, sync_enter_timer));
114 DEFINE(__LC_ASYNC_ENTER_TIMER, offsetof(struct _lowcore, async_enter_timer));
115 DEFINE(__LC_EXIT_TIMER, offsetof(struct _lowcore, exit_timer));
116 DEFINE(__LC_USER_TIMER, offsetof(struct _lowcore, user_timer));
117 DEFINE(__LC_SYSTEM_TIMER, offsetof(struct _lowcore, system_timer));
118 DEFINE(__LC_STEAL_TIMER, offsetof(struct _lowcore, steal_timer));
119 DEFINE(__LC_LAST_UPDATE_TIMER, offsetof(struct _lowcore, last_update_timer));
120 DEFINE(__LC_LAST_UPDATE_CLOCK, offsetof(struct _lowcore, last_update_clock));
121 DEFINE(__LC_CURRENT, offsetof(struct _lowcore, current_task));
122 DEFINE(__LC_THREAD_INFO, offsetof(struct _lowcore, thread_info));
123 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
124 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
125 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
126 DEFINE(__LC_KERNEL_ASCE, offsetof(struct _lowcore, kernel_asce));
127 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
128 DEFINE(__LC_USER_EXEC_ASCE, offsetof(struct _lowcore, user_exec_asce));
129 DEFINE(__LC_CPUID, offsetof(struct _lowcore, cpu_id));
130 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
131 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
132 DEFINE(__LC_FTRACE_FUNC, offsetof(struct _lowcore, ftrace_func));
133 DEFINE(__LC_IRB, offsetof(struct _lowcore, irb));
134 DEFINE(__LC_CPU_TIMER_SAVE_AREA, offsetof(struct _lowcore, cpu_timer_save_area));
135 DEFINE(__LC_CLOCK_COMP_SAVE_AREA, offsetof(struct _lowcore, clock_comp_save_area));
136 DEFINE(__LC_PSW_SAVE_AREA, offsetof(struct _lowcore, psw_save_area));
137 DEFINE(__LC_PREFIX_SAVE_AREA, offsetof(struct _lowcore, prefixreg_save_area));
138 DEFINE(__LC_AREGS_SAVE_AREA, offsetof(struct _lowcore, access_regs_save_area));
139 DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area));
140 DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area));
141 DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area));
142#ifdef CONFIG_32BIT
143 DEFINE(__LC_PFAULT_INTPARM, offsetof(struct _lowcore, ext_params));
144 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr));
145#else /* CONFIG_32BIT */
146 DEFINE(__LC_PFAULT_INTPARM, offsetof(struct _lowcore, ext_params2));
147 DEFINE(__LC_EXT_PARAMS2, offsetof(struct _lowcore, ext_params2));
148 DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, floating_pt_save_area));
149 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste));
150 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area));
151 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr));
152 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
153#endif /* CONFIG_32BIT */
68 return 0; 154 return 0;
69} 155}
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S
index dc7e5259770f..15e46ca94335 100644
--- a/arch/s390/kernel/base.S
+++ b/arch/s390/kernel/base.S
@@ -6,8 +6,8 @@
6 * Michael Holzheu <holzheu@de.ibm.com> 6 * Michael Holzheu <holzheu@de.ibm.com>
7 */ 7 */
8 8
9#include <asm/asm-offsets.h>
9#include <asm/ptrace.h> 10#include <asm/ptrace.h>
10#include <asm/lowcore.h>
11 11
12#ifdef CONFIG_64BIT 12#ifdef CONFIG_64BIT
13 13
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 0debcec23a39..73b624ed9cd8 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -29,16 +29,9 @@
29#include <linux/sem.h> 29#include <linux/sem.h>
30#include <linux/msg.h> 30#include <linux/msg.h>
31#include <linux/shm.h> 31#include <linux/shm.h>
32#include <linux/slab.h>
33#include <linux/uio.h> 32#include <linux/uio.h>
34#include <linux/nfs_fs.h>
35#include <linux/quota.h> 33#include <linux/quota.h>
36#include <linux/module.h> 34#include <linux/module.h>
37#include <linux/sunrpc/svc.h>
38#include <linux/nfsd/nfsd.h>
39#include <linux/nfsd/cache.h>
40#include <linux/nfsd/xdr.h>
41#include <linux/nfsd/syscall.h>
42#include <linux/poll.h> 35#include <linux/poll.h>
43#include <linux/personality.h> 36#include <linux/personality.h>
44#include <linux/stat.h> 37#include <linux/stat.h>
@@ -58,6 +51,7 @@
58#include <linux/ptrace.h> 51#include <linux/ptrace.h>
59#include <linux/fadvise.h> 52#include <linux/fadvise.h>
60#include <linux/ipc.h> 53#include <linux/ipc.h>
54#include <linux/slab.h>
61 55
62#include <asm/types.h> 56#include <asm/types.h>
63#include <asm/uaccess.h> 57#include <asm/uaccess.h>
@@ -527,59 +521,6 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
527 return ret; 521 return ret;
528} 522}
529 523
530#ifdef CONFIG_SYSCTL_SYSCALL
531struct __sysctl_args32 {
532 u32 name;
533 int nlen;
534 u32 oldval;
535 u32 oldlenp;
536 u32 newval;
537 u32 newlen;
538 u32 __unused[4];
539};
540
541asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
542{
543 struct __sysctl_args32 tmp;
544 int error;
545 size_t oldlen;
546 size_t __user *oldlenp = NULL;
547 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
548
549 if (copy_from_user(&tmp, args, sizeof(tmp)))
550 return -EFAULT;
551
552 if (tmp.oldval && tmp.oldlenp) {
553 /* Duh, this is ugly and might not work if sysctl_args
554 is in read-only memory, but do_sysctl does indirectly
555 a lot of uaccess in both directions and we'd have to
556 basically copy the whole sysctl.c here, and
557 glibc's __sysctl uses rw memory for the structure
558 anyway. */
559 if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) ||
560 put_user(oldlen, (size_t __user *)addr))
561 return -EFAULT;
562 oldlenp = (size_t __user *)addr;
563 }
564
565 lock_kernel();
566 error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
567 oldlenp, compat_ptr(tmp.newval), tmp.newlen);
568 unlock_kernel();
569 if (oldlenp) {
570 if (!error) {
571 if (get_user(oldlen, (size_t __user *)addr) ||
572 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
573 error = -EFAULT;
574 }
575 if (copy_to_user(args->__unused, tmp.__unused,
576 sizeof(tmp.__unused)))
577 error = -EFAULT;
578 }
579 return error;
580}
581#endif
582
583struct stat64_emu31 { 524struct stat64_emu31 {
584 unsigned long long st_dev; 525 unsigned long long st_dev;
585 unsigned int __pad1; 526 unsigned int __pad1;
@@ -675,75 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
675 */ 616 */
676 617
677struct mmap_arg_struct_emu31 { 618struct mmap_arg_struct_emu31 {
678 u32 addr; 619 compat_ulong_t addr;
679 u32 len; 620 compat_ulong_t len;
680 u32 prot; 621 compat_ulong_t prot;
681 u32 flags; 622 compat_ulong_t flags;
682 u32 fd; 623 compat_ulong_t fd;
683 u32 offset; 624 compat_ulong_t offset;
684}; 625};
685 626
686/* common code for old and new mmaps */ 627asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
687static inline long do_mmap2(
688 unsigned long addr, unsigned long len,
689 unsigned long prot, unsigned long flags,
690 unsigned long fd, unsigned long pgoff)
691{
692 struct file * file = NULL;
693 unsigned long error = -EBADF;
694
695 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
696 if (!(flags & MAP_ANONYMOUS)) {
697 file = fget(fd);
698 if (!file)
699 goto out;
700 }
701
702 down_write(&current->mm->mmap_sem);
703 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
704 if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
705 /* Result is out of bounds. */
706 do_munmap(current->mm, addr, len);
707 error = -ENOMEM;
708 }
709 up_write(&current->mm->mmap_sem);
710
711 if (file)
712 fput(file);
713out:
714 return error;
715}
716
717
718asmlinkage unsigned long
719old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
720{ 628{
721 struct mmap_arg_struct_emu31 a; 629 struct mmap_arg_struct_emu31 a;
722 int error = -EFAULT;
723 630
724 if (copy_from_user(&a, arg, sizeof(a))) 631 if (copy_from_user(&a, arg, sizeof(a)))
725 goto out; 632 return -EFAULT;
726
727 error = -EINVAL;
728 if (a.offset & ~PAGE_MASK) 633 if (a.offset & ~PAGE_MASK)
729 goto out; 634 return -EINVAL;
730 635 a.addr = (unsigned long) compat_ptr(a.addr);
731 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 636 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
732out: 637 a.offset >> PAGE_SHIFT);
733 return error;
734} 638}
735 639
736asmlinkage long 640asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
737sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
738{ 641{
739 struct mmap_arg_struct_emu31 a; 642 struct mmap_arg_struct_emu31 a;
740 int error = -EFAULT;
741 643
742 if (copy_from_user(&a, arg, sizeof(a))) 644 if (copy_from_user(&a, arg, sizeof(a)))
743 goto out; 645 return -EFAULT;
744 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 646 a.addr = (unsigned long) compat_ptr(a.addr);
745out: 647 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
746 return error;
747} 648}
748 649
749asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) 650asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index c07f9ca05ade..cb97afc85c94 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -4,10 +4,6 @@
4#include <linux/compat.h> 4#include <linux/compat.h>
5#include <linux/socket.h> 5#include <linux/socket.h>
6#include <linux/syscalls.h> 6#include <linux/syscalls.h>
7#include <linux/nfs_fs.h>
8#include <linux/sunrpc/svc.h>
9#include <linux/nfsd/nfsd.h>
10#include <linux/nfsd/export.h>
11 7
12/* Macro that masks the high order bit of an 32 bit pointer and converts it*/ 8/* Macro that masks the high order bit of an 32 bit pointer and converts it*/
13/* to a 64 bit pointer */ 9/* to a 64 bit pointer */
@@ -162,7 +158,6 @@ struct ucontext32 {
162 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 158 compat_sigset_t uc_sigmask; /* mask last for extensibility */
163}; 159};
164 160
165struct __sysctl_args32;
166struct stat64_emu31; 161struct stat64_emu31;
167struct mmap_arg_struct_emu31; 162struct mmap_arg_struct_emu31;
168struct fadvise64_64_args; 163struct fadvise64_64_args;
@@ -212,7 +207,6 @@ long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
212 size_t count); 207 size_t count);
213long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, 208long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
214 s32 count); 209 s32 count);
215long sys32_sysctl(struct __sysctl_args32 __user *args);
216long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf); 210long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf);
217long sys32_lstat64(char __user * filename, 211long sys32_lstat64(char __user * filename,
218 struct stat64_emu31 __user * statbuf); 212 struct stat64_emu31 __user * statbuf);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index cbd9901dc0f8..672ce52341b4 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -547,7 +547,7 @@ sys32_setdomainname_wrapper:
547 .globl sys32_newuname_wrapper 547 .globl sys32_newuname_wrapper
548sys32_newuname_wrapper: 548sys32_newuname_wrapper:
549 llgtr %r2,%r2 # struct new_utsname * 549 llgtr %r2,%r2 # struct new_utsname *
550 jg sys_s390_newuname # branch to system call 550 jg sys_newuname # branch to system call
551 551
552 .globl compat_sys_adjtimex_wrapper 552 .globl compat_sys_adjtimex_wrapper
553compat_sys_adjtimex_wrapper: 553compat_sys_adjtimex_wrapper:
@@ -689,8 +689,6 @@ sys32_fdatasync_wrapper:
689 llgfr %r2,%r2 # unsigned int 689 llgfr %r2,%r2 # unsigned int
690 jg sys_fdatasync # branch to system call 690 jg sys_fdatasync # branch to system call
691 691
692#sys32_sysctl_wrapper # tbd
693
694 .globl sys32_mlock_wrapper 692 .globl sys32_mlock_wrapper
695sys32_mlock_wrapper: 693sys32_mlock_wrapper:
696 llgfr %r2,%r2 # unsigned long 694 llgfr %r2,%r2 # unsigned long
@@ -1087,8 +1085,8 @@ sys32_stime_wrapper:
1087 1085
1088 .globl sys32_sysctl_wrapper 1086 .globl sys32_sysctl_wrapper
1089sys32_sysctl_wrapper: 1087sys32_sysctl_wrapper:
1090 llgtr %r2,%r2 # struct __sysctl_args32 * 1088 llgtr %r2,%r2 # struct compat_sysctl_args *
1091 jg sys32_sysctl 1089 jg compat_sys_sysctl
1092 1090
1093 .globl sys32_fstat64_wrapper 1091 .globl sys32_fstat64_wrapper
1094sys32_fstat64_wrapper: 1092sys32_fstat64_wrapper:
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 20f282c911c2..0168472b2fdf 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/ctype.h> 20#include <linux/ctype.h>
21#include <linux/string.h>
21#include <linux/sysctl.h> 22#include <linux/sysctl.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -893,35 +894,30 @@ s390dbf_procactive(ctl_table *table, int write,
893 894
894static struct ctl_table s390dbf_table[] = { 895static struct ctl_table s390dbf_table[] = {
895 { 896 {
896 .ctl_name = CTL_S390DBF_STOPPABLE,
897 .procname = "debug_stoppable", 897 .procname = "debug_stoppable",
898 .data = &debug_stoppable, 898 .data = &debug_stoppable,
899 .maxlen = sizeof(int), 899 .maxlen = sizeof(int),
900 .mode = S_IRUGO | S_IWUSR, 900 .mode = S_IRUGO | S_IWUSR,
901 .proc_handler = &proc_dointvec, 901 .proc_handler = proc_dointvec,
902 .strategy = &sysctl_intvec,
903 }, 902 },
904 { 903 {
905 .ctl_name = CTL_S390DBF_ACTIVE,
906 .procname = "debug_active", 904 .procname = "debug_active",
907 .data = &debug_active, 905 .data = &debug_active,
908 .maxlen = sizeof(int), 906 .maxlen = sizeof(int),
909 .mode = S_IRUGO | S_IWUSR, 907 .mode = S_IRUGO | S_IWUSR,
910 .proc_handler = &s390dbf_procactive, 908 .proc_handler = s390dbf_procactive,
911 .strategy = &sysctl_intvec,
912 }, 909 },
913 { .ctl_name = 0 } 910 { }
914}; 911};
915 912
916static struct ctl_table s390dbf_dir_table[] = { 913static struct ctl_table s390dbf_dir_table[] = {
917 { 914 {
918 .ctl_name = CTL_S390DBF,
919 .procname = "s390dbf", 915 .procname = "s390dbf",
920 .maxlen = 0, 916 .maxlen = 0,
921 .mode = S_IRUGO | S_IXUGO, 917 .mode = S_IRUGO | S_IXUGO,
922 .child = s390dbf_table, 918 .child = s390dbf_table,
923 }, 919 },
924 { .ctl_name = 0 } 920 { }
925}; 921};
926 922
927static struct ctl_table_header *s390dbf_sysctl_header; 923static struct ctl_table_header *s390dbf_sysctl_header;
@@ -1183,7 +1179,7 @@ debug_get_uint(char *buf)
1183{ 1179{
1184 int rc; 1180 int rc;
1185 1181
1186 for(; isspace(*buf); buf++); 1182 buf = skip_spaces(buf);
1187 rc = simple_strtoul(buf, &buf, 10); 1183 rc = simple_strtoul(buf, &buf, 10);
1188 if(*buf){ 1184 if(*buf){
1189 rc = -EINVAL; 1185 rc = -EINVAL;
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index db943a7ec513..b39b27d68b45 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -86,10 +86,17 @@ enum {
86 U4_12, /* 4 bit unsigned value starting at 12 */ 86 U4_12, /* 4 bit unsigned value starting at 12 */
87 U4_16, /* 4 bit unsigned value starting at 16 */ 87 U4_16, /* 4 bit unsigned value starting at 16 */
88 U4_20, /* 4 bit unsigned value starting at 20 */ 88 U4_20, /* 4 bit unsigned value starting at 20 */
89 U4_32, /* 4 bit unsigned value starting at 32 */
89 U8_8, /* 8 bit unsigned value starting at 8 */ 90 U8_8, /* 8 bit unsigned value starting at 8 */
90 U8_16, /* 8 bit unsigned value starting at 16 */ 91 U8_16, /* 8 bit unsigned value starting at 16 */
92 U8_24, /* 8 bit unsigned value starting at 24 */
93 U8_32, /* 8 bit unsigned value starting at 32 */
94 I8_8, /* 8 bit signed value starting at 8 */
95 I8_32, /* 8 bit signed value starting at 32 */
91 I16_16, /* 16 bit signed value starting at 16 */ 96 I16_16, /* 16 bit signed value starting at 16 */
97 I16_32, /* 32 bit signed value starting at 16 */
92 U16_16, /* 16 bit unsigned value starting at 16 */ 98 U16_16, /* 16 bit unsigned value starting at 16 */
99 U16_32, /* 32 bit unsigned value starting at 16 */
93 J16_16, /* PC relative jump offset at 16 */ 100 J16_16, /* PC relative jump offset at 16 */
94 J32_16, /* PC relative long offset at 16 */ 101 J32_16, /* PC relative long offset at 16 */
95 I32_16, /* 32 bit signed value starting at 16 */ 102 I32_16, /* 32 bit signed value starting at 16 */
@@ -104,21 +111,37 @@ enum {
104 */ 111 */
105enum { 112enum {
106 INSTR_INVALID, 113 INSTR_INVALID,
107 INSTR_E, INSTR_RIE_RRP, INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, 114 INSTR_E,
108 INSTR_RIL_UP, INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP, 115 INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU,
116 INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU,
117 INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP,
118 INSTR_RIS_R0RDU, INSTR_RIS_R0UU, INSTR_RIS_RURDI, INSTR_RIS_RURDU,
119 INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP,
109 INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0, 120 INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0,
110 INSTR_RRE_FF, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF, INSTR_RRE_RR, 121 INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF,
111 INSTR_RRE_RR_OPT, INSTR_RRF_F0FF, INSTR_RRF_FUFF, INSTR_RRF_M0RR, 122 INSTR_RRE_RR, INSTR_RRE_RR_OPT,
112 INSTR_RRF_R0RR, INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, 123 INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR,
124 INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_M0RR, INSTR_RRF_R0RR,
125 INSTR_RRF_RURR, INSTR_RRF_U0FF, INSTR_RRF_U0RF, INSTR_RRF_U0RR,
126 INSTR_RRF_UUFF, INSTR_RRR_F0FF, INSTR_RRS_RRRDU,
113 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR, 127 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR,
114 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD, INSTR_RSI_RRP, 128 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD,
115 INSTR_RSL_R0RD, INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, 129 INSTR_RSI_RRP,
116 INSTR_RSY_RURD, INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, 130 INSTR_RSL_R0RD,
117 INSTR_RS_RRRD, INSTR_RS_RURD, INSTR_RXE_FRRD, INSTR_RXE_RRRD, 131 INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD,
118 INSTR_RXF_FRRDF, INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RX_FRRD, 132 INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD,
119 INSTR_RX_RRRD, INSTR_RX_URRD, INSTR_SIY_URD, INSTR_SI_URD, 133 INSTR_RS_RURD,
120 INSTR_SSE_RDRD, INSTR_SSF_RRDRD, INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, 134 INSTR_RXE_FRRD, INSTR_RXE_RRRD,
121 INSTR_SS_LLRDRD, INSTR_SS_RRRDRD, INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3, 135 INSTR_RXF_FRRDF,
136 INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RXY_URRD,
137 INSTR_RX_FRRD, INSTR_RX_RRRD, INSTR_RX_URRD,
138 INSTR_SIL_RDI, INSTR_SIL_RDU,
139 INSTR_SIY_IRD, INSTR_SIY_URD,
140 INSTR_SI_URD,
141 INSTR_SSE_RDRD,
142 INSTR_SSF_RRDRD,
143 INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD,
144 INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3,
122 INSTR_S_00, INSTR_S_RD, 145 INSTR_S_00, INSTR_S_RD,
123}; 146};
124 147
@@ -129,7 +152,7 @@ struct operand {
129}; 152};
130 153
131struct insn { 154struct insn {
132 const char name[5]; 155 const char name[6];
133 unsigned char opfrag; 156 unsigned char opfrag;
134 unsigned char format; 157 unsigned char format;
135}; 158};
@@ -170,11 +193,16 @@ static const struct operand operands[] =
170 [U4_12] = { 4, 12, 0 }, 193 [U4_12] = { 4, 12, 0 },
171 [U4_16] = { 4, 16, 0 }, 194 [U4_16] = { 4, 16, 0 },
172 [U4_20] = { 4, 20, 0 }, 195 [U4_20] = { 4, 20, 0 },
196 [U4_32] = { 4, 32, 0 },
173 [U8_8] = { 8, 8, 0 }, 197 [U8_8] = { 8, 8, 0 },
174 [U8_16] = { 8, 16, 0 }, 198 [U8_16] = { 8, 16, 0 },
199 [U8_24] = { 8, 24, 0 },
200 [U8_32] = { 8, 32, 0 },
175 [I16_16] = { 16, 16, OPERAND_SIGNED }, 201 [I16_16] = { 16, 16, OPERAND_SIGNED },
176 [U16_16] = { 16, 16, 0 }, 202 [U16_16] = { 16, 16, 0 },
203 [U16_32] = { 16, 32, 0 },
177 [J16_16] = { 16, 16, OPERAND_PCREL }, 204 [J16_16] = { 16, 16, OPERAND_PCREL },
205 [I16_32] = { 16, 32, OPERAND_SIGNED },
178 [J32_16] = { 32, 16, OPERAND_PCREL }, 206 [J32_16] = { 32, 16, OPERAND_PCREL },
179 [I32_16] = { 32, 16, OPERAND_SIGNED }, 207 [I32_16] = { 32, 16, OPERAND_SIGNED },
180 [U32_16] = { 32, 16, 0 }, 208 [U32_16] = { 32, 16, 0 },
@@ -183,82 +211,93 @@ static const struct operand operands[] =
183}; 211};
184 212
185static const unsigned char formats[][7] = { 213static const unsigned char formats[][7] = {
186 [INSTR_E] = { 0xff, 0,0,0,0,0,0 }, /* e.g. pr */ 214 [INSTR_E] = { 0xff, 0,0,0,0,0,0 },
187 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, /* e.g. brxhg */ 215 [INSTR_RIE_R0UU] = { 0xff, R_8,U16_16,U4_32,0,0,0 },
188 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 }, /* e.g. brasl */ 216 [INSTR_RIE_RRPU] = { 0xff, R_8,R_12,U4_32,J16_16,0,0 },
189 [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 }, /* e.g. brcl */ 217 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
190 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 }, /* e.g. afi */ 218 [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 },
191 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 }, /* e.g. alfi */ 219 [INSTR_RIE_RUPI] = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 },
192 [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 }, /* e.g. ahi */ 220 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 },
193 [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 }, /* e.g. brct */ 221 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 },
194 [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 }, /* e.g. tml */ 222 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 },
195 [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 }, /* e.g. brc */ 223 [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 },
196 [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 }, /* e.g. palb */ 224 [INSTR_RIS_R0RDU] = { 0xff, R_8,U8_32,D_20,B_16,0,0 },
197 [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 }, /* e.g. tb */ 225 [INSTR_RIS_RURDI] = { 0xff, R_8,I8_32,U4_12,D_20,B_16,0 },
198 [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 }, /* e.g. cpya */ 226 [INSTR_RIS_RURDU] = { 0xff, R_8,U8_32,U4_12,D_20,B_16,0 },
199 [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 }, /* e.g. sar */ 227 [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 },
200 [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 }, /* e.g. sqer */ 228 [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 },
201 [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 }, /* e.g. debr */ 229 [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 },
202 [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 }, /* e.g. ipm */ 230 [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 },
203 [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 }, /* e.g. ear */ 231 [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 },
204 [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 }, /* e.g. cefbr */ 232 [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 },
205 [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 }, /* e.g. lura */ 233 [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 },
206 [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 }, /* efpc, sfpc */ 234 [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 },
207 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 }, /* e.g. madbr */ 235 [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 },
208 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },/* e.g. didbr */ 236 [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 },
209 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },/* e.g. .insn */ 237 [INSTR_RRE_FR] = { 0xff, F_24,R_28,0,0,0,0 },
210 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 }, /* e.g. idte */ 238 [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 },
211 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 }, /* e.g. fixr */ 239 [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 },
212 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 }, /* e.g. cfebr */ 240 [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 },
213 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 }, /* e.g. sske */ 241 [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 },
214 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 }, /* e.g. adr */ 242 [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 },
215 [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 }, /* e.g. spm */ 243 [INSTR_RRF_0UFF] = { 0xff, F_24,F_28,U4_20,0,0,0 },
216 [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 }, /* e.g. lr */ 244 [INSTR_RRF_F0FF2] = { 0xff, F_24,F_16,F_28,0,0,0 },
217 [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 }, /* e.g. svc */ 245 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 },
218 [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 }, /* e.g. bcr */ 246 [INSTR_RRF_F0FR] = { 0xff, F_24,F_16,R_28,0,0,0 },
219 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, /* e.g. lmh */ 247 [INSTR_RRF_FFRU] = { 0xff, F_24,F_16,R_28,U4_20,0,0 },
220 [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, /* e.g. lmh */ 248 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },
221 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icmh */ 249 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 },
222 [INSTR_RSL_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, /* e.g. tp */ 250 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 },
223 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 }, /* e.g. brxh */ 251 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },
224 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },/* e.g. stmy */ 252 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 },
253 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 },
254 [INSTR_RRF_U0RR] = { 0xff, R_24,R_28,U4_16,0,0,0 },
255 [INSTR_RRF_UUFF] = { 0xff, F_24,U4_16,F_28,U4_20,0,0 },
256 [INSTR_RRR_F0FF] = { 0xff, F_24,F_28,F_16,0,0,0 },
257 [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 },
258 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 },
259 [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 },
260 [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 },
261 [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 },
262 [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 },
263 [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
264 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
265 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
266 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
267 [INSTR_RSL_R0RD] = { 0xff, D_20,L4_8,B_16,0,0,0 },
268 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },
269 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },
270 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },
225 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 }, 271 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 },
226 /* e.g. icmh */ 272 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 },
227 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },/* e.g. lamy */ 273 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
228 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },/* e.g. lamy */ 274 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 },
229 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 }, /* e.g. lam */ 275 [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
230 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 }, /* e.g. lctl */ 276 [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
231 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 }, /* e.g. sll */ 277 [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
232 [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 }, /* e.g. cs */ 278 [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
233 [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 }, /* e.g. icm */
234 [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. axbr */
235 [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. lg */
236 [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 }, 279 [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 },
237 /* e.g. madb */ 280 [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },
238 [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },/* e.g. ly */ 281 [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },
239 [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley */ 282 [INSTR_RXY_URRD] = { 0xff, U4_8,D20_20,X_12,B_16,0,0 },
240 [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. ae */ 283 [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
241 [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. l */ 284 [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
242 [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */ 285 [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 },
243 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */ 286 [INSTR_SIL_RDI] = { 0xff, D_20,B_16,I16_32,0,0,0 },
244 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, /* e.g. tmy */ 287 [INSTR_SIL_RDU] = { 0xff, D_20,B_16,U16_32,0,0,0 },
245 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */ 288 [INSTR_SIY_IRD] = { 0xff, D20_20,B_16,I8_8,0,0,0 },
289 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 },
290 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 },
291 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 },
292 [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
246 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 }, 293 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
247 /* e.g. mvc */
248 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 }, 294 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 },
249 /* e.g. srp */
250 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 }, 295 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 },
251 /* e.g. pack */
252 [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
253 /* e.g. mvck */
254 [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 }, 296 [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 },
255 /* e.g. plo */
256 [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 }, 297 [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 },
257 /* e.g. lmd */ 298 [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
258 [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 }, /* e.g. hsch */ 299 [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 },
259 [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 }, /* e.g. lpsw */ 300 [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 },
260 [INSTR_SSF_RRDRD] = { 0x00, D_20,B_16,D_36,B_32,R_8,0 },
261 /* e.g. mvcos */
262}; 301};
263 302
264static struct insn opcode[] = { 303static struct insn opcode[] = {
@@ -454,6 +493,8 @@ static struct insn opcode[] = {
454static struct insn opcode_01[] = { 493static struct insn opcode_01[] = {
455#ifdef CONFIG_64BIT 494#ifdef CONFIG_64BIT
456 { "sam64", 0x0e, INSTR_E }, 495 { "sam64", 0x0e, INSTR_E },
496 { "pfpo", 0x0a, INSTR_E },
497 { "ptff", 0x04, INSTR_E },
457#endif 498#endif
458 { "pr", 0x01, INSTR_E }, 499 { "pr", 0x01, INSTR_E },
459 { "upt", 0x02, INSTR_E }, 500 { "upt", 0x02, INSTR_E },
@@ -519,6 +560,8 @@ static struct insn opcode_b2[] = {
519 { "cutfu", 0xa7, INSTR_RRF_M0RR }, 560 { "cutfu", 0xa7, INSTR_RRF_M0RR },
520 { "stfle", 0xb0, INSTR_S_RD }, 561 { "stfle", 0xb0, INSTR_S_RD },
521 { "lpswe", 0xb2, INSTR_S_RD }, 562 { "lpswe", 0xb2, INSTR_S_RD },
563 { "srnmt", 0xb9, INSTR_S_RD },
564 { "lfas", 0xbd, INSTR_S_RD },
522#endif 565#endif
523 { "stidp", 0x02, INSTR_S_RD }, 566 { "stidp", 0x02, INSTR_S_RD },
524 { "sck", 0x04, INSTR_S_RD }, 567 { "sck", 0x04, INSTR_S_RD },
@@ -589,7 +632,6 @@ static struct insn opcode_b2[] = {
589 { "clst", 0x5d, INSTR_RRE_RR }, 632 { "clst", 0x5d, INSTR_RRE_RR },
590 { "srst", 0x5e, INSTR_RRE_RR }, 633 { "srst", 0x5e, INSTR_RRE_RR },
591 { "cmpsc", 0x63, INSTR_RRE_RR }, 634 { "cmpsc", 0x63, INSTR_RRE_RR },
592 { "cmpsc", 0x63, INSTR_RRE_RR },
593 { "siga", 0x74, INSTR_S_RD }, 635 { "siga", 0x74, INSTR_S_RD },
594 { "xsch", 0x76, INSTR_S_00 }, 636 { "xsch", 0x76, INSTR_S_00 },
595 { "rp", 0x77, INSTR_S_RD }, 637 { "rp", 0x77, INSTR_S_RD },
@@ -630,6 +672,57 @@ static struct insn opcode_b3[] = {
630 { "cger", 0xc8, INSTR_RRF_U0RF }, 672 { "cger", 0xc8, INSTR_RRF_U0RF },
631 { "cgdr", 0xc9, INSTR_RRF_U0RF }, 673 { "cgdr", 0xc9, INSTR_RRF_U0RF },
632 { "cgxr", 0xca, INSTR_RRF_U0RF }, 674 { "cgxr", 0xca, INSTR_RRF_U0RF },
675 { "lpdfr", 0x70, INSTR_RRE_FF },
676 { "lndfr", 0x71, INSTR_RRE_FF },
677 { "cpsdr", 0x72, INSTR_RRF_F0FF2 },
678 { "lcdfr", 0x73, INSTR_RRE_FF },
679 { "ldgr", 0xc1, INSTR_RRE_FR },
680 { "lgdr", 0xcd, INSTR_RRE_RF },
681 { "adtr", 0xd2, INSTR_RRR_F0FF },
682 { "axtr", 0xda, INSTR_RRR_F0FF },
683 { "cdtr", 0xe4, INSTR_RRE_FF },
684 { "cxtr", 0xec, INSTR_RRE_FF },
685 { "kdtr", 0xe0, INSTR_RRE_FF },
686 { "kxtr", 0xe8, INSTR_RRE_FF },
687 { "cedtr", 0xf4, INSTR_RRE_FF },
688 { "cextr", 0xfc, INSTR_RRE_FF },
689 { "cdgtr", 0xf1, INSTR_RRE_FR },
690 { "cxgtr", 0xf9, INSTR_RRE_FR },
691 { "cdstr", 0xf3, INSTR_RRE_FR },
692 { "cxstr", 0xfb, INSTR_RRE_FR },
693 { "cdutr", 0xf2, INSTR_RRE_FR },
694 { "cxutr", 0xfa, INSTR_RRE_FR },
695 { "cgdtr", 0xe1, INSTR_RRF_U0RF },
696 { "cgxtr", 0xe9, INSTR_RRF_U0RF },
697 { "csdtr", 0xe3, INSTR_RRE_RF },
698 { "csxtr", 0xeb, INSTR_RRE_RF },
699 { "cudtr", 0xe2, INSTR_RRE_RF },
700 { "cuxtr", 0xea, INSTR_RRE_RF },
701 { "ddtr", 0xd1, INSTR_RRR_F0FF },
702 { "dxtr", 0xd9, INSTR_RRR_F0FF },
703 { "eedtr", 0xe5, INSTR_RRE_RF },
704 { "eextr", 0xed, INSTR_RRE_RF },
705 { "esdtr", 0xe7, INSTR_RRE_RF },
706 { "esxtr", 0xef, INSTR_RRE_RF },
707 { "iedtr", 0xf6, INSTR_RRF_F0FR },
708 { "iextr", 0xfe, INSTR_RRF_F0FR },
709 { "ltdtr", 0xd6, INSTR_RRE_FF },
710 { "ltxtr", 0xde, INSTR_RRE_FF },
711 { "fidtr", 0xd7, INSTR_RRF_UUFF },
712 { "fixtr", 0xdf, INSTR_RRF_UUFF },
713 { "ldetr", 0xd4, INSTR_RRF_0UFF },
714 { "lxdtr", 0xdc, INSTR_RRF_0UFF },
715 { "ledtr", 0xd5, INSTR_RRF_UUFF },
716 { "ldxtr", 0xdd, INSTR_RRF_UUFF },
717 { "mdtr", 0xd0, INSTR_RRR_F0FF },
718 { "mxtr", 0xd8, INSTR_RRR_F0FF },
719 { "qadtr", 0xf5, INSTR_RRF_FUFF },
720 { "qaxtr", 0xfd, INSTR_RRF_FUFF },
721 { "rrdtr", 0xf7, INSTR_RRF_FFRU },
722 { "rrxtr", 0xff, INSTR_RRF_FFRU },
723 { "sfasr", 0x85, INSTR_RRE_R0 },
724 { "sdtr", 0xd3, INSTR_RRR_F0FF },
725 { "sxtr", 0xdb, INSTR_RRR_F0FF },
633#endif 726#endif
634 { "lpebr", 0x00, INSTR_RRE_FF }, 727 { "lpebr", 0x00, INSTR_RRE_FF },
635 { "lnebr", 0x01, INSTR_RRE_FF }, 728 { "lnebr", 0x01, INSTR_RRE_FF },
@@ -780,6 +873,14 @@ static struct insn opcode_b9[] = {
780 { "cu24", 0xb1, INSTR_RRF_M0RR }, 873 { "cu24", 0xb1, INSTR_RRF_M0RR },
781 { "cu41", 0xb2, INSTR_RRF_M0RR }, 874 { "cu41", 0xb2, INSTR_RRF_M0RR },
782 { "cu42", 0xb3, INSTR_RRF_M0RR }, 875 { "cu42", 0xb3, INSTR_RRF_M0RR },
876 { "crt", 0x72, INSTR_RRF_U0RR },
877 { "cgrt", 0x60, INSTR_RRF_U0RR },
878 { "clrt", 0x73, INSTR_RRF_U0RR },
879 { "clgrt", 0x61, INSTR_RRF_U0RR },
880 { "ptf", 0xa2, INSTR_RRE_R0 },
881 { "pfmf", 0xaf, INSTR_RRE_RR },
882 { "trte", 0xbf, INSTR_RRF_M0RR },
883 { "trtre", 0xbd, INSTR_RRF_M0RR },
783#endif 884#endif
784 { "kmac", 0x1e, INSTR_RRE_RR }, 885 { "kmac", 0x1e, INSTR_RRE_RR },
785 { "lrvr", 0x1f, INSTR_RRE_RR }, 886 { "lrvr", 0x1f, INSTR_RRE_RR },
@@ -835,6 +936,43 @@ static struct insn opcode_c2[] = {
835 { "cfi", 0x0d, INSTR_RIL_RI }, 936 { "cfi", 0x0d, INSTR_RIL_RI },
836 { "clgfi", 0x0e, INSTR_RIL_RU }, 937 { "clgfi", 0x0e, INSTR_RIL_RU },
837 { "clfi", 0x0f, INSTR_RIL_RU }, 938 { "clfi", 0x0f, INSTR_RIL_RU },
939 { "msfi", 0x01, INSTR_RIL_RI },
940 { "msgfi", 0x00, INSTR_RIL_RI },
941#endif
942 { "", 0, INSTR_INVALID }
943};
944
945static struct insn opcode_c4[] = {
946#ifdef CONFIG_64BIT
947 { "lrl", 0x0d, INSTR_RIL_RP },
948 { "lgrl", 0x08, INSTR_RIL_RP },
949 { "lgfrl", 0x0c, INSTR_RIL_RP },
950 { "lhrl", 0x05, INSTR_RIL_RP },
951 { "lghrl", 0x04, INSTR_RIL_RP },
952 { "llgfrl", 0x0e, INSTR_RIL_RP },
953 { "llhrl", 0x02, INSTR_RIL_RP },
954 { "llghrl", 0x06, INSTR_RIL_RP },
955 { "strl", 0x0f, INSTR_RIL_RP },
956 { "stgrl", 0x0b, INSTR_RIL_RP },
957 { "sthrl", 0x07, INSTR_RIL_RP },
958#endif
959 { "", 0, INSTR_INVALID }
960};
961
962static struct insn opcode_c6[] = {
963#ifdef CONFIG_64BIT
964 { "crl", 0x0d, INSTR_RIL_RP },
965 { "cgrl", 0x08, INSTR_RIL_RP },
966 { "cgfrl", 0x0c, INSTR_RIL_RP },
967 { "chrl", 0x05, INSTR_RIL_RP },
968 { "cghrl", 0x04, INSTR_RIL_RP },
969 { "clrl", 0x0f, INSTR_RIL_RP },
970 { "clgrl", 0x0a, INSTR_RIL_RP },
971 { "clgfrl", 0x0e, INSTR_RIL_RP },
972 { "clhrl", 0x07, INSTR_RIL_RP },
973 { "clghrl", 0x06, INSTR_RIL_RP },
974 { "pfdrl", 0x02, INSTR_RIL_UP },
975 { "exrl", 0x00, INSTR_RIL_RP },
838#endif 976#endif
839 { "", 0, INSTR_INVALID } 977 { "", 0, INSTR_INVALID }
840}; 978};
@@ -842,6 +980,8 @@ static struct insn opcode_c2[] = {
842static struct insn opcode_c8[] = { 980static struct insn opcode_c8[] = {
843#ifdef CONFIG_64BIT 981#ifdef CONFIG_64BIT
844 { "mvcos", 0x00, INSTR_SSF_RRDRD }, 982 { "mvcos", 0x00, INSTR_SSF_RRDRD },
983 { "ectg", 0x01, INSTR_SSF_RRDRD },
984 { "csst", 0x02, INSTR_SSF_RRDRD },
845#endif 985#endif
846 { "", 0, INSTR_INVALID } 986 { "", 0, INSTR_INVALID }
847}; 987};
@@ -917,6 +1057,12 @@ static struct insn opcode_e3[] = {
917 { "llgh", 0x91, INSTR_RXY_RRRD }, 1057 { "llgh", 0x91, INSTR_RXY_RRRD },
918 { "llc", 0x94, INSTR_RXY_RRRD }, 1058 { "llc", 0x94, INSTR_RXY_RRRD },
919 { "llh", 0x95, INSTR_RXY_RRRD }, 1059 { "llh", 0x95, INSTR_RXY_RRRD },
1060 { "cgh", 0x34, INSTR_RXY_RRRD },
1061 { "laey", 0x75, INSTR_RXY_RRRD },
1062 { "ltgf", 0x32, INSTR_RXY_RRRD },
1063 { "mfy", 0x5c, INSTR_RXY_RRRD },
1064 { "mhy", 0x7c, INSTR_RXY_RRRD },
1065 { "pfd", 0x36, INSTR_RXY_URRD },
920#endif 1066#endif
921 { "lrv", 0x1e, INSTR_RXY_RRRD }, 1067 { "lrv", 0x1e, INSTR_RXY_RRRD },
922 { "lrvh", 0x1f, INSTR_RXY_RRRD }, 1068 { "lrvh", 0x1f, INSTR_RXY_RRRD },
@@ -931,6 +1077,15 @@ static struct insn opcode_e3[] = {
931static struct insn opcode_e5[] = { 1077static struct insn opcode_e5[] = {
932#ifdef CONFIG_64BIT 1078#ifdef CONFIG_64BIT
933 { "strag", 0x02, INSTR_SSE_RDRD }, 1079 { "strag", 0x02, INSTR_SSE_RDRD },
1080 { "chhsi", 0x54, INSTR_SIL_RDI },
1081 { "chsi", 0x5c, INSTR_SIL_RDI },
1082 { "cghsi", 0x58, INSTR_SIL_RDI },
1083 { "clhhsi", 0x55, INSTR_SIL_RDU },
1084 { "clfhsi", 0x5d, INSTR_SIL_RDU },
1085 { "clghsi", 0x59, INSTR_SIL_RDU },
1086 { "mvhhi", 0x44, INSTR_SIL_RDI },
1087 { "mvhi", 0x4c, INSTR_SIL_RDI },
1088 { "mvghi", 0x48, INSTR_SIL_RDI },
934#endif 1089#endif
935 { "lasp", 0x00, INSTR_SSE_RDRD }, 1090 { "lasp", 0x00, INSTR_SSE_RDRD },
936 { "tprot", 0x01, INSTR_SSE_RDRD }, 1091 { "tprot", 0x01, INSTR_SSE_RDRD },
@@ -977,6 +1132,11 @@ static struct insn opcode_eb[] = {
977 { "lmy", 0x98, INSTR_RSY_RRRD }, 1132 { "lmy", 0x98, INSTR_RSY_RRRD },
978 { "lamy", 0x9a, INSTR_RSY_AARD }, 1133 { "lamy", 0x9a, INSTR_RSY_AARD },
979 { "stamy", 0x9b, INSTR_RSY_AARD }, 1134 { "stamy", 0x9b, INSTR_RSY_AARD },
1135 { "asi", 0x6a, INSTR_SIY_IRD },
1136 { "agsi", 0x7a, INSTR_SIY_IRD },
1137 { "alsi", 0x6e, INSTR_SIY_IRD },
1138 { "algsi", 0x7e, INSTR_SIY_IRD },
1139 { "ecag", 0x4c, INSTR_RSY_RRRD },
980#endif 1140#endif
981 { "rll", 0x1d, INSTR_RSY_RRRD }, 1141 { "rll", 0x1d, INSTR_RSY_RRRD },
982 { "mvclu", 0x8e, INSTR_RSY_RRRD }, 1142 { "mvclu", 0x8e, INSTR_RSY_RRRD },
@@ -988,6 +1148,30 @@ static struct insn opcode_ec[] = {
988#ifdef CONFIG_64BIT 1148#ifdef CONFIG_64BIT
989 { "brxhg", 0x44, INSTR_RIE_RRP }, 1149 { "brxhg", 0x44, INSTR_RIE_RRP },
990 { "brxlg", 0x45, INSTR_RIE_RRP }, 1150 { "brxlg", 0x45, INSTR_RIE_RRP },
1151 { "crb", 0xf6, INSTR_RRS_RRRDU },
1152 { "cgrb", 0xe4, INSTR_RRS_RRRDU },
1153 { "crj", 0x76, INSTR_RIE_RRPU },
1154 { "cgrj", 0x64, INSTR_RIE_RRPU },
1155 { "cib", 0xfe, INSTR_RIS_RURDI },
1156 { "cgib", 0xfc, INSTR_RIS_RURDI },
1157 { "cij", 0x7e, INSTR_RIE_RUPI },
1158 { "cgij", 0x7c, INSTR_RIE_RUPI },
1159 { "cit", 0x72, INSTR_RIE_R0IU },
1160 { "cgit", 0x70, INSTR_RIE_R0IU },
1161 { "clrb", 0xf7, INSTR_RRS_RRRDU },
1162 { "clgrb", 0xe5, INSTR_RRS_RRRDU },
1163 { "clrj", 0x77, INSTR_RIE_RRPU },
1164 { "clgrj", 0x65, INSTR_RIE_RRPU },
1165 { "clib", 0xff, INSTR_RIS_RURDU },
1166 { "clgib", 0xfd, INSTR_RIS_RURDU },
1167 { "clij", 0x7f, INSTR_RIE_RUPU },
1168 { "clgij", 0x7d, INSTR_RIE_RUPU },
1169 { "clfit", 0x73, INSTR_RIE_R0UU },
1170 { "clgit", 0x71, INSTR_RIE_R0UU },
1171 { "rnsbg", 0x54, INSTR_RIE_RRUUU },
1172 { "rxsbg", 0x57, INSTR_RIE_RRUUU },
1173 { "rosbg", 0x56, INSTR_RIE_RRUUU },
1174 { "risbg", 0x55, INSTR_RIE_RRUUU },
991#endif 1175#endif
992 { "", 0, INSTR_INVALID } 1176 { "", 0, INSTR_INVALID }
993}; 1177};
@@ -1004,6 +1188,16 @@ static struct insn opcode_ed[] = {
1004 { "ldy", 0x65, INSTR_RXY_FRRD }, 1188 { "ldy", 0x65, INSTR_RXY_FRRD },
1005 { "stey", 0x66, INSTR_RXY_FRRD }, 1189 { "stey", 0x66, INSTR_RXY_FRRD },
1006 { "stdy", 0x67, INSTR_RXY_FRRD }, 1190 { "stdy", 0x67, INSTR_RXY_FRRD },
1191 { "sldt", 0x40, INSTR_RXF_FRRDF },
1192 { "slxt", 0x48, INSTR_RXF_FRRDF },
1193 { "srdt", 0x41, INSTR_RXF_FRRDF },
1194 { "srxt", 0x49, INSTR_RXF_FRRDF },
1195 { "tdcet", 0x50, INSTR_RXE_FRRD },
1196 { "tdcdt", 0x54, INSTR_RXE_FRRD },
1197 { "tdcxt", 0x58, INSTR_RXE_FRRD },
1198 { "tdget", 0x51, INSTR_RXE_FRRD },
1199 { "tdgdt", 0x55, INSTR_RXE_FRRD },
1200 { "tdgxt", 0x59, INSTR_RXE_FRRD },
1007#endif 1201#endif
1008 { "ldeb", 0x04, INSTR_RXE_FRRD }, 1202 { "ldeb", 0x04, INSTR_RXE_FRRD },
1009 { "lxdb", 0x05, INSTR_RXE_FRRD }, 1203 { "lxdb", 0x05, INSTR_RXE_FRRD },
@@ -1037,6 +1231,7 @@ static struct insn opcode_ed[] = {
1037 { "mae", 0x2e, INSTR_RXF_FRRDF }, 1231 { "mae", 0x2e, INSTR_RXF_FRRDF },
1038 { "mse", 0x2f, INSTR_RXF_FRRDF }, 1232 { "mse", 0x2f, INSTR_RXF_FRRDF },
1039 { "sqe", 0x34, INSTR_RXE_FRRD }, 1233 { "sqe", 0x34, INSTR_RXE_FRRD },
1234 { "sqd", 0x35, INSTR_RXE_FRRD },
1040 { "mee", 0x37, INSTR_RXE_FRRD }, 1235 { "mee", 0x37, INSTR_RXE_FRRD },
1041 { "mad", 0x3e, INSTR_RXF_FRRDF }, 1236 { "mad", 0x3e, INSTR_RXF_FRRDF },
1042 { "msd", 0x3f, INSTR_RXF_FRRDF }, 1237 { "msd", 0x3f, INSTR_RXF_FRRDF },
@@ -1117,6 +1312,12 @@ static struct insn *find_insn(unsigned char *code)
1117 case 0xc2: 1312 case 0xc2:
1118 table = opcode_c2; 1313 table = opcode_c2;
1119 break; 1314 break;
1315 case 0xc4:
1316 table = opcode_c4;
1317 break;
1318 case 0xc6:
1319 table = opcode_c6;
1320 break;
1120 case 0xc8: 1321 case 0xc8:
1121 table = opcode_c8; 1322 table = opcode_c8;
1122 break; 1323 break;
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index e49e9e0c69fd..2d92c2cf92d7 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -82,7 +82,8 @@ asm(
82 " lm 6,15,24(15)\n" 82 " lm 6,15,24(15)\n"
83#endif 83#endif
84 " br 14\n" 84 " br 14\n"
85 " .size savesys_ipl_nss, .-savesys_ipl_nss\n"); 85 " .size savesys_ipl_nss, .-savesys_ipl_nss\n"
86 " .previous\n");
86 87
87static __initdata char upper_command_line[COMMAND_LINE_SIZE]; 88static __initdata char upper_command_line[COMMAND_LINE_SIZE];
88 89
@@ -214,10 +215,13 @@ static __initdata struct sysinfo_3_2_2 vmms __aligned(PAGE_SIZE);
214 215
215static noinline __init void detect_machine_type(void) 216static noinline __init void detect_machine_type(void)
216{ 217{
217 /* No VM information? Looks like LPAR */ 218 /* Check current-configuration-level */
218 if (stsi(&vmms, 3, 2, 2) == -ENOSYS) 219 if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) {
220 S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR;
219 return; 221 return;
220 if (!vmms.count) 222 }
223 /* Get virtual-machine cpu information. */
224 if (stsi(&vmms, 3, 2, 2) == -ENOSYS || !vmms.count)
221 return; 225 return;
222 226
223 /* Running under KVM? If not we assume z/VM */ 227 /* Running under KVM? If not we assume z/VM */
@@ -402,8 +406,19 @@ static void __init append_to_cmdline(size_t (*ipl_data)(char *, size_t))
402 406
403static void __init setup_boot_command_line(void) 407static void __init setup_boot_command_line(void)
404{ 408{
409 int i;
410
411 /* convert arch command line to ascii */
412 for (i = 0; i < ARCH_COMMAND_LINE_SIZE; i++)
413 if (COMMAND_LINE[i] & 0x80)
414 break;
415 if (i < ARCH_COMMAND_LINE_SIZE)
416 EBCASC(COMMAND_LINE, ARCH_COMMAND_LINE_SIZE);
417 COMMAND_LINE[ARCH_COMMAND_LINE_SIZE-1] = 0;
418
405 /* copy arch command line */ 419 /* copy arch command line */
406 strlcpy(boot_command_line, COMMAND_LINE, ARCH_COMMAND_LINE_SIZE); 420 strlcpy(boot_command_line, strstrip(COMMAND_LINE),
421 ARCH_COMMAND_LINE_SIZE);
407 422
408 /* append IPL PARM data to the boot command line */ 423 /* append IPL PARM data to the boot command line */
409 if (MACHINE_IS_VM) 424 if (MACHINE_IS_VM)
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 48215d15762b..6af7045280a8 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -13,7 +13,6 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/cache.h> 15#include <asm/cache.h>
16#include <asm/lowcore.h>
17#include <asm/errno.h> 16#include <asm/errno.h>
18#include <asm/ptrace.h> 17#include <asm/ptrace.h>
19#include <asm/thread_info.h> 18#include <asm/thread_info.h>
@@ -571,6 +570,7 @@ pgm_svcper:
571 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID 570 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
572 oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP 571 oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
573 TRACE_IRQS_ON 572 TRACE_IRQS_ON
573 lm %r2,%r6,SP_R2(%r15) # load svc arguments
574 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 574 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
575 b BASED(sysc_do_svc) 575 b BASED(sysc_do_svc)
576 576
@@ -964,7 +964,7 @@ cleanup_critical:
964 clc 4(4,%r12),BASED(cleanup_table_io_work_loop) 964 clc 4(4,%r12),BASED(cleanup_table_io_work_loop)
965 bl BASED(0f) 965 bl BASED(0f)
966 clc 4(4,%r12),BASED(cleanup_table_io_work_loop+4) 966 clc 4(4,%r12),BASED(cleanup_table_io_work_loop+4)
967 bl BASED(cleanup_io_return) 967 bl BASED(cleanup_io_work_loop)
9680: 9680:
969 br %r14 969 br %r14
970 970
@@ -1039,6 +1039,12 @@ cleanup_sysc_leave_insn:
1039 1039
1040cleanup_io_return: 1040cleanup_io_return:
1041 mvc __LC_RETURN_PSW(4),0(%r12) 1041 mvc __LC_RETURN_PSW(4),0(%r12)
1042 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_io_return)
1043 la %r12,__LC_RETURN_PSW
1044 br %r14
1045
1046cleanup_io_work_loop:
1047 mvc __LC_RETURN_PSW(4),0(%r12)
1042 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_io_work_loop) 1048 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_io_work_loop)
1043 la %r12,__LC_RETURN_PSW 1049 la %r12,__LC_RETURN_PSW
1044 br %r14 1050 br %r14
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index e1e5e767ab56..eb15c12ec158 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -24,17 +24,13 @@ int __cpuinit start_secondary(void *cpuvoid);
24void __init startup_init(void); 24void __init startup_init(void);
25void die(const char * str, struct pt_regs * regs, long err); 25void die(const char * str, struct pt_regs * regs, long err);
26 26
27struct new_utsname; 27struct s390_mmap_arg_struct;
28struct mmap_arg_struct;
29struct fadvise64_64_args; 28struct fadvise64_64_args;
30struct old_sigaction; 29struct old_sigaction;
31struct sel_arg_struct;
32 30
33long sys_mmap2(struct mmap_arg_struct __user *arg); 31long sys_mmap2(struct s390_mmap_arg_struct __user *arg);
34long sys_s390_old_mmap(struct mmap_arg_struct __user *arg); 32long sys_s390_ipc(uint call, int first, unsigned long second,
35long sys_ipc(uint call, int first, unsigned long second,
36 unsigned long third, void __user *ptr); 33 unsigned long third, void __user *ptr);
37long sys_s390_newuname(struct new_utsname __user *name);
38long sys_s390_personality(unsigned long personality); 34long sys_s390_personality(unsigned long personality);
39long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low, 35long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
40 size_t len, int advice); 36 size_t len, int advice);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 9aff1d449b6e..52106d53271c 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -9,11 +9,9 @@
9 * Heiko Carstens <heiko.carstens@de.ibm.com> 9 * Heiko Carstens <heiko.carstens@de.ibm.com>
10 */ 10 */
11 11
12#include <linux/sys.h>
13#include <linux/linkage.h> 12#include <linux/linkage.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <asm/cache.h> 14#include <asm/cache.h>
16#include <asm/lowcore.h>
17#include <asm/errno.h> 15#include <asm/errno.h>
18#include <asm/ptrace.h> 16#include <asm/ptrace.h>
19#include <asm/thread_info.h> 17#include <asm/thread_info.h>
@@ -549,6 +547,7 @@ pgm_svcper:
549 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID 547 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
550 oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP 548 oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
551 TRACE_IRQS_ON 549 TRACE_IRQS_ON
550 lmg %r2,%r6,SP_R2(%r15) # load svc arguments
552 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 551 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
553 j sysc_do_svc 552 j sysc_do_svc
554 553
@@ -947,7 +946,7 @@ cleanup_critical:
947 clc 8(8,%r12),BASED(cleanup_table_io_work_loop) 946 clc 8(8,%r12),BASED(cleanup_table_io_work_loop)
948 jl 0f 947 jl 0f
949 clc 8(8,%r12),BASED(cleanup_table_io_work_loop+8) 948 clc 8(8,%r12),BASED(cleanup_table_io_work_loop+8)
950 jl cleanup_io_return 949 jl cleanup_io_work_loop
9510: 9500:
952 br %r14 951 br %r14
953 952
@@ -1022,6 +1021,12 @@ cleanup_sysc_leave_insn:
1022 1021
1023cleanup_io_return: 1022cleanup_io_return:
1024 mvc __LC_RETURN_PSW(8),0(%r12) 1023 mvc __LC_RETURN_PSW(8),0(%r12)
1024 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_return)
1025 la %r12,__LC_RETURN_PSW
1026 br %r14
1027
1028cleanup_io_work_loop:
1029 mvc __LC_RETURN_PSW(8),0(%r12)
1025 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_work_loop) 1030 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_work_loop)
1026 la %r12,__LC_RETURN_PSW 1031 la %r12,__LC_RETURN_PSW
1027 br %r14 1032 br %r14
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index f5fe34dd821b..6a83d0581317 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -13,7 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <trace/syscall.h> 15#include <trace/syscall.h>
16#include <asm/lowcore.h> 16#include <asm/asm-offsets.h>
17 17
18#ifdef CONFIG_DYNAMIC_FTRACE 18#ifdef CONFIG_DYNAMIC_FTRACE
19 19
@@ -200,76 +200,3 @@ out:
200 return parent; 200 return parent;
201} 201}
202#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 202#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
203
204#ifdef CONFIG_FTRACE_SYSCALLS
205
206extern unsigned long __start_syscalls_metadata[];
207extern unsigned long __stop_syscalls_metadata[];
208extern unsigned int sys_call_table[];
209
210static struct syscall_metadata **syscalls_metadata;
211
212struct syscall_metadata *syscall_nr_to_meta(int nr)
213{
214 if (!syscalls_metadata || nr >= NR_syscalls || nr < 0)
215 return NULL;
216
217 return syscalls_metadata[nr];
218}
219
220int syscall_name_to_nr(char *name)
221{
222 int i;
223
224 if (!syscalls_metadata)
225 return -1;
226 for (i = 0; i < NR_syscalls; i++)
227 if (syscalls_metadata[i])
228 if (!strcmp(syscalls_metadata[i]->name, name))
229 return i;
230 return -1;
231}
232
233void set_syscall_enter_id(int num, int id)
234{
235 syscalls_metadata[num]->enter_id = id;
236}
237
238void set_syscall_exit_id(int num, int id)
239{
240 syscalls_metadata[num]->exit_id = id;
241}
242
243static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
244{
245 struct syscall_metadata *start;
246 struct syscall_metadata *stop;
247 char str[KSYM_SYMBOL_LEN];
248
249 start = (struct syscall_metadata *)__start_syscalls_metadata;
250 stop = (struct syscall_metadata *)__stop_syscalls_metadata;
251 kallsyms_lookup(syscall, NULL, NULL, NULL, str);
252
253 for ( ; start < stop; start++) {
254 if (start->name && !strcmp(start->name + 3, str + 3))
255 return start;
256 }
257 return NULL;
258}
259
260static int __init arch_init_ftrace_syscalls(void)
261{
262 struct syscall_metadata *meta;
263 int i;
264 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls,
265 GFP_KERNEL);
266 if (!syscalls_metadata)
267 return -ENOMEM;
268 for (i = 0; i < NR_syscalls; i++) {
269 meta = find_syscall_meta((unsigned long)sys_call_table[i]);
270 syscalls_metadata[i] = meta;
271 }
272 return 0;
273}
274arch_initcall(arch_init_ftrace_syscalls);
275#endif
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index c52b4f7742fa..9d1f76702d47 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright IBM Corp. 1999,2009 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>
@@ -22,12 +22,9 @@
22 */ 22 */
23 23
24#include <linux/init.h> 24#include <linux/init.h>
25#include <asm/setup.h>
26#include <asm/lowcore.h>
27#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
28#include <asm/thread_info.h> 26#include <asm/thread_info.h>
29#include <asm/page.h> 27#include <asm/page.h>
30#include <asm/cpu.h>
31 28
32#ifdef CONFIG_64BIT 29#ifdef CONFIG_64BIT
33#define ARCH_OFFSET 4 30#define ARCH_OFFSET 4
@@ -288,19 +285,7 @@ iplstart:
288 bz .Lagain1 # skip dateset trailer 285 bz .Lagain1 # skip dateset trailer
289 la %r5,0(%r4,%r2) 286 la %r5,0(%r4,%r2)
290 lr %r3,%r2 287 lr %r3,%r2
291.Lidebc: 288 la %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line
292 tm 0(%r5),0x80 # high order bit set ?
293 bo .Ldocv # yes -> convert from EBCDIC
294 ahi %r5,-1
295 bct %r3,.Lidebc
296 b .Lnocv
297.Ldocv:
298 l %r3,.Lcvtab
299 tr 0(256,%r4),0(%r3) # convert parameters to ascii
300 tr 256(256,%r4),0(%r3)
301 tr 512(256,%r4),0(%r3)
302 tr 768(122,%r4),0(%r3)
303.Lnocv: la %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line
304 mvc 0(256,%r3),0(%r4) 289 mvc 0(256,%r3),0(%r4)
305 mvc 256(256,%r3),256(%r4) 290 mvc 256(256,%r3),256(%r4)
306 mvc 512(256,%r3),512(%r4) 291 mvc 512(256,%r3),512(%r4)
@@ -384,7 +369,6 @@ iplstart:
384.Linitrd:.long _end + 0x400000 # default address of initrd 369.Linitrd:.long _end + 0x400000 # default address of initrd
385.Lparm: .long PARMAREA 370.Lparm: .long PARMAREA
386.Lstartup: .long startup 371.Lstartup: .long startup
387.Lcvtab:.long _ebcasc # ebcdic to ascii table
388.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40 372.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
389 .byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6 373 .byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6
390 .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" 374 .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold"
@@ -417,13 +401,10 @@ start:
417.sk8x8: 401.sk8x8:
418 mvc 0(240,%r8),0(%r9) # copy iplparms into buffer 402 mvc 0(240,%r8),0(%r9) # copy iplparms into buffer
419.gotr: 403.gotr:
420 l %r10,.tbl # EBCDIC to ASCII table
421 tr 0(240,%r8),0(%r10)
422 slr %r0,%r0 404 slr %r0,%r0
423 st %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11) 405 st %r0,INITRD_SIZE+ARCH_OFFSET-PARMAREA(%r11)
424 st %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11) 406 st %r0,INITRD_START+ARCH_OFFSET-PARMAREA(%r11)
425 j startup # continue with startup 407 j startup # continue with startup
426.tbl: .long _ebcasc # translate table
427.cmd: .long COMMAND_LINE # address of command line buffer 408.cmd: .long COMMAND_LINE # address of command line buffer
428.parm: .long PARMAREA 409.parm: .long PARMAREA
429.lowcase: 410.lowcase:
@@ -467,16 +448,15 @@ start:
467# or linload or SALIPL 448# or linload or SALIPL
468# 449#
469 .org 0x10000 450 .org 0x10000
470startup:basr %r13,0 # get base 451 .globl startup
452startup:
453 basr %r13,0 # get base
471.LPG0: 454.LPG0:
472 xc 0x200(256),0x200 # partially clear lowcore 455 xc 0x200(256),0x200 # partially clear lowcore
473 xc 0x300(256),0x300 456 xc 0x300(256),0x300
474 l %r1,5f-.LPG0(%r13) 457 stck __LC_LAST_UPDATE_CLOCK
475 stck 0(%r1) 458 spt 5f-.LPG0(%r13)
476 spt 6f-.LPG0(%r13) 459 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
477 mvc __LC_LAST_UPDATE_CLOCK(8),0(%r1)
478 mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
479 mvc __LC_EXIT_TIMER(8),5f-.LPG0(%r13)
480#ifndef CONFIG_MARCH_G5 460#ifndef CONFIG_MARCH_G5
481 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 461 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
482 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST 462 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
@@ -494,7 +474,6 @@ startup:basr %r13,0 # get base
494 cl %r0,2f+12-.LPG0(%r13) 474 cl %r0,2f+12-.LPG0(%r13)
495 je 3f 475 je 3f
4961: l %r15,.Lstack-.LPG0(%r13) 4761: l %r15,.Lstack-.LPG0(%r13)
497 ahi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union+THREAD_SIZE
498 ahi %r15,-96 477 ahi %r15,-96
499 la %r2,.Lals_string-.LPG0(%r13) 478 la %r2,.Lals_string-.LPG0(%r13)
500 l %r3,.Lsclp_print-.LPG0(%r13) 479 l %r3,.Lsclp_print-.LPG0(%r13)
@@ -505,7 +484,7 @@ startup:basr %r13,0 # get base
505.Lsclp_print: 484.Lsclp_print:
506 .long _sclp_print_early 485 .long _sclp_print_early
507.Lstack: 486.Lstack:
508 .long init_thread_union 487 .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER))
509 .align 16 488 .align 16
5102: .long 0x000a0000,0x8badcccc 4892: .long 0x000a0000,0x8badcccc
511#if defined(CONFIG_64BIT) 490#if defined(CONFIG_64BIT)
@@ -532,13 +511,25 @@ startup:basr %r13,0 # get base
5323: 5113:
533#endif 512#endif
534 513
514#ifdef CONFIG_64BIT
515 mvi __LC_AR_MODE_ID,1 # set esame flag
516 slr %r0,%r0 # set cpuid to zero
517 lhi %r1,2 # mode 2 = esame (dump)
518 sigp %r1,%r0,0x12 # switch to esame mode
519 sam64 # switch to 64 bit mode
520 larl %r13,4f
521 lmh %r0,%r15,0(%r13) # clear high-order half
522 jg startup_continue
5234: .fill 16,4,0x0
524#else
525 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
535 l %r13,4f-.LPG0(%r13) 526 l %r13,4f-.LPG0(%r13)
536 b 0(%r13) 527 b 0(%r13)
537 .align 4 528 .align 8
5384: .long startup_continue 5294: .long startup_continue
5395: .long sched_clock_base_cc 530#endif
540 .align 8 531 .align 8
5416: .long 0x7fffffff,0xffffffff 5325: .long 0x7fffffff,0xffffffff
542 533
543# 534#
544# params at 10400 (setup.h) 535# params at 10400 (setup.h)
@@ -552,8 +543,4 @@ startup:basr %r13,0 # get base
552 .byte "root=/dev/ram0 ro" 543 .byte "root=/dev/ram0 ro"
553 .byte 0 544 .byte 0
554 545
555#ifdef CONFIG_64BIT 546 .org 0x11000
556#include "head64.S"
557#else
558#include "head31.S"
559#endif
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index 602b508cd4c4..b8f8dc126102 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/head31.S 2 * arch/s390/kernel/head31.S
3 * 3 *
4 * Copyright (C) IBM Corp. 2005,2006 4 * Copyright (C) IBM Corp. 2005,2010
5 * 5 *
6 * Author(s): Hartmut Penner <hp@de.ibm.com> 6 * Author(s): Hartmut Penner <hp@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com> 7 * Martin Schwidefsky <schwidefsky@de.ibm.com>
@@ -10,13 +10,19 @@
10 * 10 *
11 */ 11 */
12 12
13 .org 0x11000 13#include <linux/init.h>
14#include <asm/asm-offsets.h>
15#include <asm/thread_info.h>
16#include <asm/page.h>
14 17
18__HEAD
19 .globl startup_continue
15startup_continue: 20startup_continue:
16 basr %r13,0 # get base 21 basr %r13,0 # get base
17.LPG1: 22.LPG1:
18 23
19 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) 24 l %r1,.Lbase_cc-.LPG1(%r13)
25 mvc 0(8,%r1),__LC_LAST_UPDATE_CLOCK
20 lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers 26 lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
21 l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 27 l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
22 # move IPL device to lowcore 28 # move IPL device to lowcore
@@ -69,12 +75,14 @@ startup_continue:
69.Lduald:.rept 8 75.Lduald:.rept 8
70 .long 0x80000000,0,0,0 # invalid access-list entries 76 .long 0x80000000,0,0,0 # invalid access-list entries
71 .endr 77 .endr
78.Lbase_cc:
79 .long sched_clock_base_cc
72 80
73 .org 0x12000
74 .globl _ehead 81 .globl _ehead
75_ehead: 82_ehead:
83
76#ifdef CONFIG_SHARED_KERNEL 84#ifdef CONFIG_SHARED_KERNEL
77 .org 0x100000 85 .org 0x100000 - 0x11000 # head.o ends at 0x11000
78#endif 86#endif
79 87
80# 88#
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 6a250808092b..cdef68717416 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/s390/kernel/head64.S 2 * arch/s390/kernel/head64.S
3 * 3 *
4 * Copyright (C) IBM Corp. 1999,2006 4 * Copyright (C) IBM Corp. 1999,2010
5 * 5 *
6 * Author(s): Hartmut Penner <hp@de.ibm.com> 6 * Author(s): Hartmut Penner <hp@de.ibm.com>
7 * Martin Schwidefsky <schwidefsky@de.ibm.com> 7 * Martin Schwidefsky <schwidefsky@de.ibm.com>
@@ -10,79 +10,17 @@
10 * 10 *
11 */ 11 */
12 12
13 .org 0x11000 13#include <linux/init.h>
14#include <asm/asm-offsets.h>
15#include <asm/thread_info.h>
16#include <asm/page.h>
14 17
18__HEAD
19 .globl startup_continue
15startup_continue: 20startup_continue:
16 basr %r13,0 # get base 21 larl %r1,sched_clock_base_cc
17.LPG1: sll %r13,1 # remove high order bit 22 mvc 0(8,%r1),__LC_LAST_UPDATE_CLOCK
18 srl %r13,1 23 larl %r13,.LPG1 # get base
19
20#ifdef CONFIG_ZFCPDUMP
21
22 # check if we have been ipled using zfcp dump:
23
24 tm 0xb9,0x01 # test if subchannel is enabled
25 jno .nodump # subchannel disabled
26 l %r1,0xb8
27 la %r5,.Lipl_schib-.LPG1(%r13)
28 stsch 0(%r5) # get schib of subchannel
29 jne .nodump # schib not available
30 tm 5(%r5),0x01 # devno valid?
31 jno .nodump
32 tm 4(%r5),0x80 # qdio capable device?
33 jno .nodump
34 l %r2,20(%r0) # address of ipl parameter block
35 lhi %r3,0
36 ic %r3,0x148(%r2) # get opt field
37 chi %r3,0x20 # load with dump?
38 jne .nodump
39
40 # store all prefix registers in case of load with dump:
41
42 la %r7,0 # base register for 0 page
43 la %r8,0 # first cpu
44 l %r11,.Lpref_arr_ptr-.LPG1(%r13) # address of prefix array
45 ahi %r11,4 # skip boot cpu
46 lr %r12,%r11
47 ahi %r12,(CONFIG_NR_CPUS*4) # end of prefix array
48 stap .Lcurrent_cpu+2-.LPG1(%r13) # store current cpu addr
491:
50 cl %r8,.Lcurrent_cpu-.LPG1(%r13) # is ipl cpu ?
51 je 4f # if yes get next cpu
522:
53 lr %r9,%r7
54 sigp %r9,%r8,0x9 # stop & store status of cpu
55 brc 8,3f # accepted
56 brc 4,4f # status stored: next cpu
57 brc 2,2b # busy: try again
58 brc 1,4f # not op: next cpu
593:
60 mvc 0(4,%r11),264(%r7) # copy prefix register to prefix array
61 ahi %r11,4 # next element in prefix array
62 clr %r11,%r12
63 je 5f # no more space in prefix array
644:
65 ahi %r8,1 # next cpu (r8 += 1)
66 chi %r8,MAX_CPU_ADDRESS # is last possible cpu ?
67 jle 1b # jump if not last cpu
685:
69 lhi %r1,2 # mode 2 = esame (dump)
70 j 6f
71 .align 4
72.Lipl_schib:
73 .rept 13
74 .long 0
75 .endr
76.nodump:
77 lhi %r1,1 # mode 1 = esame (normal ipl)
786:
79#else
80 lhi %r1,1 # mode 1 = esame (normal ipl)
81#endif /* CONFIG_ZFCPDUMP */
82 mvi __LC_AR_MODE_ID,1 # set esame flag
83 slr %r0,%r0 # set cpuid to zero
84 sigp %r1,%r0,0x12 # switch to esame mode
85 sam64 # switch to 64 bit mode
86 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers 24 lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
87 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area 25 lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
88 # move IPL device to lowcore 26 # move IPL device to lowcore
@@ -106,6 +44,7 @@ startup_continue:
106 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space, 44 lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
107 # virtual and never return ... 45 # virtual and never return ...
108 .align 16 46 .align 16
47.LPG1:
109.Lentry:.quad 0x0000000180000000,_stext 48.Lentry:.quad 0x0000000180000000,_stext
110.Lctl: .quad 0x04350002 # cr0: various things 49.Lctl: .quad 0x04350002 # cr0: various things
111 .quad 0 # cr1: primary space segment table 50 .quad 0 # cr1: primary space segment table
@@ -127,12 +66,6 @@ startup_continue:
127.L4malign:.quad 0xffffffffffc00000 66.L4malign:.quad 0xffffffffffc00000
128.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 67.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
129.Lnop: .long 0x07000700 68.Lnop: .long 0x07000700
130#ifdef CONFIG_ZFCPDUMP
131.Lcurrent_cpu:
132 .long 0x0
133.Lpref_arr_ptr:
134 .long zfcpdump_prefix_array
135#endif /* CONFIG_ZFCPDUMP */
136.Lparmaddr: 69.Lparmaddr:
137 .quad PARMAREA 70 .quad PARMAREA
138 .align 64 71 .align 64
@@ -143,11 +76,11 @@ startup_continue:
143 .long 0x80000000,0,0,0 # invalid access-list entries 76 .long 0x80000000,0,0,0 # invalid access-list entries
144 .endr 77 .endr
145 78
146 .org 0x12000
147 .globl _ehead 79 .globl _ehead
148_ehead: 80_ehead:
81
149#ifdef CONFIG_SHARED_KERNEL 82#ifdef CONFIG_SHARED_KERNEL
150 .org 0x100000 83 .org 0x100000 - 0x11000 # head.o ends at 0x11000
151#endif 84#endif
152 85
153# 86#
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 4890ac6d7faa..72c8b0d070c8 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -15,6 +15,7 @@
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/ctype.h> 16#include <linux/ctype.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/gfp.h>
18#include <asm/ipl.h> 19#include <asm/ipl.h>
19#include <asm/smp.h> 20#include <asm/smp.h>
20#include <asm/setup.h> 21#include <asm/setup.h>
@@ -221,7 +222,7 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
221 const char *buf, size_t len) \ 222 const char *buf, size_t len) \
222{ \ 223{ \
223 strncpy(_value, buf, sizeof(_value) - 1); \ 224 strncpy(_value, buf, sizeof(_value) - 1); \
224 strstrip(_value); \ 225 strim(_value); \
225 return len; \ 226 return len; \
226} \ 227} \
227static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 228static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
@@ -472,7 +473,7 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
472 return sprintf(page, "#unknown#\n"); 473 return sprintf(page, "#unknown#\n");
473 memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); 474 memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN);
474 EBCASC(loadparm, LOADPARM_LEN); 475 EBCASC(loadparm, LOADPARM_LEN);
475 strstrip(loadparm); 476 strim(loadparm);
476 return sprintf(page, "%s\n", loadparm); 477 return sprintf(page, "%s\n", loadparm);
477} 478}
478 479
@@ -553,7 +554,7 @@ out:
553 return rc; 554 return rc;
554} 555}
555 556
556static void ipl_run(struct shutdown_trigger *trigger) 557static void __ipl_run(void *unused)
557{ 558{
558 diag308(DIAG308_IPL, NULL); 559 diag308(DIAG308_IPL, NULL);
559 if (MACHINE_IS_VM) 560 if (MACHINE_IS_VM)
@@ -562,6 +563,11 @@ static void ipl_run(struct shutdown_trigger *trigger)
562 reipl_ccw_dev(&ipl_info.data.ccw.dev_id); 563 reipl_ccw_dev(&ipl_info.data.ccw.dev_id);
563} 564}
564 565
566static void ipl_run(struct shutdown_trigger *trigger)
567{
568 smp_switch_to_ipl_cpu(__ipl_run, NULL);
569}
570
565static int __init ipl_init(void) 571static int __init ipl_init(void)
566{ 572{
567 int rc; 573 int rc;
@@ -776,7 +782,7 @@ static void reipl_get_ascii_loadparm(char *loadparm,
776 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); 782 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN);
777 EBCASC(loadparm, LOADPARM_LEN); 783 EBCASC(loadparm, LOADPARM_LEN);
778 loadparm[LOADPARM_LEN] = 0; 784 loadparm[LOADPARM_LEN] = 0;
779 strstrip(loadparm); 785 strim(loadparm);
780} 786}
781 787
782static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb, 788static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb,
@@ -1039,7 +1045,7 @@ static void get_ipl_string(char *dst, struct ipl_parameter_block *ipb,
1039 sprintf(dst + pos, " PARM %s", vmparm); 1045 sprintf(dst + pos, " PARM %s", vmparm);
1040} 1046}
1041 1047
1042static void reipl_run(struct shutdown_trigger *trigger) 1048static void __reipl_run(void *unused)
1043{ 1049{
1044 struct ccw_dev_id devid; 1050 struct ccw_dev_id devid;
1045 static char buf[128]; 1051 static char buf[128];
@@ -1087,6 +1093,11 @@ static void reipl_run(struct shutdown_trigger *trigger)
1087 disabled_wait((unsigned long) __builtin_return_address(0)); 1093 disabled_wait((unsigned long) __builtin_return_address(0));
1088} 1094}
1089 1095
1096static void reipl_run(struct shutdown_trigger *trigger)
1097{
1098 smp_switch_to_ipl_cpu(__reipl_run, NULL);
1099}
1100
1090static void reipl_block_ccw_init(struct ipl_parameter_block *ipb) 1101static void reipl_block_ccw_init(struct ipl_parameter_block *ipb)
1091{ 1102{
1092 ipb->hdr.len = IPL_PARM_BLK_CCW_LEN; 1103 ipb->hdr.len = IPL_PARM_BLK_CCW_LEN;
@@ -1369,20 +1380,18 @@ static struct kobj_attribute dump_type_attr =
1369 1380
1370static struct kset *dump_kset; 1381static struct kset *dump_kset;
1371 1382
1372static void dump_run(struct shutdown_trigger *trigger) 1383static void __dump_run(void *unused)
1373{ 1384{
1374 struct ccw_dev_id devid; 1385 struct ccw_dev_id devid;
1375 static char buf[100]; 1386 static char buf[100];
1376 1387
1377 switch (dump_method) { 1388 switch (dump_method) {
1378 case DUMP_METHOD_CCW_CIO: 1389 case DUMP_METHOD_CCW_CIO:
1379 smp_send_stop();
1380 devid.devno = dump_block_ccw->ipl_info.ccw.devno; 1390 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
1381 devid.ssid = 0; 1391 devid.ssid = 0;
1382 reipl_ccw_dev(&devid); 1392 reipl_ccw_dev(&devid);
1383 break; 1393 break;
1384 case DUMP_METHOD_CCW_VM: 1394 case DUMP_METHOD_CCW_VM:
1385 smp_send_stop();
1386 sprintf(buf, "STORE STATUS"); 1395 sprintf(buf, "STORE STATUS");
1387 __cpcmd(buf, NULL, 0, NULL); 1396 __cpcmd(buf, NULL, 0, NULL);
1388 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno); 1397 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
@@ -1396,10 +1405,17 @@ static void dump_run(struct shutdown_trigger *trigger)
1396 diag308(DIAG308_SET, dump_block_fcp); 1405 diag308(DIAG308_SET, dump_block_fcp);
1397 diag308(DIAG308_DUMP, NULL); 1406 diag308(DIAG308_DUMP, NULL);
1398 break; 1407 break;
1399 case DUMP_METHOD_NONE: 1408 default:
1400 return; 1409 break;
1401 } 1410 }
1402 printk(KERN_EMERG "Dump failed!\n"); 1411}
1412
1413static void dump_run(struct shutdown_trigger *trigger)
1414{
1415 if (dump_method == DUMP_METHOD_NONE)
1416 return;
1417 smp_send_stop();
1418 smp_switch_to_ipl_cpu(__dump_run, NULL);
1403} 1419}
1404 1420
1405static int __init dump_ccw_init(void) 1421static int __init dump_ccw_init(void)
@@ -1577,7 +1593,7 @@ static void vmcmd_run(struct shutdown_trigger *trigger)
1577static int vmcmd_init(void) 1593static int vmcmd_init(void)
1578{ 1594{
1579 if (!MACHINE_IS_VM) 1595 if (!MACHINE_IS_VM)
1580 return -ENOTSUPP; 1596 return -EOPNOTSUPP;
1581 vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj); 1597 vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj);
1582 if (!vmcmd_kset) 1598 if (!vmcmd_kset)
1583 return -ENOMEM; 1599 return -ENOMEM;
@@ -1595,7 +1611,7 @@ static void stop_run(struct shutdown_trigger *trigger)
1595{ 1611{
1596 if (strcmp(trigger->name, ON_PANIC_STR) == 0) 1612 if (strcmp(trigger->name, ON_PANIC_STR) == 0)
1597 disabled_wait((unsigned long) __builtin_return_address(0)); 1613 disabled_wait((unsigned long) __builtin_return_address(0));
1598 while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy) 1614 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
1599 cpu_relax(); 1615 cpu_relax();
1600 for (;;); 1616 for (;;);
1601} 1617}
@@ -1902,7 +1918,6 @@ void __init ipl_update_parameters(void)
1902void __init ipl_save_parameters(void) 1918void __init ipl_save_parameters(void)
1903{ 1919{
1904 struct cio_iplinfo iplinfo; 1920 struct cio_iplinfo iplinfo;
1905 unsigned int *ipl_ptr;
1906 void *src, *dst; 1921 void *src, *dst;
1907 1922
1908 if (cio_get_iplinfo(&iplinfo)) 1923 if (cio_get_iplinfo(&iplinfo))
@@ -1913,11 +1928,10 @@ void __init ipl_save_parameters(void)
1913 if (!iplinfo.is_qdio) 1928 if (!iplinfo.is_qdio)
1914 return; 1929 return;
1915 ipl_flags |= IPL_PARMBLOCK_VALID; 1930 ipl_flags |= IPL_PARMBLOCK_VALID;
1916 ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR; 1931 src = (void *)(unsigned long)S390_lowcore.ipl_parmblock_ptr;
1917 src = (void *)(unsigned long)*ipl_ptr;
1918 dst = (void *)IPL_PARMBLOCK_ORIGIN; 1932 dst = (void *)IPL_PARMBLOCK_ORIGIN;
1919 memmove(dst, src, PAGE_SIZE); 1933 memmove(dst, src, PAGE_SIZE);
1920 *ipl_ptr = IPL_PARMBLOCK_ORIGIN; 1934 S390_lowcore.ipl_parmblock_ptr = IPL_PARMBLOCK_ORIGIN;
1921} 1935}
1922 1936
1923static LIST_HEAD(rcall); 1937static LIST_HEAD(rcall);
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 86783efa24ee..3d34eef5a2c3 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -29,6 +29,7 @@
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/sections.h> 30#include <asm/sections.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/slab.h>
32 33
33DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 34DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
34DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 35DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 131d7ee8b416..a922d51df6bf 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -54,11 +54,11 @@ void machine_shutdown(void)
54{ 54{
55} 55}
56 56
57void machine_kexec(struct kimage *image) 57static void __machine_kexec(void *data)
58{ 58{
59 relocate_kernel_t data_mover; 59 relocate_kernel_t data_mover;
60 struct kimage *image = data;
60 61
61 smp_send_stop();
62 pfault_fini(); 62 pfault_fini();
63 s390_reset_system(); 63 s390_reset_system();
64 64
@@ -68,3 +68,9 @@ void machine_kexec(struct kimage *image)
68 (*data_mover)(&image->head, image->start); 68 (*data_mover)(&image->head, image->start);
69 for (;;); 69 for (;;);
70} 70}
71
72void machine_kexec(struct kimage *image)
73{
74 smp_send_stop();
75 smp_switch_to_ipl_cpu(__machine_kexec, image);
76}
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 5417eb57271a..1039fdea15b5 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -16,9 +16,9 @@
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/slab.h>
19#include <linux/unistd.h> 20#include <linux/unistd.h>
20#include <linux/ptrace.h> 21#include <linux/ptrace.h>
21#include <linux/slab.h>
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/user.h> 23#include <linux/user.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
@@ -153,8 +153,6 @@ void exit_thread(void)
153 153
154void flush_thread(void) 154void flush_thread(void)
155{ 155{
156 clear_used_math();
157 clear_tsk_thread_flag(current, TIF_USEDFPU);
158} 156}
159 157
160void release_thread(struct task_struct *dead_task) 158void release_thread(struct task_struct *dead_task)
@@ -217,6 +215,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
217 p->thread.mm_segment = get_fs(); 215 p->thread.mm_segment = get_fs();
218 /* Don't copy debug registers */ 216 /* Don't copy debug registers */
219 memset(&p->thread.per_info, 0, sizeof(p->thread.per_info)); 217 memset(&p->thread.per_info, 0, sizeof(p->thread.per_info));
218 clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
220 /* Initialize per thread user and system timer values */ 219 /* Initialize per thread user and system timer values */
221 ti = task_thread_info(p); 220 ti = task_thread_info(p);
222 ti->user_timer = 0; 221 ti->user_timer = 0;
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 653c6a178740..9f654da4cecc 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -65,6 +65,7 @@ FixPerRegisters(struct task_struct *task)
65{ 65{
66 struct pt_regs *regs; 66 struct pt_regs *regs;
67 per_struct *per_info; 67 per_struct *per_info;
68 per_cr_words cr_words;
68 69
69 regs = task_pt_regs(task); 70 regs = task_pt_regs(task);
70 per_info = (per_struct *) &task->thread.per_info; 71 per_info = (per_struct *) &task->thread.per_info;
@@ -98,6 +99,13 @@ FixPerRegisters(struct task_struct *task)
98 per_info->control_regs.bits.storage_alt_space_ctl = 1; 99 per_info->control_regs.bits.storage_alt_space_ctl = 1;
99 else 100 else
100 per_info->control_regs.bits.storage_alt_space_ctl = 0; 101 per_info->control_regs.bits.storage_alt_space_ctl = 0;
102
103 if (task == current) {
104 __ctl_store(cr_words, 9, 11);
105 if (memcmp(&cr_words, &per_info->control_regs.words,
106 sizeof(cr_words)) != 0)
107 __ctl_load(per_info->control_regs.words, 9, 11);
108 }
101} 109}
102 110
103void user_enable_single_step(struct task_struct *task) 111void user_enable_single_step(struct task_struct *task)
@@ -632,7 +640,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
632 640
633asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 641asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
634{ 642{
635 long ret; 643 long ret = 0;
636 644
637 /* Do the secure computing check first. */ 645 /* Do the secure computing check first. */
638 secure_computing(regs->gprs[2]); 646 secure_computing(regs->gprs[2]);
@@ -641,7 +649,6 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
641 * The sysc_tracesys code in entry.S stored the system 649 * The sysc_tracesys code in entry.S stored the system
642 * call number to gprs[2]. 650 * call number to gprs[2].
643 */ 651 */
644 ret = regs->gprs[2];
645 if (test_thread_flag(TIF_SYSCALL_TRACE) && 652 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
646 (tracehook_report_syscall_entry(regs) || 653 (tracehook_report_syscall_entry(regs) ||
647 regs->gprs[2] >= NR_syscalls)) { 654 regs->gprs[2] >= NR_syscalls)) {
@@ -663,7 +670,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
663 regs->gprs[2], regs->orig_gpr2, 670 regs->gprs[2], regs->orig_gpr2,
664 regs->gprs[3], regs->gprs[4], 671 regs->gprs[3], regs->gprs[4],
665 regs->gprs[5]); 672 regs->gprs[5]);
666 return ret; 673 return ret ?: regs->gprs[2];
667} 674}
668 675
669asmlinkage void do_syscall_trace_exit(struct pt_regs *regs) 676asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
@@ -959,7 +966,7 @@ static const struct user_regset s390_compat_regsets[] = {
959 .set = s390_fpregs_set, 966 .set = s390_fpregs_set,
960 }, 967 },
961 [REGSET_GENERAL_EXTENDED] = { 968 [REGSET_GENERAL_EXTENDED] = {
962 .core_note_type = NT_PRXSTATUS, 969 .core_note_type = NT_S390_HIGH_GPRS,
963 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), 970 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t),
964 .size = sizeof(compat_long_t), 971 .size = sizeof(compat_long_t),
965 .align = sizeof(compat_long_t), 972 .align = sizeof(compat_long_t),
@@ -984,3 +991,61 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
984#endif 991#endif
985 return &user_s390_view; 992 return &user_s390_view;
986} 993}
994
995static const char *gpr_names[NUM_GPRS] = {
996 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
997 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
998};
999
1000unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset)
1001{
1002 if (offset >= NUM_GPRS)
1003 return 0;
1004 return regs->gprs[offset];
1005}
1006
1007int regs_query_register_offset(const char *name)
1008{
1009 unsigned long offset;
1010
1011 if (!name || *name != 'r')
1012 return -EINVAL;
1013 if (strict_strtoul(name + 1, 10, &offset))
1014 return -EINVAL;
1015 if (offset >= NUM_GPRS)
1016 return -EINVAL;
1017 return offset;
1018}
1019
1020const char *regs_query_register_name(unsigned int offset)
1021{
1022 if (offset >= NUM_GPRS)
1023 return NULL;
1024 return gpr_names[offset];
1025}
1026
1027static int regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
1028{
1029 unsigned long ksp = kernel_stack_pointer(regs);
1030
1031 return (addr & ~(THREAD_SIZE - 1)) == (ksp & ~(THREAD_SIZE - 1));
1032}
1033
1034/**
1035 * regs_get_kernel_stack_nth() - get Nth entry of the stack
1036 * @regs:pt_regs which contains kernel stack pointer.
1037 * @n:stack entry number.
1038 *
1039 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
1040 * is specifined by @regs. If the @n th entry is NOT in the kernel stack,
1041 * this returns 0.
1042 */
1043unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
1044{
1045 unsigned long addr;
1046
1047 addr = kernel_stack_pointer(regs) + n * sizeof(long);
1048 if (!regs_within_kernel_stack(regs, addr))
1049 return 0;
1050 return *(unsigned long *)addr;
1051}
diff --git a/arch/s390/kernel/reipl.S b/arch/s390/kernel/reipl.S
index 2f481cc3d1c9..cb899d9f8505 100644
--- a/arch/s390/kernel/reipl.S
+++ b/arch/s390/kernel/reipl.S
@@ -6,7 +6,7 @@
6 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com) 6 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com)
7 */ 7 */
8 8
9#include <asm/lowcore.h> 9#include <asm/asm-offsets.h>
10 10
11# 11#
12# do_reipl_asm 12# do_reipl_asm
diff --git a/arch/s390/kernel/reipl64.S b/arch/s390/kernel/reipl64.S
index 774147824c3d..5e73dee63baa 100644
--- a/arch/s390/kernel/reipl64.S
+++ b/arch/s390/kernel/reipl64.S
@@ -4,7 +4,7 @@
4 * Denis Joseph Barrow, 4 * Denis Joseph Barrow,
5 */ 5 */
6 6
7#include <asm/lowcore.h> 7#include <asm/asm-offsets.h>
8 8
9# 9#
10# do_reipl_asm 10# do_reipl_asm
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index 0de305b598ce..59618bcd99b7 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -126,6 +126,8 @@ void __irq_entry do_extint(struct pt_regs *regs, unsigned short code)
126 /* Serve timer interrupts first. */ 126 /* Serve timer interrupts first. */
127 clock_comparator_work(); 127 clock_comparator_work();
128 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 128 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
129 if (code != 0x1004)
130 __get_cpu_var(s390_idle).nohz_delay = 1;
129 index = ext_hash(code); 131 index = ext_hash(code);
130 for (p = ext_int_hash[index]; p; p = p->next) { 132 for (p = ext_int_hash[index]; p; p = p->next) {
131 if (likely(p->code == code)) 133 if (likely(p->code == code))
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index e27ca63076d1..2e82fdd89320 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -9,8 +9,10 @@
9 */ 9 */
10 10
11LC_EXT_NEW_PSW = 0x58 # addr of ext int handler 11LC_EXT_NEW_PSW = 0x58 # addr of ext int handler
12LC_EXT_NEW_PSW_64 = 0x1b0 # addr of ext int handler 64 bit
12LC_EXT_INT_PARAM = 0x80 # addr of ext int parameter 13LC_EXT_INT_PARAM = 0x80 # addr of ext int parameter
13LC_EXT_INT_CODE = 0x86 # addr of ext int code 14LC_EXT_INT_CODE = 0x86 # addr of ext int code
15LC_AR_MODE_ID = 0xa3
14 16
15# 17#
16# Subroutine which waits synchronously until either an external interruption 18# Subroutine which waits synchronously until either an external interruption
@@ -30,8 +32,16 @@ _sclp_wait_int:
30.LbaseS1: 32.LbaseS1:
31 ahi %r15,-96 # create stack frame 33 ahi %r15,-96 # create stack frame
32 la %r8,LC_EXT_NEW_PSW # register int handler 34 la %r8,LC_EXT_NEW_PSW # register int handler
33 mvc .LoldpswS1-.LbaseS1(8,%r13),0(%r8) 35 la %r9,.LextpswS1-.LbaseS1(%r13)
34 mvc 0(8,%r8),.LextpswS1-.LbaseS1(%r13) 36#ifdef CONFIG_64BIT
37 tm LC_AR_MODE_ID,1
38 jno .Lesa1
39 la %r8,LC_EXT_NEW_PSW_64 # register int handler 64 bit
40 la %r9,.LextpswS1_64-.LbaseS1(%r13)
41.Lesa1:
42#endif
43 mvc .LoldpswS1-.LbaseS1(16,%r13),0(%r8)
44 mvc 0(16,%r8),0(%r9)
35 lhi %r6,0x0200 # cr mask for ext int (cr0.54) 45 lhi %r6,0x0200 # cr mask for ext int (cr0.54)
36 ltr %r2,%r2 46 ltr %r2,%r2
37 jz .LsetctS1 47 jz .LsetctS1
@@ -64,15 +74,19 @@ _sclp_wait_int:
64.LtimeoutS1: 74.LtimeoutS1:
65 lctl %c0,%c0,.LctlS1-.LbaseS1(%r13) # restore interrupt setting 75 lctl %c0,%c0,.LctlS1-.LbaseS1(%r13) # restore interrupt setting
66 # restore old handler 76 # restore old handler
67 mvc 0(8,%r8),.LoldpswS1-.LbaseS1(%r13) 77 mvc 0(16,%r8),.LoldpswS1-.LbaseS1(%r13)
68 lm %r6,%r15,120(%r15) # restore registers 78 lm %r6,%r15,120(%r15) # restore registers
69 br %r14 # return to caller 79 br %r14 # return to caller
70 80
71 .align 8 81 .align 8
72.LoldpswS1: 82.LoldpswS1:
73 .long 0, 0 # old ext int PSW 83 .long 0, 0, 0, 0 # old ext int PSW
74.LextpswS1: 84.LextpswS1:
75 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int 85 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int
86#ifdef CONFIG_64BIT
87.LextpswS1_64:
88 .quad 0x0000000180000000, .LwaitS1 # PSW to handle ext int, 64 bit
89#endif
76.LwaitpswS1: 90.LwaitpswS1:
77 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int 91 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int
78.LtimeS1: 92.LtimeS1:
@@ -221,7 +235,7 @@ _sclp_print:
221 lh %r9,0(%r8) # update sccb length 235 lh %r9,0(%r8) # update sccb length
222 ar %r9,%r6 236 ar %r9,%r6
223 sth %r9,0(%r8) 237 sth %r9,0(%r8)
224 ar %r7,%r6 # update current mto adress 238 ar %r7,%r6 # update current mto address
225 ltr %r0,%r0 # more characters? 239 ltr %r0,%r0 # more characters?
226 jnz .LinitmtoS4 240 jnz .LinitmtoS4
227 l %r2,.LwritedataS4-.LbaseS4(%r13)# write data 241 l %r2,.LwritedataS4-.LbaseS4(%r13)# write data
@@ -250,6 +264,13 @@ _sclp_print:
250_sclp_print_early: 264_sclp_print_early:
251 stm %r6,%r15,24(%r15) # save registers 265 stm %r6,%r15,24(%r15) # save registers
252 ahi %r15,-96 # create stack frame 266 ahi %r15,-96 # create stack frame
267#ifdef CONFIG_64BIT
268 tm LC_AR_MODE_ID,1
269 jno .Lesa2
270 ahi %r15,-80
271 stmh %r6,%r15,96(%r15) # store upper register halves
272.Lesa2:
273#endif
253 lr %r10,%r2 # save string pointer 274 lr %r10,%r2 # save string pointer
254 lhi %r2,0 275 lhi %r2,0
255 bras %r14,_sclp_setup # enable console 276 bras %r14,_sclp_setup # enable console
@@ -262,6 +283,13 @@ _sclp_print_early:
262 lhi %r2,1 283 lhi %r2,1
263 bras %r14,_sclp_setup # disable console 284 bras %r14,_sclp_setup # disable console
264.LendS5: 285.LendS5:
286#ifdef CONFIG_64BIT
287 tm LC_AR_MODE_ID,1
288 jno .Lesa3
289 lmh %r6,%r15,96(%r15) # store upper register halves
290 ahi %r15,80
291.Lesa3:
292#endif
265 lm %r6,%r15,120(%r15) # restore registers 293 lm %r6,%r15,120(%r15) # restore registers
266 br %r14 294 br %r14
267 295
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 061479ff029f..91625f759ccd 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -25,7 +25,6 @@
25#include <linux/stddef.h> 25#include <linux/stddef.h>
26#include <linux/unistd.h> 26#include <linux/unistd.h>
27#include <linux/ptrace.h> 27#include <linux/ptrace.h>
28#include <linux/slab.h>
29#include <linux/user.h> 28#include <linux/user.h>
30#include <linux/tty.h> 29#include <linux/tty.h>
31#include <linux/ioport.h> 30#include <linux/ioport.h>
@@ -87,7 +86,6 @@ unsigned long elf_hwcap = 0;
87char elf_platform[ELF_PLATFORM_SIZE]; 86char elf_platform[ELF_PLATFORM_SIZE];
88 87
89struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 88struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
90volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
91 89
92int __initdata memory_end_set; 90int __initdata memory_end_set;
93unsigned long __initdata memory_end; 91unsigned long __initdata memory_end;
@@ -124,12 +122,6 @@ void __cpuinit cpu_init(void)
124 */ 122 */
125 get_cpu_id(&S390_lowcore.cpu_id); 123 get_cpu_id(&S390_lowcore.cpu_id);
126 124
127 /*
128 * Force FPU initialization:
129 */
130 clear_thread_flag(TIF_USEDFPU);
131 clear_used_math();
132
133 atomic_inc(&init_mm.mm_count); 125 atomic_inc(&init_mm.mm_count);
134 current->active_mm = &init_mm; 126 current->active_mm = &init_mm;
135 BUG_ON(current->mm); 127 BUG_ON(current->mm);
@@ -305,9 +297,8 @@ static int __init early_parse_mem(char *p)
305} 297}
306early_param("mem", early_parse_mem); 298early_param("mem", early_parse_mem);
307 299
308#ifdef CONFIG_S390_SWITCH_AMODE 300unsigned int user_mode = HOME_SPACE_MODE;
309unsigned int switch_amode = 0; 301EXPORT_SYMBOL_GPL(user_mode);
310EXPORT_SYMBOL_GPL(switch_amode);
311 302
312static int set_amode_and_uaccess(unsigned long user_amode, 303static int set_amode_and_uaccess(unsigned long user_amode,
313 unsigned long user32_amode) 304 unsigned long user32_amode)
@@ -340,23 +331,29 @@ static int set_amode_and_uaccess(unsigned long user_amode,
340 */ 331 */
341static int __init early_parse_switch_amode(char *p) 332static int __init early_parse_switch_amode(char *p)
342{ 333{
343 switch_amode = 1; 334 if (user_mode != SECONDARY_SPACE_MODE)
335 user_mode = PRIMARY_SPACE_MODE;
344 return 0; 336 return 0;
345} 337}
346early_param("switch_amode", early_parse_switch_amode); 338early_param("switch_amode", early_parse_switch_amode);
347 339
348#else /* CONFIG_S390_SWITCH_AMODE */ 340static int __init early_parse_user_mode(char *p)
349static inline int set_amode_and_uaccess(unsigned long user_amode,
350 unsigned long user32_amode)
351{ 341{
342 if (p && strcmp(p, "primary") == 0)
343 user_mode = PRIMARY_SPACE_MODE;
344#ifdef CONFIG_S390_EXEC_PROTECT
345 else if (p && strcmp(p, "secondary") == 0)
346 user_mode = SECONDARY_SPACE_MODE;
347#endif
348 else if (!p || strcmp(p, "home") == 0)
349 user_mode = HOME_SPACE_MODE;
350 else
351 return 1;
352 return 0; 352 return 0;
353} 353}
354#endif /* CONFIG_S390_SWITCH_AMODE */ 354early_param("user_mode", early_parse_user_mode);
355 355
356#ifdef CONFIG_S390_EXEC_PROTECT 356#ifdef CONFIG_S390_EXEC_PROTECT
357unsigned int s390_noexec = 0;
358EXPORT_SYMBOL_GPL(s390_noexec);
359
360/* 357/*
361 * Enable execute protection? 358 * Enable execute protection?
362 */ 359 */
@@ -364,8 +361,7 @@ static int __init early_parse_noexec(char *p)
364{ 361{
365 if (!strncmp(p, "off", 3)) 362 if (!strncmp(p, "off", 3))
366 return 0; 363 return 0;
367 switch_amode = 1; 364 user_mode = SECONDARY_SPACE_MODE;
368 s390_noexec = 1;
369 return 0; 365 return 0;
370} 366}
371early_param("noexec", early_parse_noexec); 367early_param("noexec", early_parse_noexec);
@@ -373,7 +369,7 @@ early_param("noexec", early_parse_noexec);
373 369
374static void setup_addressing_mode(void) 370static void setup_addressing_mode(void)
375{ 371{
376 if (s390_noexec) { 372 if (user_mode == SECONDARY_SPACE_MODE) {
377 if (set_amode_and_uaccess(PSW_ASC_SECONDARY, 373 if (set_amode_and_uaccess(PSW_ASC_SECONDARY,
378 PSW32_ASC_SECONDARY)) 374 PSW32_ASC_SECONDARY))
379 pr_info("Execute protection active, " 375 pr_info("Execute protection active, "
@@ -381,7 +377,7 @@ static void setup_addressing_mode(void)
381 else 377 else
382 pr_info("Execute protection active, " 378 pr_info("Execute protection active, "
383 "mvcos not available\n"); 379 "mvcos not available\n");
384 } else if (switch_amode) { 380 } else if (user_mode == PRIMARY_SPACE_MODE) {
385 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) 381 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY))
386 pr_info("Address spaces switched, " 382 pr_info("Address spaces switched, "
387 "mvcos available\n"); 383 "mvcos available\n");
@@ -399,19 +395,16 @@ static void __init
399setup_lowcore(void) 395setup_lowcore(void)
400{ 396{
401 struct _lowcore *lc; 397 struct _lowcore *lc;
402 int lc_pages;
403 398
404 /* 399 /*
405 * Setup lowcore for boot cpu 400 * Setup lowcore for boot cpu
406 */ 401 */
407 lc_pages = sizeof(void *) == 8 ? 2 : 1; 402 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096);
408 lc = (struct _lowcore *) 403 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
409 __alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
410 memset(lc, 0, lc_pages * PAGE_SIZE);
411 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 404 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
412 lc->restart_psw.addr = 405 lc->restart_psw.addr =
413 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 406 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
414 if (switch_amode) 407 if (user_mode != HOME_SPACE_MODE)
415 lc->restart_psw.mask |= PSW_ASC_HOME; 408 lc->restart_psw.mask |= PSW_ASC_HOME;
416 lc->external_new_psw.mask = psw_kernel_bits; 409 lc->external_new_psw.mask = psw_kernel_bits;
417 lc->external_new_psw.addr = 410 lc->external_new_psw.addr =
@@ -439,7 +432,7 @@ setup_lowcore(void)
439#ifndef CONFIG_64BIT 432#ifndef CONFIG_64BIT
440 if (MACHINE_HAS_IEEE) { 433 if (MACHINE_HAS_IEEE) {
441 lc->extended_save_area_addr = (__u32) 434 lc->extended_save_area_addr = (__u32)
442 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0); 435 __alloc_bootmem_low(PAGE_SIZE, PAGE_SIZE, 0);
443 /* enable extended save area */ 436 /* enable extended save area */
444 __ctl_set_bit(14, 29); 437 __ctl_set_bit(14, 29);
445 } 438 }
@@ -807,7 +800,7 @@ setup_arch(char **cmdline_p)
807 if (MACHINE_IS_VM) 800 if (MACHINE_IS_VM)
808 pr_info("Linux is running as a z/VM " 801 pr_info("Linux is running as a z/VM "
809 "guest operating system in 31-bit mode\n"); 802 "guest operating system in 31-bit mode\n");
810 else 803 else if (MACHINE_IS_LPAR)
811 pr_info("Linux is running natively in 31-bit mode\n"); 804 pr_info("Linux is running natively in 31-bit mode\n");
812 if (MACHINE_HAS_IEEE) 805 if (MACHINE_HAS_IEEE)
813 pr_info("The hardware system has IEEE compatible " 806 pr_info("The hardware system has IEEE compatible "
@@ -821,7 +814,7 @@ setup_arch(char **cmdline_p)
821 "guest operating system in 64-bit mode\n"); 814 "guest operating system in 64-bit mode\n");
822 else if (MACHINE_IS_KVM) 815 else if (MACHINE_IS_KVM)
823 pr_info("Linux is running under KVM in 64-bit mode\n"); 816 pr_info("Linux is running under KVM in 64-bit mode\n");
824 else 817 else if (MACHINE_IS_LPAR)
825 pr_info("Linux is running natively in 64-bit mode\n"); 818 pr_info("Linux is running natively in 64-bit mode\n");
826#endif /* CONFIG_64BIT */ 819#endif /* CONFIG_64BIT */
827 820
@@ -851,7 +844,6 @@ setup_arch(char **cmdline_p)
851 setup_lowcore(); 844 setup_lowcore();
852 845
853 cpu_init(); 846 cpu_init();
854 __cpu_logical_map[0] = stap();
855 s390_init_cpu_topology(); 847 s390_init_cpu_topology();
856 848
857 /* 849 /*
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 6b4fef877f9d..6289945562b0 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -64,7 +64,7 @@ SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
64 recalc_sigpending(); 64 recalc_sigpending();
65 spin_unlock_irq(&current->sighand->siglock); 65 spin_unlock_irq(&current->sighand->siglock);
66 66
67 current->state = TASK_INTERRUPTIBLE; 67 set_current_state(TASK_INTERRUPTIBLE);
68 schedule(); 68 schedule();
69 set_thread_flag(TIF_RESTORE_SIGMASK); 69 set_thread_flag(TIF_RESTORE_SIGMASK);
70 70
@@ -500,18 +500,10 @@ void do_signal(struct pt_regs *regs)
500 clear_thread_flag(TIF_RESTORE_SIGMASK); 500 clear_thread_flag(TIF_RESTORE_SIGMASK);
501 501
502 /* 502 /*
503 * If we would have taken a single-step trap
504 * for a normal instruction, act like we took
505 * one for the handler setup.
506 */
507 if (current->thread.per_info.single_step)
508 set_thread_flag(TIF_SINGLE_STEP);
509
510 /*
511 * Let tracing know that we've done the handler setup. 503 * Let tracing know that we've done the handler setup.
512 */ 504 */
513 tracehook_signal_handler(signr, &info, &ka, regs, 505 tracehook_signal_handler(signr, &info, &ka, regs,
514 test_thread_flag(TIF_SINGLE_STEP)); 506 current->thread.per_info.single_step);
515 } 507 }
516 return; 508 return;
517 } 509 }
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 93e52039321b..e4d98de83dd8 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -36,6 +36,8 @@
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/timex.h> 37#include <linux/timex.h>
38#include <linux/bootmem.h> 38#include <linux/bootmem.h>
39#include <linux/slab.h>
40#include <asm/asm-offsets.h>
39#include <asm/ipl.h> 41#include <asm/ipl.h>
40#include <asm/setup.h> 42#include <asm/setup.h>
41#include <asm/sigp.h> 43#include <asm/sigp.h>
@@ -52,6 +54,9 @@
52#include <asm/cpu.h> 54#include <asm/cpu.h>
53#include "entry.h" 55#include "entry.h"
54 56
57/* logical cpu to cpu address */
58unsigned short __cpu_logical_map[NR_CPUS];
59
55static struct task_struct *current_set[NR_CPUS]; 60static struct task_struct *current_set[NR_CPUS];
56 61
57static u8 smp_cpu_type; 62static u8 smp_cpu_type;
@@ -69,13 +74,13 @@ static int cpu_management;
69 74
70static DEFINE_PER_CPU(struct cpu, cpu_devices); 75static DEFINE_PER_CPU(struct cpu, cpu_devices);
71 76
72static void smp_ext_bitcall(int, ec_bit_sig); 77static void smp_ext_bitcall(int, int);
73 78
74static int cpu_stopped(int cpu) 79static int raw_cpu_stopped(int cpu)
75{ 80{
76 __u32 status; 81 u32 status;
77 82
78 switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) { 83 switch (raw_sigp_ps(&status, 0, cpu, sigp_sense)) {
79 case sigp_status_stored: 84 case sigp_status_stored:
80 /* Check for stopped and check stop state */ 85 /* Check for stopped and check stop state */
81 if (status & 0x50) 86 if (status & 0x50)
@@ -87,6 +92,44 @@ static int cpu_stopped(int cpu)
87 return 0; 92 return 0;
88} 93}
89 94
95static inline int cpu_stopped(int cpu)
96{
97 return raw_cpu_stopped(cpu_logical_map(cpu));
98}
99
100void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
101{
102 struct _lowcore *lc, *current_lc;
103 struct stack_frame *sf;
104 struct pt_regs *regs;
105 unsigned long sp;
106
107 if (smp_processor_id() == 0)
108 func(data);
109 __load_psw_mask(PSW_BASE_BITS | PSW_DEFAULT_KEY);
110 /* Disable lowcore protection */
111 __ctl_clear_bit(0, 28);
112 current_lc = lowcore_ptr[smp_processor_id()];
113 lc = lowcore_ptr[0];
114 if (!lc)
115 lc = current_lc;
116 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
117 lc->restart_psw.addr = PSW_ADDR_AMODE | (unsigned long) smp_restart_cpu;
118 if (!cpu_online(0))
119 smp_switch_to_cpu(func, data, 0, stap(), __cpu_logical_map[0]);
120 while (sigp(0, sigp_stop_and_store_status) == sigp_busy)
121 cpu_relax();
122 sp = lc->panic_stack;
123 sp -= sizeof(struct pt_regs);
124 regs = (struct pt_regs *) sp;
125 memcpy(&regs->gprs, &current_lc->gpregs_save_area, sizeof(regs->gprs));
126 regs->psw = lc->psw_save_area;
127 sp -= STACK_FRAME_OVERHEAD;
128 sf = (struct stack_frame *) sp;
129 sf->back_chain = regs->gprs[15];
130 smp_switch_to_cpu(func, data, sp, stap(), __cpu_logical_map[0]);
131}
132
90void smp_send_stop(void) 133void smp_send_stop(void)
91{ 134{
92 int cpu, rc; 135 int cpu, rc;
@@ -100,7 +143,7 @@ void smp_send_stop(void)
100 if (cpu == smp_processor_id()) 143 if (cpu == smp_processor_id())
101 continue; 144 continue;
102 do { 145 do {
103 rc = signal_processor(cpu, sigp_stop); 146 rc = sigp(cpu, sigp_stop);
104 } while (rc == sigp_busy); 147 } while (rc == sigp_busy);
105 148
106 while (!cpu_stopped(cpu)) 149 while (!cpu_stopped(cpu))
@@ -136,13 +179,13 @@ static void do_ext_call_interrupt(__u16 code)
136 * Send an external call sigp to another cpu and return without waiting 179 * Send an external call sigp to another cpu and return without waiting
137 * for its completion. 180 * for its completion.
138 */ 181 */
139static void smp_ext_bitcall(int cpu, ec_bit_sig sig) 182static void smp_ext_bitcall(int cpu, int sig)
140{ 183{
141 /* 184 /*
142 * Set signaling bit in lowcore of target cpu and kick it 185 * Set signaling bit in lowcore of target cpu and kick it
143 */ 186 */
144 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 187 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
145 while (signal_processor(cpu, sigp_emergency_signal) == sigp_busy) 188 while (sigp(cpu, sigp_emergency_signal) == sigp_busy)
146 udelay(10); 189 udelay(10);
147} 190}
148 191
@@ -236,24 +279,8 @@ void smp_ctl_clear_bit(int cr, int bit)
236} 279}
237EXPORT_SYMBOL(smp_ctl_clear_bit); 280EXPORT_SYMBOL(smp_ctl_clear_bit);
238 281
239/*
240 * In early ipl state a temp. logically cpu number is needed, so the sigp
241 * functions can be used to sense other cpus. Since NR_CPUS is >= 2 on
242 * CONFIG_SMP and the ipl cpu is logical cpu 0, it must be 1.
243 */
244#define CPU_INIT_NO 1
245
246#ifdef CONFIG_ZFCPDUMP 282#ifdef CONFIG_ZFCPDUMP
247 283
248/*
249 * zfcpdump_prefix_array holds prefix registers for the following scenario:
250 * 64 bit zfcpdump kernel and 31 bit kernel which is to be dumped. We have to
251 * save its prefix registers, since they get lost, when switching from 31 bit
252 * to 64 bit.
253 */
254unsigned int zfcpdump_prefix_array[NR_CPUS + 1] \
255 __attribute__((__section__(".data")));
256
257static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) 284static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
258{ 285{
259 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 286 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
@@ -263,21 +290,15 @@ static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
263 "the dump\n", cpu, NR_CPUS - 1); 290 "the dump\n", cpu, NR_CPUS - 1);
264 return; 291 return;
265 } 292 }
266 zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL); 293 zfcpdump_save_areas[cpu] = kmalloc(sizeof(struct save_area), GFP_KERNEL);
267 __cpu_logical_map[CPU_INIT_NO] = (__u16) phy_cpu; 294 while (raw_sigp(phy_cpu, sigp_stop_and_store_status) == sigp_busy)
268 while (signal_processor(CPU_INIT_NO, sigp_stop_and_store_status) ==
269 sigp_busy)
270 cpu_relax(); 295 cpu_relax();
271 memcpy(zfcpdump_save_areas[cpu], 296 memcpy_real(zfcpdump_save_areas[cpu],
272 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE, 297 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE,
273 SAVE_AREA_SIZE); 298 sizeof(struct save_area));
274#ifdef CONFIG_64BIT
275 /* copy original prefix register */
276 zfcpdump_save_areas[cpu]->s390x.pref_reg = zfcpdump_prefix_array[cpu];
277#endif
278} 299}
279 300
280union save_area *zfcpdump_save_areas[NR_CPUS + 1]; 301struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
281EXPORT_SYMBOL_GPL(zfcpdump_save_areas); 302EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
282 303
283#else 304#else
@@ -386,8 +407,7 @@ static void __init smp_detect_cpus(void)
386 for (cpu = 0; cpu <= MAX_CPU_ADDRESS; cpu++) { 407 for (cpu = 0; cpu <= MAX_CPU_ADDRESS; cpu++) {
387 if (cpu == boot_cpu_addr) 408 if (cpu == boot_cpu_addr)
388 continue; 409 continue;
389 __cpu_logical_map[CPU_INIT_NO] = cpu; 410 if (!raw_cpu_stopped(cpu))
390 if (!cpu_stopped(CPU_INIT_NO))
391 continue; 411 continue;
392 smp_get_save_area(c_cpus, cpu); 412 smp_get_save_area(c_cpus, cpu);
393 c_cpus++; 413 c_cpus++;
@@ -410,8 +430,7 @@ static void __init smp_detect_cpus(void)
410 cpu_addr = info->cpu[cpu].address; 430 cpu_addr = info->cpu[cpu].address;
411 if (cpu_addr == boot_cpu_addr) 431 if (cpu_addr == boot_cpu_addr)
412 continue; 432 continue;
413 __cpu_logical_map[CPU_INIT_NO] = cpu_addr; 433 if (!raw_cpu_stopped(cpu_addr)) {
414 if (!cpu_stopped(CPU_INIT_NO)) {
415 s_cpus++; 434 s_cpus++;
416 continue; 435 continue;
417 } 436 }
@@ -530,18 +549,18 @@ static void smp_free_lowcore(int cpu)
530/* Upping and downing of CPUs */ 549/* Upping and downing of CPUs */
531int __cpuinit __cpu_up(unsigned int cpu) 550int __cpuinit __cpu_up(unsigned int cpu)
532{ 551{
533 struct task_struct *idle;
534 struct _lowcore *cpu_lowcore; 552 struct _lowcore *cpu_lowcore;
553 struct task_struct *idle;
535 struct stack_frame *sf; 554 struct stack_frame *sf;
536 sigp_ccode ccode;
537 u32 lowcore; 555 u32 lowcore;
556 int ccode;
538 557
539 if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED) 558 if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED)
540 return -EIO; 559 return -EIO;
541 if (smp_alloc_lowcore(cpu)) 560 if (smp_alloc_lowcore(cpu))
542 return -ENOMEM; 561 return -ENOMEM;
543 do { 562 do {
544 ccode = signal_processor(cpu, sigp_initial_cpu_reset); 563 ccode = sigp(cpu, sigp_initial_cpu_reset);
545 if (ccode == sigp_busy) 564 if (ccode == sigp_busy)
546 udelay(10); 565 udelay(10);
547 if (ccode == sigp_not_operational) 566 if (ccode == sigp_not_operational)
@@ -549,7 +568,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
549 } while (ccode == sigp_busy); 568 } while (ccode == sigp_busy);
550 569
551 lowcore = (u32)(unsigned long)lowcore_ptr[cpu]; 570 lowcore = (u32)(unsigned long)lowcore_ptr[cpu];
552 while (signal_processor_p(lowcore, cpu, sigp_set_prefix) == sigp_busy) 571 while (sigp_p(lowcore, cpu, sigp_set_prefix) == sigp_busy)
553 udelay(10); 572 udelay(10);
554 573
555 idle = current_set[cpu]; 574 idle = current_set[cpu];
@@ -575,7 +594,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
575 cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func; 594 cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func;
576 eieio(); 595 eieio();
577 596
578 while (signal_processor(cpu, sigp_restart) == sigp_busy) 597 while (sigp(cpu, sigp_restart) == sigp_busy)
579 udelay(10); 598 udelay(10);
580 599
581 while (!cpu_online(cpu)) 600 while (!cpu_online(cpu))
@@ -637,7 +656,7 @@ void __cpu_die(unsigned int cpu)
637 /* Wait until target cpu is down */ 656 /* Wait until target cpu is down */
638 while (!cpu_stopped(cpu)) 657 while (!cpu_stopped(cpu))
639 cpu_relax(); 658 cpu_relax();
640 while (signal_processor_p(0, cpu, sigp_set_prefix) == sigp_busy) 659 while (sigp_p(0, cpu, sigp_set_prefix) == sigp_busy)
641 udelay(10); 660 udelay(10);
642 smp_free_lowcore(cpu); 661 smp_free_lowcore(cpu);
643 pr_info("Processor %d stopped\n", cpu); 662 pr_info("Processor %d stopped\n", cpu);
@@ -646,7 +665,7 @@ void __cpu_die(unsigned int cpu)
646void cpu_die(void) 665void cpu_die(void)
647{ 666{
648 idle_task_exit(); 667 idle_task_exit();
649 while (signal_processor(smp_processor_id(), sigp_stop) == sigp_busy) 668 while (sigp(smp_processor_id(), sigp_stop) == sigp_busy)
650 cpu_relax(); 669 cpu_relax();
651 for (;;); 670 for (;;);
652} 671}
@@ -717,6 +736,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
717{ 736{
718} 737}
719 738
739void __init smp_setup_processor_id(void)
740{
741 S390_lowcore.cpu_nr = 0;
742 __cpu_logical_map[0] = stap();
743}
744
720/* 745/*
721 * the frequency of the profiling timer can be changed 746 * the frequency of the profiling timer can be changed
722 * by writing a multiplier value into /proc/profile. 747 * by writing a multiplier value into /proc/profile.
@@ -756,7 +781,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev,
756 get_online_cpus(); 781 get_online_cpus();
757 mutex_lock(&smp_cpu_state_mutex); 782 mutex_lock(&smp_cpu_state_mutex);
758 rc = -EBUSY; 783 rc = -EBUSY;
759 if (cpu_online(cpu)) 784 /* disallow configuration changes of online cpus and cpu 0 */
785 if (cpu_online(cpu) || cpu == 0)
760 goto out; 786 goto out;
761 rc = 0; 787 rc = 0;
762 switch (val) { 788 switch (val) {
@@ -995,7 +1021,9 @@ out:
995 return rc; 1021 return rc;
996} 1022}
997 1023
998static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf, 1024static ssize_t __ref rescan_store(struct sysdev_class *class,
1025 struct sysdev_class_attribute *attr,
1026 const char *buf,
999 size_t count) 1027 size_t count)
1000{ 1028{
1001 int rc; 1029 int rc;
@@ -1006,7 +1034,9 @@ static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
1006static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); 1034static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store);
1007#endif /* CONFIG_HOTPLUG_CPU */ 1035#endif /* CONFIG_HOTPLUG_CPU */
1008 1036
1009static ssize_t dispatching_show(struct sysdev_class *class, char *buf) 1037static ssize_t dispatching_show(struct sysdev_class *class,
1038 struct sysdev_class_attribute *attr,
1039 char *buf)
1010{ 1040{
1011 ssize_t count; 1041 ssize_t count;
1012 1042
@@ -1016,7 +1046,9 @@ static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
1016 return count; 1046 return count;
1017} 1047}
1018 1048
1019static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf, 1049static ssize_t dispatching_store(struct sysdev_class *dev,
1050 struct sysdev_class_attribute *attr,
1051 const char *buf,
1020 size_t count) 1052 size_t count)
1021{ 1053{
1022 int val, rc; 1054 int val, rc;
diff --git a/arch/s390/kernel/switch_cpu.S b/arch/s390/kernel/switch_cpu.S
new file mode 100644
index 000000000000..469f11b574fa
--- /dev/null
+++ b/arch/s390/kernel/switch_cpu.S
@@ -0,0 +1,58 @@
1/*
2 * 31-bit switch cpu code
3 *
4 * Copyright IBM Corp. 2009
5 *
6 */
7
8#include <asm/asm-offsets.h>
9#include <asm/ptrace.h>
10
11# smp_switch_to_cpu switches to destination cpu and executes the passed function
12# Parameter: %r2 - function to call
13# %r3 - function parameter
14# %r4 - stack poiner
15# %r5 - current cpu
16# %r6 - destination cpu
17
18 .section .text
19 .align 4
20 .globl smp_switch_to_cpu
21smp_switch_to_cpu:
22 stm %r6,%r15,__SF_GPRS(%r15)
23 lr %r1,%r15
24 ahi %r15,-STACK_FRAME_OVERHEAD
25 st %r1,__SF_BACKCHAIN(%r15)
26 basr %r13,0
270: la %r1,.gprregs_addr-0b(%r13)
28 l %r1,0(%r1)
29 stm %r0,%r15,0(%r1)
301: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
31 brc 2,1b /* busy, try again */
322: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
33 brc 2,2b /* busy, try again */
343: j 3b
35
36 .globl smp_restart_cpu
37smp_restart_cpu:
38 basr %r13,0
390: la %r1,.gprregs_addr-0b(%r13)
40 l %r1,0(%r1)
41 lm %r0,%r15,0(%r1)
421: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */
43 brc 10,1b /* busy, accepted (status 0), running */
44 tmll %r0,0x40 /* Test if calling CPU is stopped */
45 jz 1b
46 ltr %r4,%r4 /* New stack ? */
47 jz 1f
48 lr %r15,%r4
491: basr %r14,%r2
50
51.gprregs_addr:
52 .long .gprregs
53
54 .section .data,"aw",@progbits
55.gprregs:
56 .rept 16
57 .long 0
58 .endr
diff --git a/arch/s390/kernel/switch_cpu64.S b/arch/s390/kernel/switch_cpu64.S
new file mode 100644
index 000000000000..d94aacc898cb
--- /dev/null
+++ b/arch/s390/kernel/switch_cpu64.S
@@ -0,0 +1,51 @@
1/*
2 * 64-bit switch cpu code
3 *
4 * Copyright IBM Corp. 2009
5 *
6 */
7
8#include <asm/asm-offsets.h>
9#include <asm/ptrace.h>
10
11# smp_switch_to_cpu switches to destination cpu and executes the passed function
12# Parameter: %r2 - function to call
13# %r3 - function parameter
14# %r4 - stack poiner
15# %r5 - current cpu
16# %r6 - destination cpu
17
18 .section .text
19 .align 4
20 .globl smp_switch_to_cpu
21smp_switch_to_cpu:
22 stmg %r6,%r15,__SF_GPRS(%r15)
23 lgr %r1,%r15
24 aghi %r15,-STACK_FRAME_OVERHEAD
25 stg %r1,__SF_BACKCHAIN(%r15)
26 larl %r1,.gprregs
27 stmg %r0,%r15,0(%r1)
281: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
29 brc 2,1b /* busy, try again */
302: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
31 brc 2,2b /* busy, try again */
323: j 3b
33
34 .globl smp_restart_cpu
35smp_restart_cpu:
36 larl %r1,.gprregs
37 lmg %r0,%r15,0(%r1)
381: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */
39 brc 10,1b /* busy, accepted (status 0), running */
40 tmll %r0,0x40 /* Test if calling CPU is stopped */
41 jz 1b
42 ltgr %r4,%r4 /* New stack ? */
43 jz 1f
44 lgr %r15,%r4
451: basr %r14,%r2
46
47 .section .data,"aw",@progbits
48.gprregs:
49 .rept 16
50 .quad 0
51 .endr
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index 0c26cc1898ec..c56d3f56d020 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -176,7 +176,7 @@ pgm_check_entry:
176 cgr %r1,%r2 176 cgr %r1,%r2
177 je restore_registers /* r1 = r2 -> nothing to do */ 177 je restore_registers /* r1 = r2 -> nothing to do */
178 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */ 178 larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
179 mvc __LC_RESTART_PSW(16,%r0),0(%r4) 179 mvc __LC_RST_NEW_PSW(16,%r0),0(%r4)
1803: 1803:
181 sigp %r9,%r1,__SIGP_INITIAL_CPU_RESET 181 sigp %r9,%r1,__SIGP_INITIAL_CPU_RESET
182 brc 8,4f /* accepted */ 182 brc 8,4f /* accepted */
@@ -256,6 +256,9 @@ restore_registers:
256 lghi %r2,0 256 lghi %r2,0
257 brasl %r14,arch_set_page_states 257 brasl %r14,arch_set_page_states
258 258
259 /* Reinitialize the channel subsystem */
260 brasl %r14,channel_subsystem_reinit
261
259 /* Return 0 */ 262 /* Return 0 */
260 lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15) 263 lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15)
261 lghi %r2,0 264 lghi %r2,0
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index e9d94f61d500..7b6b0f81a283 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -32,40 +32,13 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include "entry.h" 33#include "entry.h"
34 34
35/* common code for old and new mmaps */
36static inline long do_mmap2(
37 unsigned long addr, unsigned long len,
38 unsigned long prot, unsigned long flags,
39 unsigned long fd, unsigned long pgoff)
40{
41 long error = -EBADF;
42 struct file * file = NULL;
43
44 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
45 if (!(flags & MAP_ANONYMOUS)) {
46 file = fget(fd);
47 if (!file)
48 goto out;
49 }
50
51 down_write(&current->mm->mmap_sem);
52 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
53 up_write(&current->mm->mmap_sem);
54
55 if (file)
56 fput(file);
57out:
58 return error;
59}
60
61/* 35/*
62 * Perform the select(nd, in, out, ex, tv) and mmap() system 36 * Perform the mmap() system call. Linux for S/390 isn't able to handle more
63 * calls. Linux for S/390 isn't able to handle more than 5 37 * than 5 system call parameters, so this system call uses a memory block
64 * system call parameters, so these system calls used a memory 38 * for parameter passing.
65 * block for parameter passing..
66 */ 39 */
67 40
68struct mmap_arg_struct { 41struct s390_mmap_arg_struct {
69 unsigned long addr; 42 unsigned long addr;
70 unsigned long len; 43 unsigned long len;
71 unsigned long prot; 44 unsigned long prot;
@@ -74,31 +47,14 @@ struct mmap_arg_struct {
74 unsigned long offset; 47 unsigned long offset;
75}; 48};
76 49
77SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg) 50SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
78{ 51{
79 struct mmap_arg_struct a; 52 struct s390_mmap_arg_struct a;
80 int error = -EFAULT; 53 int error = -EFAULT;
81 54
82 if (copy_from_user(&a, arg, sizeof(a))) 55 if (copy_from_user(&a, arg, sizeof(a)))
83 goto out; 56 goto out;
84 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 57 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
85out:
86 return error;
87}
88
89SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
90{
91 struct mmap_arg_struct a;
92 long error = -EFAULT;
93
94 if (copy_from_user(&a, arg, sizeof(a)))
95 goto out;
96
97 error = -EINVAL;
98 if (a.offset & ~PAGE_MASK)
99 goto out;
100
101 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
102out: 58out:
103 return error; 59 return error;
104} 60}
@@ -108,7 +64,7 @@ out:
108 * 64 *
109 * This is really horribly ugly. 65 * This is really horribly ugly.
110 */ 66 */
111SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second, 67SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
112 unsigned long, third, void __user *, ptr) 68 unsigned long, third, void __user *, ptr)
113{ 69{
114 struct ipc_kludge tmp; 70 struct ipc_kludge tmp;
@@ -175,17 +131,6 @@ SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
175} 131}
176 132
177#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
178SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name)
179{
180 int ret = sys_newuname(name);
181
182 if (personality(current->personality) == PER_LINUX32 && !ret) {
183 ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
184 if (ret) ret = -EFAULT;
185 }
186 return ret;
187}
188
189SYSCALL_DEFINE1(s390_personality, unsigned long, personality) 134SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
190{ 135{
191 int ret; 136 int ret;
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 30eca070d426..201ce6bed34e 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper)
98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) 98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper)
99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) 99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper)
100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ 100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */
101SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */ 101SYSCALL(sys_old_mmap,sys_old_mmap,old32_mmap_wrapper) /* 90 */
102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) 102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper)
103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) 103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper)
104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) 104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper)
@@ -125,12 +125,12 @@ NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
133SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,sys_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index b5e75e1061c8..a0ffc7717ed6 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/slab.h>
14#include <asm/ebcdic.h> 15#include <asm/ebcdic.h>
15#include <asm/sysinfo.h> 16#include <asm/sysinfo.h>
16#include <asm/cpcmd.h> 17#include <asm/cpcmd.h>
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 34162a0b2caa..d906bf19c14a 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -36,6 +36,7 @@
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/clocksource.h> 37#include <linux/clocksource.h>
38#include <linux/clockchips.h> 38#include <linux/clockchips.h>
39#include <linux/gfp.h>
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40#include <asm/delay.h> 41#include <asm/delay.h>
41#include <asm/s390_ext.h> 42#include <asm/s390_ext.h>
@@ -51,14 +52,6 @@
51#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ) 52#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ)
52#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12) 53#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12)
53 54
54/*
55 * Create a small time difference between the timer interrupts
56 * on the different cpus to avoid lock contention.
57 */
58#define CPU_DEVIATION (smp_processor_id() << 12)
59
60#define TICK_SIZE tick
61
62u64 sched_clock_base_cc = -1; /* Force to data section. */ 55u64 sched_clock_base_cc = -1; /* Force to data section. */
63EXPORT_SYMBOL_GPL(sched_clock_base_cc); 56EXPORT_SYMBOL_GPL(sched_clock_base_cc);
64 57
@@ -81,15 +74,15 @@ unsigned long long monotonic_clock(void)
81} 74}
82EXPORT_SYMBOL(monotonic_clock); 75EXPORT_SYMBOL(monotonic_clock);
83 76
84void tod_to_timeval(__u64 todval, struct timespec *xtime) 77void tod_to_timeval(__u64 todval, struct timespec *xt)
85{ 78{
86 unsigned long long sec; 79 unsigned long long sec;
87 80
88 sec = todval >> 12; 81 sec = todval >> 12;
89 do_div(sec, 1000000); 82 do_div(sec, 1000000);
90 xtime->tv_sec = sec; 83 xt->tv_sec = sec;
91 todval -= (sec * 1000000) << 12; 84 todval -= (sec * 1000000) << 12;
92 xtime->tv_nsec = ((todval * 1000) >> 12); 85 xt->tv_nsec = ((todval * 1000) >> 12);
93} 86}
94EXPORT_SYMBOL(tod_to_timeval); 87EXPORT_SYMBOL(tod_to_timeval);
95 88
@@ -214,7 +207,8 @@ struct clocksource * __init clocksource_default_clock(void)
214 return &clocksource_tod; 207 return &clocksource_tod;
215} 208}
216 209
217void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) 210void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
211 u32 mult)
218{ 212{
219 if (clock != &clocksource_tod) 213 if (clock != &clocksource_tod)
220 return; 214 return;
@@ -223,10 +217,11 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
223 ++vdso_data->tb_update_count; 217 ++vdso_data->tb_update_count;
224 smp_wmb(); 218 smp_wmb();
225 vdso_data->xtime_tod_stamp = clock->cycle_last; 219 vdso_data->xtime_tod_stamp = clock->cycle_last;
226 vdso_data->xtime_clock_sec = xtime.tv_sec; 220 vdso_data->xtime_clock_sec = wall_time->tv_sec;
227 vdso_data->xtime_clock_nsec = xtime.tv_nsec; 221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
228 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
229 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
224 vdso_data->ntp_mult = mult;
230 smp_wmb(); 225 smp_wmb();
231 ++vdso_data->tb_update_count; 226 ++vdso_data->tb_update_count;
232} 227}
@@ -334,7 +329,7 @@ int get_sync_clock(unsigned long long *clock)
334 sw0 = atomic_read(sw_ptr); 329 sw0 = atomic_read(sw_ptr);
335 *clock = get_clock(); 330 *clock = get_clock();
336 sw1 = atomic_read(sw_ptr); 331 sw1 = atomic_read(sw_ptr);
337 put_cpu_var(clock_sync_sync); 332 put_cpu_var(clock_sync_word);
338 if (sw0 == sw1 && (sw0 & 0x80000000U)) 333 if (sw0 == sw1 && (sw0 & 0x80000000U))
339 /* Success: time is in sync. */ 334 /* Success: time is in sync. */
340 return 0; 335 return 0;
@@ -384,7 +379,7 @@ static inline int check_sync_clock(void)
384 379
385 sw_ptr = &get_cpu_var(clock_sync_word); 380 sw_ptr = &get_cpu_var(clock_sync_word);
386 rc = (atomic_read(sw_ptr) & 0x80000000U) != 0; 381 rc = (atomic_read(sw_ptr) & 0x80000000U) != 0;
387 put_cpu_var(clock_sync_sync); 382 put_cpu_var(clock_sync_word);
388 return rc; 383 return rc;
389} 384}
390 385
@@ -1123,14 +1118,18 @@ static struct sys_device etr_port1_dev = {
1123/* 1118/*
1124 * ETR class attributes 1119 * ETR class attributes
1125 */ 1120 */
1126static ssize_t etr_stepping_port_show(struct sysdev_class *class, char *buf) 1121static ssize_t etr_stepping_port_show(struct sysdev_class *class,
1122 struct sysdev_class_attribute *attr,
1123 char *buf)
1127{ 1124{
1128 return sprintf(buf, "%i\n", etr_port0.esw.p); 1125 return sprintf(buf, "%i\n", etr_port0.esw.p);
1129} 1126}
1130 1127
1131static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); 1128static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
1132 1129
1133static ssize_t etr_stepping_mode_show(struct sysdev_class *class, char *buf) 1130static ssize_t etr_stepping_mode_show(struct sysdev_class *class,
1131 struct sysdev_class_attribute *attr,
1132 char *buf)
1134{ 1133{
1135 char *mode_str; 1134 char *mode_str;
1136 1135
@@ -1591,7 +1590,9 @@ static struct sysdev_class stp_sysclass = {
1591 .name = "stp", 1590 .name = "stp",
1592}; 1591};
1593 1592
1594static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf) 1593static ssize_t stp_ctn_id_show(struct sysdev_class *class,
1594 struct sysdev_class_attribute *attr,
1595 char *buf)
1595{ 1596{
1596 if (!stp_online) 1597 if (!stp_online)
1597 return -ENODATA; 1598 return -ENODATA;
@@ -1601,7 +1602,9 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf)
1601 1602
1602static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); 1603static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
1603 1604
1604static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf) 1605static ssize_t stp_ctn_type_show(struct sysdev_class *class,
1606 struct sysdev_class_attribute *attr,
1607 char *buf)
1605{ 1608{
1606 if (!stp_online) 1609 if (!stp_online)
1607 return -ENODATA; 1610 return -ENODATA;
@@ -1610,7 +1613,9 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf)
1610 1613
1611static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); 1614static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
1612 1615
1613static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf) 1616static ssize_t stp_dst_offset_show(struct sysdev_class *class,
1617 struct sysdev_class_attribute *attr,
1618 char *buf)
1614{ 1619{
1615 if (!stp_online || !(stp_info.vbits & 0x2000)) 1620 if (!stp_online || !(stp_info.vbits & 0x2000))
1616 return -ENODATA; 1621 return -ENODATA;
@@ -1619,7 +1624,9 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf)
1619 1624
1620static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); 1625static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
1621 1626
1622static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf) 1627static ssize_t stp_leap_seconds_show(struct sysdev_class *class,
1628 struct sysdev_class_attribute *attr,
1629 char *buf)
1623{ 1630{
1624 if (!stp_online || !(stp_info.vbits & 0x8000)) 1631 if (!stp_online || !(stp_info.vbits & 0x8000))
1625 return -ENODATA; 1632 return -ENODATA;
@@ -1628,7 +1635,9 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf)
1628 1635
1629static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); 1636static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
1630 1637
1631static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf) 1638static ssize_t stp_stratum_show(struct sysdev_class *class,
1639 struct sysdev_class_attribute *attr,
1640 char *buf)
1632{ 1641{
1633 if (!stp_online) 1642 if (!stp_online)
1634 return -ENODATA; 1643 return -ENODATA;
@@ -1637,7 +1646,9 @@ static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf)
1637 1646
1638static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); 1647static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL);
1639 1648
1640static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf) 1649static ssize_t stp_time_offset_show(struct sysdev_class *class,
1650 struct sysdev_class_attribute *attr,
1651 char *buf)
1641{ 1652{
1642 if (!stp_online || !(stp_info.vbits & 0x0800)) 1653 if (!stp_online || !(stp_info.vbits & 0x0800))
1643 return -ENODATA; 1654 return -ENODATA;
@@ -1646,7 +1657,9 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf)
1646 1657
1647static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); 1658static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
1648 1659
1649static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf) 1660static ssize_t stp_time_zone_offset_show(struct sysdev_class *class,
1661 struct sysdev_class_attribute *attr,
1662 char *buf)
1650{ 1663{
1651 if (!stp_online || !(stp_info.vbits & 0x4000)) 1664 if (!stp_online || !(stp_info.vbits & 0x4000))
1652 return -ENODATA; 1665 return -ENODATA;
@@ -1656,7 +1669,9 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf)
1656static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, 1669static SYSDEV_CLASS_ATTR(time_zone_offset, 0400,
1657 stp_time_zone_offset_show, NULL); 1670 stp_time_zone_offset_show, NULL);
1658 1671
1659static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf) 1672static ssize_t stp_timing_mode_show(struct sysdev_class *class,
1673 struct sysdev_class_attribute *attr,
1674 char *buf)
1660{ 1675{
1661 if (!stp_online) 1676 if (!stp_online)
1662 return -ENODATA; 1677 return -ENODATA;
@@ -1665,7 +1680,9 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf)
1665 1680
1666static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); 1681static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
1667 1682
1668static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf) 1683static ssize_t stp_timing_state_show(struct sysdev_class *class,
1684 struct sysdev_class_attribute *attr,
1685 char *buf)
1669{ 1686{
1670 if (!stp_online) 1687 if (!stp_online)
1671 return -ENODATA; 1688 return -ENODATA;
@@ -1674,12 +1691,15 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf)
1674 1691
1675static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); 1692static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
1676 1693
1677static ssize_t stp_online_show(struct sysdev_class *class, char *buf) 1694static ssize_t stp_online_show(struct sysdev_class *class,
1695 struct sysdev_class_attribute *attr,
1696 char *buf)
1678{ 1697{
1679 return sprintf(buf, "%i\n", stp_online); 1698 return sprintf(buf, "%i\n", stp_online);
1680} 1699}
1681 1700
1682static ssize_t stp_online_store(struct sysdev_class *class, 1701static ssize_t stp_online_store(struct sysdev_class *class,
1702 struct sysdev_class_attribute *attr,
1683 const char *buf, size_t count) 1703 const char *buf, size_t count)
1684{ 1704{
1685 unsigned int value; 1705 unsigned int value;
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 3c72c9cf22b6..247b4c2d1e51 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -114,7 +114,7 @@ static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core)
114 114
115 rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; 115 rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin;
116 for_each_present_cpu(lcpu) { 116 for_each_present_cpu(lcpu) {
117 if (__cpu_logical_map[lcpu] == rcpu) { 117 if (cpu_logical_map(lcpu) == rcpu) {
118 cpu_set(lcpu, core->mask); 118 cpu_set(lcpu, core->mask);
119 smp_cpu_polarization[lcpu] = tl_cpu->pp; 119 smp_cpu_polarization[lcpu] = tl_cpu->pp;
120 } 120 }
@@ -165,10 +165,11 @@ static void tl_to_cores(struct tl_info *info)
165 default: 165 default:
166 clear_cores(); 166 clear_cores();
167 machine_has_topology = 0; 167 machine_has_topology = 0;
168 return; 168 goto out;
169 } 169 }
170 tle = next_tle(tle); 170 tle = next_tle(tle);
171 } 171 }
172out:
172 spin_unlock_irq(&topology_lock); 173 spin_unlock_irq(&topology_lock);
173} 174}
174 175
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index c2e42cc65ce7..6e7ad63854c0 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -18,7 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/ptrace.h> 21#include <linux/tracehook.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/smp.h> 24#include <linux/smp.h>
@@ -382,7 +382,7 @@ void __kprobes do_single_step(struct pt_regs *regs)
382 SIGTRAP) == NOTIFY_STOP){ 382 SIGTRAP) == NOTIFY_STOP){
383 return; 383 return;
384 } 384 }
385 if ((current->ptrace & PT_PTRACED) != 0) 385 if (tracehook_consider_fatal_signal(current, SIGTRAP))
386 force_sig(SIGTRAP, current); 386 force_sig(SIGTRAP, current);
387} 387}
388 388
@@ -483,7 +483,7 @@ static void illegal_op(struct pt_regs * regs, long interruption_code)
483 if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) 483 if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
484 return; 484 return;
485 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { 485 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
486 if (current->ptrace & PT_PTRACED) 486 if (tracehook_consider_fatal_signal(current, SIGTRAP))
487 force_sig(SIGTRAP, current); 487 force_sig(SIGTRAP, current);
488 else 488 else
489 signal = SIGILL; 489 signal = SIGILL;
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index adfb32aa6d59..6bc9c197aa91 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -23,6 +23,7 @@
23#include <linux/security.h> 23#include <linux/security.h>
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/compat.h> 25#include <linux/compat.h>
26#include <asm/asm-offsets.h>
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
27#include <asm/system.h> 28#include <asm/system.h>
28#include <asm/processor.h> 29#include <asm/processor.h>
@@ -86,7 +87,8 @@ static void vdso_init_data(struct vdso_data *vd)
86 unsigned int facility_list; 87 unsigned int facility_list;
87 88
88 facility_list = stfl(); 89 facility_list = stfl();
89 vd->ectg_available = switch_amode && (facility_list & 1); 90 vd->ectg_available =
91 user_mode != HOME_SPACE_MODE && (facility_list & 1);
90} 92}
91 93
92#ifdef CONFIG_64BIT 94#ifdef CONFIG_64BIT
@@ -114,7 +116,7 @@ int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore)
114 116
115 lowcore->vdso_per_cpu_data = __LC_PASTE; 117 lowcore->vdso_per_cpu_data = __LC_PASTE;
116 118
117 if (!switch_amode || !vdso_enabled) 119 if (user_mode == HOME_SPACE_MODE || !vdso_enabled)
118 return 0; 120 return 0;
119 121
120 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER); 122 segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER);
@@ -160,7 +162,7 @@ void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore)
160 unsigned long segment_table, page_table, page_frame; 162 unsigned long segment_table, page_table, page_frame;
161 u32 *psal, *aste; 163 u32 *psal, *aste;
162 164
163 if (!switch_amode || !vdso_enabled) 165 if (user_mode == HOME_SPACE_MODE || !vdso_enabled)
164 return; 166 return;
165 167
166 psal = (u32 *)(addr_t) lowcore->paste[4]; 168 psal = (u32 *)(addr_t) lowcore->paste[4];
@@ -184,7 +186,7 @@ static void __vdso_init_cr5(void *dummy)
184 186
185static void vdso_init_cr5(void) 187static void vdso_init_cr5(void)
186{ 188{
187 if (switch_amode && vdso_enabled) 189 if (user_mode != HOME_SPACE_MODE && vdso_enabled)
188 on_each_cpu(__vdso_init_cr5, NULL, 1); 190 on_each_cpu(__vdso_init_cr5, NULL, 1);
189} 191}
190#endif /* CONFIG_64BIT */ 192#endif /* CONFIG_64BIT */
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 4a98909a8310..969643954273 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -38,13 +38,13 @@ __kernel_clock_gettime:
38 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 38 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
39 brc 3,2f 39 brc 3,2f
40 ahi %r0,-1 40 ahi %r0,-1
412: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 412: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
42 lr %r2,%r0 42 lr %r2,%r0
43 lhi %r0,1000 43 l %r0,__VDSO_NTP_MULT(%r5)
44 ltr %r1,%r1 44 ltr %r1,%r1
45 mr %r0,%r0 45 mr %r0,%r0
46 jnm 3f 46 jnm 3f
47 ahi %r0,1000 47 a %r0,__VDSO_NTP_MULT(%r5)
483: alr %r0,%r2 483: alr %r0,%r2
49 srdl %r0,12 49 srdl %r0,12
50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
@@ -86,13 +86,13 @@ __kernel_clock_gettime:
86 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 86 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
87 brc 3,12f 87 brc 3,12f
88 ahi %r0,-1 88 ahi %r0,-1
8912: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 8912: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
90 lr %r2,%r0 90 lr %r2,%r0
91 lhi %r0,1000 91 l %r0,__VDSO_NTP_MULT(%r5)
92 ltr %r1,%r1 92 ltr %r1,%r1
93 mr %r0,%r0 93 mr %r0,%r0
94 jnm 13f 94 jnm 13f
95 ahi %r0,1000 95 a %r0,__VDSO_NTP_MULT(%r5)
9613: alr %r0,%r2 9613: alr %r0,%r2
97 srdl %r0,12 97 srdl %r0,12
98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S
index ad8acfc949fb..2d3633175e3b 100644
--- a/arch/s390/kernel/vdso32/gettimeofday.S
+++ b/arch/s390/kernel/vdso32/gettimeofday.S
@@ -35,13 +35,13 @@ __kernel_gettimeofday:
35 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 35 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
36 brc 3,3f 36 brc 3,3f
37 ahi %r0,-1 37 ahi %r0,-1
383: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 383: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
39 st %r0,24(%r15) 39 st %r0,24(%r15)
40 lhi %r0,1000 40 l %r0,__VDSO_NTP_MULT(%r5)
41 ltr %r1,%r1 41 ltr %r1,%r1
42 mr %r0,%r0 42 mr %r0,%r0
43 jnm 4f 43 jnm 4f
44 ahi %r0,1000 44 a %r0,__VDSO_NTP_MULT(%r5)
454: al %r0,24(%r15) 454: al %r0,24(%r15)
46 srdl %r0,12 46 srdl %r0,12
47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index 49106c6e6f88..f40467884a03 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -36,7 +36,7 @@ __kernel_clock_gettime:
36 stck 48(%r15) /* Store TOD clock */ 36 stck 48(%r15) /* Store TOD clock */
37 lg %r1,48(%r15) 37 lg %r1,48(%r15)
38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
39 mghi %r1,1000 39 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
42 lg %r0,__VDSO_XTIME_SEC(%r5) 42 lg %r0,__VDSO_XTIME_SEC(%r5)
@@ -64,7 +64,7 @@ __kernel_clock_gettime:
64 stck 48(%r15) /* Store TOD clock */ 64 stck 48(%r15) /* Store TOD clock */
65 lg %r1,48(%r15) 65 lg %r1,48(%r15)
66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
67 mghi %r1,1000 67 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
70 lg %r0,__VDSO_XTIME_SEC(%r5) 70 lg %r0,__VDSO_XTIME_SEC(%r5)
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S
index f873e75634e1..36ee674722ec 100644
--- a/arch/s390/kernel/vdso64/gettimeofday.S
+++ b/arch/s390/kernel/vdso64/gettimeofday.S
@@ -31,7 +31,7 @@ __kernel_gettimeofday:
31 stck 48(%r15) /* Store TOD clock */ 31 stck 48(%r15) /* Store TOD clock */
32 lg %r1,48(%r15) 32 lg %r1,48(%r15)
33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
34 mghi %r1,1000 34 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */ 36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */
37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */ 37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index c41bb0d416e1..b59a812a010e 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -167,6 +167,8 @@ void vtime_stop_cpu(void)
167 /* Wait for external, I/O or machine check interrupt. */ 167 /* Wait for external, I/O or machine check interrupt. */
168 psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT; 168 psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT;
169 169
170 idle->nohz_delay = 0;
171
170 /* Check if the CPU timer needs to be reprogrammed. */ 172 /* Check if the CPU timer needs to be reprogrammed. */
171 if (vq->do_spt) { 173 if (vq->do_spt) {
172 __u64 vmax = VTIMER_MAX_SLICE; 174 __u64 vmax = VTIMER_MAX_SLICE;