aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/bug.h4
-rw-r--r--arch/s390/include/asm/irqflags.h9
-rw-r--r--arch/s390/include/asm/sigp.h20
-rw-r--r--arch/s390/include/asm/thread_info.h12
-rw-r--r--arch/s390/include/asm/unistd.h6
-rw-r--r--arch/s390/kernel/compat_linux.c41
-rw-r--r--arch/s390/kernel/compat_wrapper.S9
-rw-r--r--arch/s390/kernel/entry.S1
-rw-r--r--arch/s390/kernel/entry64.S1
-rw-r--r--arch/s390/kernel/process.c3
-rw-r--r--arch/s390/kernel/ptrace.c8
-rw-r--r--arch/s390/kernel/setup.c8
-rw-r--r--arch/s390/kernel/signal.c12
-rw-r--r--arch/s390/kernel/smp.c9
-rw-r--r--arch/s390/kernel/syscalls.S1
-rw-r--r--arch/s390/kernel/topology.c2
-rw-r--r--arch/s390/kvm/intercept.c4
-rw-r--r--arch/s390/lib/spinlock.c2
-rw-r--r--arch/s390/mm/mmap.c4
19 files changed, 74 insertions, 82 deletions
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index efb74fd5156e..b1066b9fb5f8 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -52,6 +52,10 @@
52 unreachable(); \ 52 unreachable(); \
53} while (0) 53} while (0)
54 54
55#define __WARN() do { \
56 __EMIT_BUG(BUGFLAG_WARNING); \
57} while (0)
58
55#define WARN_ON(x) ({ \ 59#define WARN_ON(x) ({ \
56 int __ret_warn_on = !!(x); \ 60 int __ret_warn_on = !!(x); \
57 if (__builtin_constant_p(__ret_warn_on)) { \ 61 if (__builtin_constant_p(__ret_warn_on)) { \
diff --git a/arch/s390/include/asm/irqflags.h b/arch/s390/include/asm/irqflags.h
index 3f26131120b7..c2fb432f576a 100644
--- a/arch/s390/include/asm/irqflags.h
+++ b/arch/s390/include/asm/irqflags.h
@@ -1,14 +1,12 @@
1/* 1/*
2 * include/asm-s390/irqflags.h 2 * Copyright IBM Corp. 2006,2010
3 * 3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */ 4 */
7 5
8#ifndef __ASM_IRQFLAGS_H 6#ifndef __ASM_IRQFLAGS_H
9#define __ASM_IRQFLAGS_H 7#define __ASM_IRQFLAGS_H
10 8
11#ifdef __KERNEL__ 9#include <linux/types.h>
12 10
13#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) 11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
14 12
@@ -102,5 +100,4 @@ static inline int raw_irqs_disabled_flags(unsigned long flags)
102/* For spinlocks etc */ 100/* For spinlocks etc */
103#define raw_local_irq_save(x) ((x) = raw_local_irq_disable()) 101#define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
104 102
105#endif /* __KERNEL__ */
106#endif /* __ASM_IRQFLAGS_H */ 103#endif /* __ASM_IRQFLAGS_H */
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
index ec403d4304f8..f72d611f7e13 100644
--- a/arch/s390/include/asm/sigp.h
+++ b/arch/s390/include/asm/sigp.h
@@ -15,11 +15,19 @@
15#ifndef __SIGP__ 15#ifndef __SIGP__
16#define __SIGP__ 16#define __SIGP__
17 17
18#include <asm/ptrace.h> 18#include <asm/system.h>
19#include <asm/atomic.h>
20 19
21/* get real cpu address from logical cpu number */ 20/* get real cpu address from logical cpu number */
22extern volatile int __cpu_logical_map[]; 21extern int __cpu_logical_map[];
22
23static inline int cpu_logical_map(int cpu)
24{
25#ifdef CONFIG_SMP
26 return __cpu_logical_map[cpu];
27#else
28 return stap();
29#endif
30}
23 31
24typedef enum 32typedef enum
25{ 33{
@@ -79,7 +87,7 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code)
79 " ipm %0\n" 87 " ipm %0\n"
80 " srl %0,28\n" 88 " srl %0,28\n"
81 : "=d" (ccode) 89 : "=d" (ccode)
82 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), 90 : "d" (reg1), "d" (cpu_logical_map(cpu_addr)),
83 "a" (order_code) : "cc" , "memory"); 91 "a" (order_code) : "cc" , "memory");
84 return ccode; 92 return ccode;
85} 93}
@@ -98,7 +106,7 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
98 " ipm %0\n" 106 " ipm %0\n"
99 " srl %0,28\n" 107 " srl %0,28\n"
100 : "=d" (ccode) 108 : "=d" (ccode)
101 : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), 109 : "d" (reg1), "d" (cpu_logical_map(cpu_addr)),
102 "a" (order_code) : "cc" , "memory"); 110 "a" (order_code) : "cc" , "memory");
103 return ccode; 111 return ccode;
104} 112}
@@ -118,7 +126,7 @@ signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
118 " ipm %0\n" 126 " ipm %0\n"
119 " srl %0,28\n" 127 " srl %0,28\n"
120 : "=d" (ccode), "+d" (reg1) 128 : "=d" (ccode), "+d" (reg1)
121 : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) 129 : "d" (cpu_logical_map(cpu_addr)), "a" (order_code)
122 : "cc" , "memory"); 130 : "cc" , "memory");
123 *statusptr = reg1; 131 *statusptr = reg1;
124 return ccode; 132 return ccode;
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 07eb61b2fb3a..66069e736842 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -93,13 +93,12 @@ static inline struct thread_info *current_thread_info(void)
93#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 93#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
94#define TIF_SECCOMP 10 /* secure computing */ 94#define TIF_SECCOMP 10 /* secure computing */
95#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 95#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
96#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 96#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
97#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling
98 TIF_NEED_RESCHED */ 97 TIF_NEED_RESCHED */
99#define TIF_31BIT 18 /* 32bit process */ 98#define TIF_31BIT 17 /* 32bit process */
100#define TIF_MEMDIE 19 99#define TIF_MEMDIE 18
101#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ 100#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
102#define TIF_FREEZE 21 /* thread is freezing for suspend */ 101#define TIF_FREEZE 20 /* thread is freezing for suspend */
103 102
104#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 103#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
105#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 104#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
@@ -112,7 +111,6 @@ static inline struct thread_info *current_thread_info(void)
112#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 111#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
113#define _TIF_SECCOMP (1<<TIF_SECCOMP) 112#define _TIF_SECCOMP (1<<TIF_SECCOMP)
114#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 113#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
115#define _TIF_USEDFPU (1<<TIF_USEDFPU)
116#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 114#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
117#define _TIF_31BIT (1<<TIF_31BIT) 115#define _TIF_31BIT (1<<TIF_31BIT)
118#define _TIF_FREEZE (1<<TIF_FREEZE) 116#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 192a7203a14f..6e9f049fa823 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -269,8 +269,7 @@
269#define __NR_pwritev 329 269#define __NR_pwritev 329
270#define __NR_rt_tgsigqueueinfo 330 270#define __NR_rt_tgsigqueueinfo 330
271#define __NR_perf_event_open 331 271#define __NR_perf_event_open 331
272#define __NR_recvmmsg 332 272#define NR_syscalls 332
273#define NR_syscalls 333
274 273
275/* 274/*
276 * There are some system calls that are not present on 64 bit, some 275 * There are some system calls that are not present on 64 bit, some
@@ -377,6 +376,9 @@
377#define __IGNORE_migrate_pages 376#define __IGNORE_migrate_pages
378#define __IGNORE_move_pages 377#define __IGNORE_move_pages
379 378
379/* Ignore system calls that are also reachable via sys_socket */
380#define __IGNORE_recvmmsg
381
380#define __ARCH_WANT_IPC_PARSE_VERSION 382#define __ARCH_WANT_IPC_PARSE_VERSION
381#define __ARCH_WANT_OLD_READDIR 383#define __ARCH_WANT_OLD_READDIR
382#define __ARCH_WANT_SYS_ALARM 384#define __ARCH_WANT_SYS_ALARM
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 22c9e557bb22..11c3aba664ea 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -616,44 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
616 */ 616 */
617 617
618struct mmap_arg_struct_emu31 { 618struct mmap_arg_struct_emu31 {
619 u32 addr; 619 compat_ulong_t addr;
620 u32 len; 620 compat_ulong_t len;
621 u32 prot; 621 compat_ulong_t prot;
622 u32 flags; 622 compat_ulong_t flags;
623 u32 fd; 623 compat_ulong_t fd;
624 u32 offset; 624 compat_ulong_t offset;
625}; 625};
626 626
627asmlinkage unsigned long 627asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
628old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
629{ 628{
630 struct mmap_arg_struct_emu31 a; 629 struct mmap_arg_struct_emu31 a;
631 int error = -EFAULT;
632 630
633 if (copy_from_user(&a, arg, sizeof(a))) 631 if (copy_from_user(&a, arg, sizeof(a)))
634 goto out; 632 return -EFAULT;
635
636 error = -EINVAL;
637 if (a.offset & ~PAGE_MASK) 633 if (a.offset & ~PAGE_MASK)
638 goto out; 634 return -EINVAL;
639 635 a.addr = (unsigned long) compat_ptr(a.addr);
640 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 636 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
641 a.offset >> PAGE_SHIFT); 637 a.offset >> PAGE_SHIFT);
642out:
643 return error;
644} 638}
645 639
646asmlinkage long 640asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
647sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
648{ 641{
649 struct mmap_arg_struct_emu31 a; 642 struct mmap_arg_struct_emu31 a;
650 int error = -EFAULT;
651 643
652 if (copy_from_user(&a, arg, sizeof(a))) 644 if (copy_from_user(&a, arg, sizeof(a)))
653 goto out; 645 return -EFAULT;
654 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 646 a.addr = (unsigned long) compat_ptr(a.addr);
655out: 647 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
656 return error;
657} 648}
658 649
659asmlinkage 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_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index faeaccc7d7d9..30de2d0e52bb 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1853,12 +1853,3 @@ sys32_execve_wrapper:
1853 llgtr %r3,%r3 # compat_uptr_t * 1853 llgtr %r3,%r3 # compat_uptr_t *
1854 llgtr %r4,%r4 # compat_uptr_t * 1854 llgtr %r4,%r4 # compat_uptr_t *
1855 jg sys32_execve # branch to system call 1855 jg sys32_execve # branch to system call
1856
1857 .globl compat_sys_recvmmsg_wrapper
1858compat_sys_recvmmsg_wrapper:
1859 lgfr %r2,%r2 # int
1860 llgtr %r3,%r3 # struct compat_mmsghdr *
1861 llgfr %r4,%r4 # unsigned int
1862 llgfr %r5,%r5 # unsigned int
1863 llgtr %r6,%r6 # struct compat_timespec *
1864 jg compat_sys_recvmmsg
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 48215d15762b..e8ef21c51bbe 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -571,6 +571,7 @@ pgm_svcper:
571 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID 571 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 572 oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
573 TRACE_IRQS_ON 573 TRACE_IRQS_ON
574 lm %r2,%r6,SP_R2(%r15) # load svc arguments
574 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 575 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
575 b BASED(sysc_do_svc) 576 b BASED(sysc_do_svc)
576 577
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 9aff1d449b6e..f33658f09dd7 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -549,6 +549,7 @@ pgm_svcper:
549 mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID 549 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 550 oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
551 TRACE_IRQS_ON 551 TRACE_IRQS_ON
552 lmg %r2,%r6,SP_R2(%r15) # load svc arguments
552 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 553 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
553 j sysc_do_svc 554 j sysc_do_svc
554 555
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 5417eb57271a..00b6d1d292f2 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -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 13815d39f7dd..7cf464234419 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)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 0663287fa1b3..8d8957b38ab3 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -87,7 +87,6 @@ unsigned long elf_hwcap = 0;
87char elf_platform[ELF_PLATFORM_SIZE]; 87char elf_platform[ELF_PLATFORM_SIZE];
88 88
89struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 89struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
90volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
91 90
92int __initdata memory_end_set; 91int __initdata memory_end_set;
93unsigned long __initdata memory_end; 92unsigned long __initdata memory_end;
@@ -124,12 +123,6 @@ void __cpuinit cpu_init(void)
124 */ 123 */
125 get_cpu_id(&S390_lowcore.cpu_id); 124 get_cpu_id(&S390_lowcore.cpu_id);
126 125
127 /*
128 * Force FPU initialization:
129 */
130 clear_thread_flag(TIF_USEDFPU);
131 clear_used_math();
132
133 atomic_inc(&init_mm.mm_count); 126 atomic_inc(&init_mm.mm_count);
134 current->active_mm = &init_mm; 127 current->active_mm = &init_mm;
135 BUG_ON(current->mm); 128 BUG_ON(current->mm);
@@ -855,7 +848,6 @@ setup_arch(char **cmdline_p)
855 setup_lowcore(); 848 setup_lowcore();
856 849
857 cpu_init(); 850 cpu_init();
858 __cpu_logical_map[0] = stap();
859 s390_init_cpu_topology(); 851 s390_init_cpu_topology();
860 852
861 /* 853 /*
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..76a6fdd46c45 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -52,6 +52,9 @@
52#include <asm/cpu.h> 52#include <asm/cpu.h>
53#include "entry.h" 53#include "entry.h"
54 54
55/* logical cpu to cpu address */
56int __cpu_logical_map[NR_CPUS];
57
55static struct task_struct *current_set[NR_CPUS]; 58static struct task_struct *current_set[NR_CPUS];
56 59
57static u8 smp_cpu_type; 60static u8 smp_cpu_type;
@@ -717,6 +720,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
717{ 720{
718} 721}
719 722
723void __init smp_setup_processor_id(void)
724{
725 S390_lowcore.cpu_nr = 0;
726 __cpu_logical_map[0] = stap();
727}
728
720/* 729/*
721 * the frequency of the profiling timer can be changed 730 * the frequency of the profiling timer can be changed
722 * by writing a multiplier value into /proc/profile. 731 * by writing a multiplier value into /proc/profile.
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 4f292c936872..30eca070d426 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -340,4 +340,3 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ 341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */
342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) 342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
343SYSCALL(sys_recvmmsg,sys_recvmmsg,compat_sys_recvmmsg_wrapper)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 3c72c9cf22b6..14ef6f05e432 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 }
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index ba9d8a7bc1ac..b40096494e46 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -213,7 +213,7 @@ static int handle_instruction_and_prog(struct kvm_vcpu *vcpu)
213 return rc2; 213 return rc2;
214} 214}
215 215
216static const intercept_handler_t intercept_funcs[0x48 >> 2] = { 216static const intercept_handler_t intercept_funcs[] = {
217 [0x00 >> 2] = handle_noop, 217 [0x00 >> 2] = handle_noop,
218 [0x04 >> 2] = handle_instruction, 218 [0x04 >> 2] = handle_instruction,
219 [0x08 >> 2] = handle_prog, 219 [0x08 >> 2] = handle_prog,
@@ -230,7 +230,7 @@ int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
230 intercept_handler_t func; 230 intercept_handler_t func;
231 u8 code = vcpu->arch.sie_block->icptcode; 231 u8 code = vcpu->arch.sie_block->icptcode;
232 232
233 if (code & 3 || code > 0x48) 233 if (code & 3 || (code >> 2) >= ARRAY_SIZE(intercept_funcs))
234 return -ENOTSUPP; 234 return -ENOTSUPP;
235 func = intercept_funcs[code >> 2]; 235 func = intercept_funcs[code >> 2];
236 if (func) 236 if (func)
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 10754a375668..cff327f109a8 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -34,7 +34,7 @@ static inline void _raw_yield_cpu(int cpu)
34{ 34{
35 if (MACHINE_HAS_DIAG9C) 35 if (MACHINE_HAS_DIAG9C)
36 asm volatile("diag %0,0,0x9c" 36 asm volatile("diag %0,0,0x9c"
37 : : "d" (__cpu_logical_map[cpu])); 37 : : "d" (cpu_logical_map(cpu)));
38 else 38 else
39 _raw_yield(); 39 _raw_yield();
40} 40}
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index f4558ccf02b9..869efbaed3ea 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -40,7 +40,7 @@
40 40
41static inline unsigned long mmap_base(void) 41static inline unsigned long mmap_base(void)
42{ 42{
43 unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; 43 unsigned long gap = rlimit(RLIMIT_STACK);
44 44
45 if (gap < MIN_GAP) 45 if (gap < MIN_GAP)
46 gap = MIN_GAP; 46 gap = MIN_GAP;
@@ -61,7 +61,7 @@ static inline int mmap_is_legacy(void)
61#endif 61#endif
62 return sysctl_legacy_va_layout || 62 return sysctl_legacy_va_layout ||
63 (current->personality & ADDR_COMPAT_LAYOUT) || 63 (current->personality & ADDR_COMPAT_LAYOUT) ||
64 current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; 64 rlimit(RLIMIT_STACK) == RLIM_INFINITY;
65} 65}
66 66
67#ifndef CONFIG_64BIT 67#ifndef CONFIG_64BIT