aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 17:15:32 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 17:15:32 -0400
commit19bf7f8ac3f8131100027281c495dbbe00cd5ae0 (patch)
tree270b97e3ca47c0f62a1babca2ae37f79a76a309c /arch/s390
parent787c57c0fb393fe8a3974d300ddcfe30373386fe (diff)
parent35fd3dc58da675d659513384221349ef90749a01 (diff)
Merge remote-tracking branch 'master' into queue
Merge reason: development work has dependency on kvm patches merged upstream. Conflicts: arch/powerpc/include/asm/Kbuild arch/powerpc/include/asm/kvm_para.h Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig10
-rw-r--r--arch/s390/Kconfig.debug12
-rw-r--r--arch/s390/boot/compressed/vmlinux.lds.S2
-rw-r--r--arch/s390/include/asm/Kbuild16
-rw-r--r--arch/s390/include/asm/chpid.h19
-rw-r--r--arch/s390/include/asm/cmb.h51
-rw-r--r--arch/s390/include/asm/compat.h75
-rw-r--r--arch/s390/include/asm/css_chars.h3
-rw-r--r--arch/s390/include/asm/debug.h28
-rw-r--r--arch/s390/include/asm/hugetlb.h19
-rw-r--r--arch/s390/include/asm/kvm_para.h14
-rw-r--r--arch/s390/include/asm/mman.h6
-rw-r--r--arch/s390/include/asm/module.h18
-rw-r--r--arch/s390/include/asm/page.h14
-rw-r--r--arch/s390/include/asm/perf_event.h2
-rw-r--r--arch/s390/include/asm/pgtable.h240
-rw-r--r--arch/s390/include/asm/processor.h4
-rw-r--r--arch/s390/include/asm/ptrace.h462
-rw-r--r--arch/s390/include/asm/schid.h15
-rw-r--r--arch/s390/include/asm/setup.h26
-rw-r--r--arch/s390/include/asm/signal.h128
-rw-r--r--arch/s390/include/asm/termios.h42
-rw-r--r--arch/s390/include/asm/thread_info.h4
-rw-r--r--arch/s390/include/asm/tlb.h1
-rw-r--r--arch/s390/include/asm/types.h15
-rw-r--r--arch/s390/include/asm/unistd.h369
-rw-r--r--arch/s390/include/uapi/asm/Kbuild45
-rw-r--r--arch/s390/include/uapi/asm/auxvec.h (renamed from arch/s390/include/asm/auxvec.h)0
-rw-r--r--arch/s390/include/uapi/asm/bitsperlong.h (renamed from arch/s390/include/asm/bitsperlong.h)0
-rw-r--r--arch/s390/include/uapi/asm/byteorder.h (renamed from arch/s390/include/asm/byteorder.h)0
-rw-r--r--arch/s390/include/uapi/asm/chpid.h22
-rw-r--r--arch/s390/include/uapi/asm/chsc.h (renamed from arch/s390/include/asm/chsc.h)10
-rw-r--r--arch/s390/include/uapi/asm/cmb.h53
-rw-r--r--arch/s390/include/uapi/asm/dasd.h (renamed from arch/s390/include/asm/dasd.h)0
-rw-r--r--arch/s390/include/uapi/asm/debug.h34
-rw-r--r--arch/s390/include/uapi/asm/errno.h (renamed from arch/s390/include/asm/errno.h)0
-rw-r--r--arch/s390/include/uapi/asm/fcntl.h (renamed from arch/s390/include/asm/fcntl.h)0
-rw-r--r--arch/s390/include/uapi/asm/ioctl.h (renamed from arch/s390/include/asm/ioctl.h)0
-rw-r--r--arch/s390/include/uapi/asm/ioctls.h (renamed from arch/s390/include/asm/ioctls.h)0
-rw-r--r--arch/s390/include/uapi/asm/ipcbuf.h (renamed from arch/s390/include/asm/ipcbuf.h)0
-rw-r--r--arch/s390/include/uapi/asm/kvm.h (renamed from arch/s390/include/asm/kvm.h)0
-rw-r--r--arch/s390/include/uapi/asm/kvm_para.h11
-rw-r--r--arch/s390/include/uapi/asm/kvm_virtio.h (renamed from arch/s390/include/asm/kvm_virtio.h)0
-rw-r--r--arch/s390/include/uapi/asm/mman.h6
-rw-r--r--arch/s390/include/uapi/asm/monwriter.h (renamed from arch/s390/include/asm/monwriter.h)0
-rw-r--r--arch/s390/include/uapi/asm/msgbuf.h (renamed from arch/s390/include/asm/msgbuf.h)0
-rw-r--r--arch/s390/include/uapi/asm/param.h (renamed from arch/s390/include/asm/param.h)0
-rw-r--r--arch/s390/include/uapi/asm/poll.h (renamed from arch/s390/include/asm/poll.h)0
-rw-r--r--arch/s390/include/uapi/asm/posix_types.h (renamed from arch/s390/include/asm/posix_types.h)0
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h472
-rw-r--r--arch/s390/include/uapi/asm/qeth.h (renamed from arch/s390/include/asm/qeth.h)0
-rw-r--r--arch/s390/include/uapi/asm/resource.h (renamed from arch/s390/include/asm/resource.h)0
-rw-r--r--arch/s390/include/uapi/asm/schid.h16
-rw-r--r--arch/s390/include/uapi/asm/sembuf.h (renamed from arch/s390/include/asm/sembuf.h)0
-rw-r--r--arch/s390/include/uapi/asm/setup.h13
-rw-r--r--arch/s390/include/uapi/asm/shmbuf.h (renamed from arch/s390/include/asm/shmbuf.h)0
-rw-r--r--arch/s390/include/uapi/asm/sigcontext.h (renamed from arch/s390/include/asm/sigcontext.h)0
-rw-r--r--arch/s390/include/uapi/asm/siginfo.h (renamed from arch/s390/include/asm/siginfo.h)0
-rw-r--r--arch/s390/include/uapi/asm/signal.h135
-rw-r--r--arch/s390/include/uapi/asm/socket.h (renamed from arch/s390/include/asm/socket.h)0
-rw-r--r--arch/s390/include/uapi/asm/sockios.h (renamed from arch/s390/include/asm/sockios.h)0
-rw-r--r--arch/s390/include/uapi/asm/stat.h (renamed from arch/s390/include/asm/stat.h)0
-rw-r--r--arch/s390/include/uapi/asm/statfs.h (renamed from arch/s390/include/asm/statfs.h)0
-rw-r--r--arch/s390/include/uapi/asm/swab.h (renamed from arch/s390/include/asm/swab.h)0
-rw-r--r--arch/s390/include/uapi/asm/tape390.h (renamed from arch/s390/include/asm/tape390.h)0
-rw-r--r--arch/s390/include/uapi/asm/termbits.h (renamed from arch/s390/include/asm/termbits.h)0
-rw-r--r--arch/s390/include/uapi/asm/termios.h49
-rw-r--r--arch/s390/include/uapi/asm/types.h22
-rw-r--r--arch/s390/include/uapi/asm/ucontext.h (renamed from arch/s390/include/asm/ucontext.h)0
-rw-r--r--arch/s390/include/uapi/asm/unistd.h374
-rw-r--r--arch/s390/include/uapi/asm/vtoc.h (renamed from arch/s390/include/asm/vtoc.h)0
-rw-r--r--arch/s390/include/uapi/asm/zcrypt.h (renamed from arch/s390/include/asm/zcrypt.h)0
-rw-r--r--arch/s390/kernel/cache.c9
-rw-r--r--arch/s390/kernel/compat_linux.c26
-rw-r--r--arch/s390/kernel/compat_linux.h70
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/early.c19
-rw-r--r--arch/s390/kernel/entry.S51
-rw-r--r--arch/s390/kernel/entry.h3
-rw-r--r--arch/s390/kernel/entry64.S52
-rw-r--r--arch/s390/kernel/head.S101
-rw-r--r--arch/s390/kernel/head31.S3
-rw-r--r--arch/s390/kernel/head64.S3
-rw-r--r--arch/s390/kernel/head_kdump.S10
-rw-r--r--arch/s390/kernel/module.c11
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c6
-rw-r--r--arch/s390/kernel/process.c107
-rw-r--r--arch/s390/kernel/setup.c51
-rw-r--r--arch/s390/kernel/time.c4
-rw-r--r--arch/s390/kernel/vmlinux.lds.S2
-rw-r--r--arch/s390/mm/Makefile1
-rw-r--r--arch/s390/mm/dump_pagetables.c226
-rw-r--r--arch/s390/mm/fault.c1
-rw-r--r--arch/s390/mm/gup.c11
-rw-r--r--arch/s390/mm/pageattr.c40
-rw-r--r--arch/s390/mm/pgtable.c108
-rw-r--r--arch/s390/mm/vmem.c45
97 files changed, 2266 insertions, 1553 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f9acddd9ace3..5dba755a43e6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -68,6 +68,7 @@ config S390
68 select HAVE_FTRACE_MCOUNT_RECORD 68 select HAVE_FTRACE_MCOUNT_RECORD
69 select HAVE_C_RECORDMCOUNT 69 select HAVE_C_RECORDMCOUNT
70 select HAVE_SYSCALL_TRACEPOINTS 70 select HAVE_SYSCALL_TRACEPOINTS
71 select SYSCTL_EXCEPTION_TRACE
71 select HAVE_DYNAMIC_FTRACE 72 select HAVE_DYNAMIC_FTRACE
72 select HAVE_FUNCTION_GRAPH_TRACER 73 select HAVE_FUNCTION_GRAPH_TRACER
73 select HAVE_REGS_AND_STACK_ACCESS_API 74 select HAVE_REGS_AND_STACK_ACCESS_API
@@ -80,6 +81,7 @@ config S390
80 select HAVE_IRQ_WORK 81 select HAVE_IRQ_WORK
81 select HAVE_PERF_EVENTS 82 select HAVE_PERF_EVENTS
82 select ARCH_HAVE_NMI_SAFE_CMPXCHG 83 select ARCH_HAVE_NMI_SAFE_CMPXCHG
84 select HAVE_DEBUG_KMEMLEAK
83 select HAVE_KERNEL_GZIP 85 select HAVE_KERNEL_GZIP
84 select HAVE_KERNEL_BZIP2 86 select HAVE_KERNEL_BZIP2
85 select HAVE_KERNEL_LZMA 87 select HAVE_KERNEL_LZMA
@@ -126,12 +128,17 @@ config S390
126 select ARCH_INLINE_WRITE_UNLOCK_BH 128 select ARCH_INLINE_WRITE_UNLOCK_BH
127 select ARCH_INLINE_WRITE_UNLOCK_IRQ 129 select ARCH_INLINE_WRITE_UNLOCK_IRQ
128 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 130 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
131 select HAVE_UID16 if 32BIT
129 select ARCH_WANT_IPC_PARSE_VERSION 132 select ARCH_WANT_IPC_PARSE_VERSION
133 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
130 select GENERIC_SMP_IDLE_THREAD 134 select GENERIC_SMP_IDLE_THREAD
131 select GENERIC_TIME_VSYSCALL 135 select GENERIC_TIME_VSYSCALL_OLD
132 select GENERIC_CLOCKEVENTS 136 select GENERIC_CLOCKEVENTS
133 select KTIME_SCALAR if 32BIT 137 select KTIME_SCALAR if 32BIT
134 select HAVE_ARCH_SECCOMP_FILTER 138 select HAVE_ARCH_SECCOMP_FILTER
139 select GENERIC_KERNEL_THREAD
140 select HAVE_MOD_ARCH_SPECIFIC
141 select MODULES_USE_ELF_RELA
135 142
136config SCHED_OMIT_FRAME_POINTER 143config SCHED_OMIT_FRAME_POINTER
137 def_bool y 144 def_bool y
@@ -656,7 +663,6 @@ config S390_GUEST
656 depends on 64BIT && EXPERIMENTAL 663 depends on 64BIT && EXPERIMENTAL
657 select VIRTUALIZATION 664 select VIRTUALIZATION
658 select VIRTIO 665 select VIRTIO
659 select VIRTIO_RING
660 select VIRTIO_CONSOLE 666 select VIRTIO_CONSOLE
661 help 667 help
662 Enabling this option adds support for virtio based paravirtual device 668 Enabling this option adds support for virtio based paravirtual device
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
index d76cef3fef37..fc32a2df4974 100644
--- a/arch/s390/Kconfig.debug
+++ b/arch/s390/Kconfig.debug
@@ -31,6 +31,18 @@ config DEBUG_STRICT_USER_COPY_CHECKS
31 31
32 If unsure, or if you run an older (pre 4.4) gcc, say N. 32 If unsure, or if you run an older (pre 4.4) gcc, say N.
33 33
34config S390_PTDUMP
35 bool "Export kernel pagetable layout to userspace via debugfs"
36 depends on DEBUG_KERNEL
37 select DEBUG_FS
38 ---help---
39 Say Y here if you want to show the kernel pagetable layout in a
40 debugfs file. This information is only useful for kernel developers
41 who are working in architecture specific areas of the kernel.
42 It is probably not a good idea to enable this feature in a production
43 kernel.
44 If in doubt, say "N"
45
34config DEBUG_SET_MODULE_RONX 46config DEBUG_SET_MODULE_RONX
35 def_bool y 47 def_bool y
36 depends on MODULES 48 depends on MODULES
diff --git a/arch/s390/boot/compressed/vmlinux.lds.S b/arch/s390/boot/compressed/vmlinux.lds.S
index d80f79d8dd9c..8e1fb8239287 100644
--- a/arch/s390/boot/compressed/vmlinux.lds.S
+++ b/arch/s390/boot/compressed/vmlinux.lds.S
@@ -5,7 +5,7 @@ OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
5OUTPUT_ARCH(s390:64-bit) 5OUTPUT_ARCH(s390:64-bit)
6#else 6#else
7OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") 7OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
8OUTPUT_ARCH(s390) 8OUTPUT_ARCH(s390:31-bit)
9#endif 9#endif
10 10
11ENTRY(startup) 11ENTRY(startup)
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index 287d7bbb6d36..0633dc6d254d 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -1,15 +1,3 @@
1include include/asm-generic/Kbuild.asm
2 1
3header-y += chpid.h 2
4header-y += chsc.h 3generic-y += clkdev.h
5header-y += cmb.h
6header-y += dasd.h
7header-y += debug.h
8header-y += kvm_virtio.h
9header-y += monwriter.h
10header-y += qeth.h
11header-y += schid.h
12header-y += tape390.h
13header-y += ucontext.h
14header-y += vtoc.h
15header-y += zcrypt.h
diff --git a/arch/s390/include/asm/chpid.h b/arch/s390/include/asm/chpid.h
index e5bde9f9291f..38c405ef89ce 100644
--- a/arch/s390/include/asm/chpid.h
+++ b/arch/s390/include/asm/chpid.h
@@ -1,24 +1,11 @@
1/* 1/*
2 * Copyright IBM Corp. 2007 2 * Copyright IBM Corp. 2007, 2012
3 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> 3 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
4 */ 4 */
5
6#ifndef _ASM_S390_CHPID_H 5#ifndef _ASM_S390_CHPID_H
7#define _ASM_S390_CHPID_H 6#define _ASM_S390_CHPID_H
8 7
9#include <linux/string.h> 8#include <uapi/asm/chpid.h>
10#include <linux/types.h>
11
12#define __MAX_CHPID 255
13
14struct chp_id {
15 u8 reserved1;
16 u8 cssid;
17 u8 reserved2;
18 u8 id;
19} __attribute__((packed));
20
21#ifdef __KERNEL__
22#include <asm/cio.h> 9#include <asm/cio.h>
23 10
24static inline void chp_id_init(struct chp_id *chpid) 11static inline void chp_id_init(struct chp_id *chpid)
@@ -49,6 +36,4 @@ static inline int chp_id_is_valid(struct chp_id *chpid)
49 36
50#define chp_id_for_each(c) \ 37#define chp_id_for_each(c) \
51 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c)) 38 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
52#endif /* __KERNEL */
53
54#endif /* _ASM_S390_CHPID_H */ 39#endif /* _ASM_S390_CHPID_H */
diff --git a/arch/s390/include/asm/cmb.h b/arch/s390/include/asm/cmb.h
index 39ae03294794..806eac12e3bd 100644
--- a/arch/s390/include/asm/cmb.h
+++ b/arch/s390/include/asm/cmb.h
@@ -1,61 +1,12 @@
1#ifndef S390_CMB_H 1#ifndef S390_CMB_H
2#define S390_CMB_H 2#define S390_CMB_H
3 3
4#include <linux/types.h> 4#include <uapi/asm/cmb.h>
5 5
6/**
7 * struct cmbdata - channel measurement block data for user space
8 * @size: size of the stored data
9 * @elapsed_time: time since last sampling
10 * @ssch_rsch_count: number of ssch and rsch
11 * @sample_count: number of samples
12 * @device_connect_time: time of device connect
13 * @function_pending_time: time of function pending
14 * @device_disconnect_time: time of device disconnect
15 * @control_unit_queuing_time: time of control unit queuing
16 * @device_active_only_time: time of device active only
17 * @device_busy_time: time of device busy (ext. format)
18 * @initial_command_response_time: initial command response time (ext. format)
19 *
20 * All values are stored as 64 bit for simplicity, especially
21 * in 32 bit emulation mode. All time values are normalized to
22 * nanoseconds.
23 * Currently, two formats are known, which differ by the size of
24 * this structure, i.e. the last two members are only set when
25 * the extended channel measurement facility (first shipped in
26 * z990 machines) is activated.
27 * Potentially, more fields could be added, which would result in a
28 * new ioctl number.
29 */
30struct cmbdata {
31 __u64 size;
32 __u64 elapsed_time;
33 /* basic and exended format: */
34 __u64 ssch_rsch_count;
35 __u64 sample_count;
36 __u64 device_connect_time;
37 __u64 function_pending_time;
38 __u64 device_disconnect_time;
39 __u64 control_unit_queuing_time;
40 __u64 device_active_only_time;
41 /* extended format only: */
42 __u64 device_busy_time;
43 __u64 initial_command_response_time;
44};
45
46/* enable channel measurement */
47#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER, 32)
48/* enable channel measurement */
49#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER, 33)
50/* read channel measurement data */
51#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER, 33, struct cmbdata)
52
53#ifdef __KERNEL__
54struct ccw_device; 6struct ccw_device;
55extern int enable_cmf(struct ccw_device *cdev); 7extern int enable_cmf(struct ccw_device *cdev);
56extern int disable_cmf(struct ccw_device *cdev); 8extern int disable_cmf(struct ccw_device *cdev);
57extern u64 cmf_read(struct ccw_device *cdev, int index); 9extern u64 cmf_read(struct ccw_device *cdev, int index);
58extern int cmf_readall(struct ccw_device *cdev, struct cmbdata *data); 10extern int cmf_readall(struct ccw_device *cdev, struct cmbdata *data);
59 11
60#endif /* __KERNEL__ */
61#endif /* S390_CMB_H */ 12#endif /* S390_CMB_H */
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 234f1d859cea..a34a9d612fc0 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -65,6 +65,7 @@ typedef s64 compat_s64;
65typedef u32 compat_uint_t; 65typedef u32 compat_uint_t;
66typedef u32 compat_ulong_t; 66typedef u32 compat_ulong_t;
67typedef u64 compat_u64; 67typedef u64 compat_u64;
68typedef u32 compat_uptr_t;
68 69
69struct compat_timespec { 70struct compat_timespec {
70 compat_time_t tv_sec; 71 compat_time_t tv_sec;
@@ -144,6 +145,79 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */
144 145
145typedef u32 compat_sigset_word; 146typedef u32 compat_sigset_word;
146 147
148typedef union compat_sigval {
149 compat_int_t sival_int;
150 compat_uptr_t sival_ptr;
151} compat_sigval_t;
152
153typedef struct compat_siginfo {
154 int si_signo;
155 int si_errno;
156 int si_code;
157
158 union {
159 int _pad[128/sizeof(int) - 3];
160
161 /* kill() */
162 struct {
163 pid_t _pid; /* sender's pid */
164 uid_t _uid; /* sender's uid */
165 } _kill;
166
167 /* POSIX.1b timers */
168 struct {
169 compat_timer_t _tid; /* timer id */
170 int _overrun; /* overrun count */
171 compat_sigval_t _sigval; /* same as below */
172 int _sys_private; /* not to be passed to user */
173 } _timer;
174
175 /* POSIX.1b signals */
176 struct {
177 pid_t _pid; /* sender's pid */
178 uid_t _uid; /* sender's uid */
179 compat_sigval_t _sigval;
180 } _rt;
181
182 /* SIGCHLD */
183 struct {
184 pid_t _pid; /* which child */
185 uid_t _uid; /* sender's uid */
186 int _status;/* exit code */
187 compat_clock_t _utime;
188 compat_clock_t _stime;
189 } _sigchld;
190
191 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
192 struct {
193 __u32 _addr; /* faulting insn/memory ref. - pointer */
194 } _sigfault;
195
196 /* SIGPOLL */
197 struct {
198 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
199 int _fd;
200 } _sigpoll;
201 } _sifields;
202} compat_siginfo_t;
203
204/*
205 * How these fields are to be accessed.
206 */
207#define si_pid _sifields._kill._pid
208#define si_uid _sifields._kill._uid
209#define si_status _sifields._sigchld._status
210#define si_utime _sifields._sigchld._utime
211#define si_stime _sifields._sigchld._stime
212#define si_value _sifields._rt._sigval
213#define si_int _sifields._rt._sigval.sival_int
214#define si_ptr _sifields._rt._sigval.sival_ptr
215#define si_addr _sifields._sigfault._addr
216#define si_band _sifields._sigpoll._band
217#define si_fd _sifields._sigpoll._fd
218#define si_tid _sifields._timer._tid
219#define si_overrun _sifields._timer._overrun
220
147#define COMPAT_OFF_T_MAX 0x7fffffff 221#define COMPAT_OFF_T_MAX 0x7fffffff
148#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 222#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
149 223
@@ -153,7 +227,6 @@ typedef u32 compat_sigset_word;
153 * as pointers because the syscall entry code will have 227 * as pointers because the syscall entry code will have
154 * appropriately converted them already. 228 * appropriately converted them already.
155 */ 229 */
156typedef u32 compat_uptr_t;
157 230
158static inline void __user *compat_ptr(compat_uptr_t uptr) 231static inline void __user *compat_ptr(compat_uptr_t uptr)
159{ 232{
diff --git a/arch/s390/include/asm/css_chars.h b/arch/s390/include/asm/css_chars.h
index a06ebc2623fb..7e1c917bbba2 100644
--- a/arch/s390/include/asm/css_chars.h
+++ b/arch/s390/include/asm/css_chars.h
@@ -3,8 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__
7
8struct css_general_char { 6struct css_general_char {
9 u64 : 12; 7 u64 : 12;
10 u32 dynio : 1; /* bit 12 */ 8 u32 dynio : 1; /* bit 12 */
@@ -35,5 +33,4 @@ struct css_general_char {
35 33
36extern struct css_general_char css_general_characteristics; 34extern struct css_general_char css_general_characteristics;
37 35
38#endif /* __KERNEL__ */
39#endif 36#endif
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
index f39677e6ccde..188c5052a20a 100644
--- a/arch/s390/include/asm/debug.h
+++ b/arch/s390/include/asm/debug.h
@@ -3,39 +3,14 @@
3 * 3 *
4 * Copyright IBM Corp. 1999, 2000 4 * Copyright IBM Corp. 1999, 2000
5 */ 5 */
6
7#ifndef DEBUG_H 6#ifndef DEBUG_H
8#define DEBUG_H 7#define DEBUG_H
9 8
10#include <linux/fs.h>
11
12/* Note:
13 * struct __debug_entry must be defined outside of #ifdef __KERNEL__
14 * in order to allow a user program to analyze the 'raw'-view.
15 */
16
17struct __debug_entry{
18 union {
19 struct {
20 unsigned long long clock:52;
21 unsigned long long exception:1;
22 unsigned long long level:3;
23 unsigned long long cpuid:8;
24 } fields;
25
26 unsigned long long stck;
27 } id;
28 void* caller;
29} __attribute__((packed));
30
31
32#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
33
34#ifdef __KERNEL__
35#include <linux/string.h> 9#include <linux/string.h>
36#include <linux/spinlock.h> 10#include <linux/spinlock.h>
37#include <linux/kernel.h> 11#include <linux/kernel.h>
38#include <linux/time.h> 12#include <linux/time.h>
13#include <uapi/asm/debug.h>
39 14
40#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ 15#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
41#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ 16#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
@@ -254,5 +229,4 @@ int debug_unregister_view(debug_info_t* id, struct debug_view* view);
254#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) 229#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
255#endif /* DASD_DEBUG */ 230#endif /* DASD_DEBUG */
256 231
257#endif /* __KERNEL__ */
258#endif /* DEBUG_H */ 232#endif /* DEBUG_H */
diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index 2d6e6e380564..593753ee07f3 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -33,6 +33,7 @@ static inline int prepare_hugepage_range(struct file *file,
33} 33}
34 34
35#define hugetlb_prefault_arch_hook(mm) do { } while (0) 35#define hugetlb_prefault_arch_hook(mm) do { } while (0)
36#define arch_clear_hugepage_flags(page) do { } while (0)
36 37
37int arch_prepare_hugepage(struct page *page); 38int arch_prepare_hugepage(struct page *page);
38void arch_release_hugepage(struct page *page); 39void arch_release_hugepage(struct page *page);
@@ -77,23 +78,6 @@ static inline void __pmd_csp(pmd_t *pmdp)
77 " csp %1,%3" 78 " csp %1,%3"
78 : "=m" (*pmdp) 79 : "=m" (*pmdp)
79 : "d" (reg2), "d" (reg3), "d" (reg4), "m" (*pmdp) : "cc"); 80 : "d" (reg2), "d" (reg3), "d" (reg4), "m" (*pmdp) : "cc");
80 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
81}
82
83static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
84{
85 unsigned long sto = (unsigned long) pmdp -
86 pmd_index(address) * sizeof(pmd_t);
87
88 if (!(pmd_val(*pmdp) & _SEGMENT_ENTRY_INV)) {
89 asm volatile(
90 " .insn rrf,0xb98e0000,%2,%3,0,0"
91 : "=m" (*pmdp)
92 : "m" (*pmdp), "a" (sto),
93 "a" ((address & HPAGE_MASK))
94 );
95 }
96 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
97} 81}
98 82
99static inline void huge_ptep_invalidate(struct mm_struct *mm, 83static inline void huge_ptep_invalidate(struct mm_struct *mm,
@@ -105,6 +89,7 @@ static inline void huge_ptep_invalidate(struct mm_struct *mm,
105 __pmd_idte(address, pmdp); 89 __pmd_idte(address, pmdp);
106 else 90 else
107 __pmd_csp(pmdp); 91 __pmd_csp(pmdp);
92 pmd_val(*pmdp) = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY;
108} 93}
109 94
110static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, 95static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
diff --git a/arch/s390/include/asm/kvm_para.h b/arch/s390/include/asm/kvm_para.h
index da44867de60f..e0f842308a68 100644
--- a/arch/s390/include/asm/kvm_para.h
+++ b/arch/s390/include/asm/kvm_para.h
@@ -9,12 +9,6 @@
9 * 9 *
10 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com> 10 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
11 */ 11 */
12
13#ifndef __S390_KVM_PARA_H
14#define __S390_KVM_PARA_H
15
16#ifdef __KERNEL__
17
18/* 12/*
19 * Hypercalls for KVM on s390. The calling convention is similar to the 13 * Hypercalls for KVM on s390. The calling convention is similar to the
20 * s390 ABI, so we use R2-R6 for parameters 1-5. In addition we use R1 14 * s390 ABI, so we use R2-R6 for parameters 1-5. In addition we use R1
@@ -29,6 +23,12 @@
29 * 23 *
30 * This work is licensed under the terms of the GNU GPL, version 2. 24 * This work is licensed under the terms of the GNU GPL, version 2.
31 */ 25 */
26#ifndef __S390_KVM_PARA_H
27#define __S390_KVM_PARA_H
28
29#include <uapi/asm/kvm_para.h>
30
31
32 32
33static inline long kvm_hypercall0(unsigned long nr) 33static inline long kvm_hypercall0(unsigned long nr)
34{ 34{
@@ -154,6 +154,4 @@ static inline bool kvm_check_and_clear_guest_paused(void)
154 return false; 154 return false;
155} 155}
156 156
157#endif
158
159#endif /* __S390_KVM_PARA_H */ 157#endif /* __S390_KVM_PARA_H */
diff --git a/arch/s390/include/asm/mman.h b/arch/s390/include/asm/mman.h
index abc1932ac4e1..0e47a576d666 100644
--- a/arch/s390/include/asm/mman.h
+++ b/arch/s390/include/asm/mman.h
@@ -3,17 +3,13 @@
3 * 3 *
4 * Derived from "include/asm-i386/mman.h" 4 * Derived from "include/asm-i386/mman.h"
5 */ 5 */
6
7#ifndef __S390_MMAN_H__ 6#ifndef __S390_MMAN_H__
8#define __S390_MMAN_H__ 7#define __S390_MMAN_H__
9 8
10#include <asm-generic/mman.h> 9#include <uapi/asm/mman.h>
11 10
12#if defined(__KERNEL__)
13#if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT) 11#if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT)
14int s390_mmap_check(unsigned long addr, unsigned long len); 12int s390_mmap_check(unsigned long addr, unsigned long len);
15#define arch_mmap_check(addr,len,flags) s390_mmap_check(addr,len) 13#define arch_mmap_check(addr,len,flags) s390_mmap_check(addr,len)
16#endif 14#endif
17#endif
18
19#endif /* __S390_MMAN_H__ */ 15#endif /* __S390_MMAN_H__ */
diff --git a/arch/s390/include/asm/module.h b/arch/s390/include/asm/module.h
index f0b6b26b6e59..df1f861a848a 100644
--- a/arch/s390/include/asm/module.h
+++ b/arch/s390/include/asm/module.h
@@ -1,5 +1,8 @@
1#ifndef _ASM_S390_MODULE_H 1#ifndef _ASM_S390_MODULE_H
2#define _ASM_S390_MODULE_H 2#define _ASM_S390_MODULE_H
3
4#include <asm-generic/module.h>
5
3/* 6/*
4 * This file contains the s390 architecture specific module code. 7 * This file contains the s390 architecture specific module code.
5 */ 8 */
@@ -28,19 +31,4 @@ struct mod_arch_specific
28 struct mod_arch_syminfo *syminfo; 31 struct mod_arch_syminfo *syminfo;
29}; 32};
30 33
31#ifdef CONFIG_64BIT
32#define ElfW(x) Elf64_ ## x
33#define ELFW(x) ELF64_ ## x
34#else
35#define ElfW(x) Elf32_ ## x
36#define ELFW(x) ELF32_ ## x
37#endif
38
39#define Elf_Addr ElfW(Addr)
40#define Elf_Rela ElfW(Rela)
41#define Elf_Shdr ElfW(Shdr)
42#define Elf_Sym ElfW(Sym)
43#define Elf_Ehdr ElfW(Ehdr)
44#define ELF_R_SYM ELFW(R_SYM)
45#define ELF_R_TYPE ELFW(R_TYPE)
46#endif /* _ASM_S390_MODULE_H */ 34#endif /* _ASM_S390_MODULE_H */
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 27ab3c7c1e8b..6d5367060a56 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -30,12 +30,20 @@
30#include <asm/setup.h> 30#include <asm/setup.h>
31#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
32 32
33static unsigned long pfmf(unsigned long function, unsigned long address)
34{
35 asm volatile(
36 " .insn rre,0xb9af0000,%[function],%[address]"
37 : [address] "+a" (address)
38 : [function] "d" (function)
39 : "memory");
40 return address;
41}
42
33static inline void clear_page(void *page) 43static inline void clear_page(void *page)
34{ 44{
35 if (MACHINE_HAS_PFMF) { 45 if (MACHINE_HAS_PFMF) {
36 asm volatile( 46 pfmf(0x10000, (unsigned long)page);
37 " .insn rre,0xb9af0000,%0,%1"
38 : : "d" (0x10000), "a" (page) : "memory", "cc");
39 } else { 47 } else {
40 register unsigned long reg1 asm ("1") = 0; 48 register unsigned long reg1 asm ("1") = 0;
41 register void *reg2 asm ("2") = page; 49 register void *reg2 asm ("2") = page;
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h
index 7941968e12b4..5f0173a31693 100644
--- a/arch/s390/include/asm/perf_event.h
+++ b/arch/s390/include/asm/perf_event.h
@@ -9,7 +9,7 @@
9#include <asm/cpu_mf.h> 9#include <asm/cpu_mf.h>
10 10
11/* CPU-measurement counter facility */ 11/* CPU-measurement counter facility */
12#define PERF_CPUM_CF_MAX_CTR 160 12#define PERF_CPUM_CF_MAX_CTR 256
13 13
14/* Per-CPU flags for PMU states */ 14/* Per-CPU flags for PMU states */
15#define PMU_F_RESERVED 0x1000 15#define PMU_F_RESERVED 0x1000
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 6bd7d7483017..dd647c919a66 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -42,6 +42,7 @@ extern void fault_init(void);
42 * tables contain all the necessary information. 42 * tables contain all the necessary information.
43 */ 43 */
44#define update_mmu_cache(vma, address, ptep) do { } while (0) 44#define update_mmu_cache(vma, address, ptep) do { } while (0)
45#define update_mmu_cache_pmd(vma, address, ptep) do { } while (0)
45 46
46/* 47/*
47 * ZERO_PAGE is a global shared page that is always zero; used 48 * ZERO_PAGE is a global shared page that is always zero; used
@@ -118,13 +119,12 @@ static inline int is_zero_pfn(unsigned long pfn)
118 119
119#ifndef __ASSEMBLY__ 120#ifndef __ASSEMBLY__
120/* 121/*
121 * The vmalloc area will always be on the topmost area of the kernel 122 * The vmalloc and module area will always be on the topmost area of the kernel
122 * mapping. We reserve 96MB (31bit) / 128GB (64bit) for vmalloc, 123 * mapping. We reserve 96MB (31bit) / 128GB (64bit) for vmalloc and modules.
123 * which should be enough for any sane case. 124 * On 64 bit kernels we have a 2GB area at the top of the vmalloc area where
124 * By putting vmalloc at the top, we maximise the gap between physical 125 * modules will reside. That makes sure that inter module branches always
125 * memory and vmalloc to catch misplaced memory accesses. As a side 126 * happen without trampolines and in addition the placement within a 2GB frame
126 * effect, this also makes sure that 64 bit module code cannot be used 127 * is branch prediction unit friendly.
127 * as system call address.
128 */ 128 */
129extern unsigned long VMALLOC_START; 129extern unsigned long VMALLOC_START;
130extern unsigned long VMALLOC_END; 130extern unsigned long VMALLOC_END;
@@ -132,6 +132,14 @@ extern struct page *vmemmap;
132 132
133#define VMEM_MAX_PHYS ((unsigned long) vmemmap) 133#define VMEM_MAX_PHYS ((unsigned long) vmemmap)
134 134
135#ifdef CONFIG_64BIT
136extern unsigned long MODULES_VADDR;
137extern unsigned long MODULES_END;
138#define MODULES_VADDR MODULES_VADDR
139#define MODULES_END MODULES_END
140#define MODULES_LEN (1UL << 31)
141#endif
142
135/* 143/*
136 * A 31 bit pagetable entry of S390 has following format: 144 * A 31 bit pagetable entry of S390 has following format:
137 * | PFRA | | OS | 145 * | PFRA | | OS |
@@ -347,6 +355,12 @@ extern struct page *vmemmap;
347 355
348#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */ 356#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */
349#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */ 357#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */
358#define _SEGMENT_ENTRY_SPLIT_BIT 0 /* THP splitting bit number */
359#define _SEGMENT_ENTRY_SPLIT (1UL << _SEGMENT_ENTRY_SPLIT_BIT)
360
361/* Set of bits not changed in pmd_modify */
362#define _SEGMENT_CHG_MASK (_SEGMENT_ENTRY_ORIGIN | _SEGMENT_ENTRY_LARGE \
363 | _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO)
350 364
351/* Page status table bits for virtualization */ 365/* Page status table bits for virtualization */
352#define RCP_ACC_BITS 0xf000000000000000UL 366#define RCP_ACC_BITS 0xf000000000000000UL
@@ -500,12 +514,45 @@ static inline int pmd_none(pmd_t pmd)
500 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL; 514 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
501} 515}
502 516
517static inline int pmd_large(pmd_t pmd)
518{
519#ifdef CONFIG_64BIT
520 return !!(pmd_val(pmd) & _SEGMENT_ENTRY_LARGE);
521#else
522 return 0;
523#endif
524}
525
503static inline int pmd_bad(pmd_t pmd) 526static inline int pmd_bad(pmd_t pmd)
504{ 527{
505 unsigned long mask = ~_SEGMENT_ENTRY_ORIGIN & ~_SEGMENT_ENTRY_INV; 528 unsigned long mask = ~_SEGMENT_ENTRY_ORIGIN & ~_SEGMENT_ENTRY_INV;
506 return (pmd_val(pmd) & mask) != _SEGMENT_ENTRY; 529 return (pmd_val(pmd) & mask) != _SEGMENT_ENTRY;
507} 530}
508 531
532#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
533extern void pmdp_splitting_flush(struct vm_area_struct *vma,
534 unsigned long addr, pmd_t *pmdp);
535
536#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS
537extern int pmdp_set_access_flags(struct vm_area_struct *vma,
538 unsigned long address, pmd_t *pmdp,
539 pmd_t entry, int dirty);
540
541#define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH
542extern int pmdp_clear_flush_young(struct vm_area_struct *vma,
543 unsigned long address, pmd_t *pmdp);
544
545#define __HAVE_ARCH_PMD_WRITE
546static inline int pmd_write(pmd_t pmd)
547{
548 return (pmd_val(pmd) & _SEGMENT_ENTRY_RO) == 0;
549}
550
551static inline int pmd_young(pmd_t pmd)
552{
553 return 0;
554}
555
509static inline int pte_none(pte_t pte) 556static inline int pte_none(pte_t pte)
510{ 557{
511 return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT); 558 return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT);
@@ -1159,6 +1206,185 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
1159#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) 1206#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
1160#define pte_unmap(pte) do { } while (0) 1207#define pte_unmap(pte) do { } while (0)
1161 1208
1209static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
1210{
1211 unsigned long sto = (unsigned long) pmdp -
1212 pmd_index(address) * sizeof(pmd_t);
1213
1214 if (!(pmd_val(*pmdp) & _SEGMENT_ENTRY_INV)) {
1215 asm volatile(
1216 " .insn rrf,0xb98e0000,%2,%3,0,0"
1217 : "=m" (*pmdp)
1218 : "m" (*pmdp), "a" (sto),
1219 "a" ((address & HPAGE_MASK))
1220 : "cc"
1221 );
1222 }
1223}
1224
1225#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1226#define __HAVE_ARCH_PGTABLE_DEPOSIT
1227extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
1228
1229#define __HAVE_ARCH_PGTABLE_WITHDRAW
1230extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
1231
1232static inline int pmd_trans_splitting(pmd_t pmd)
1233{
1234 return pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT;
1235}
1236
1237static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1238 pmd_t *pmdp, pmd_t entry)
1239{
1240 *pmdp = entry;
1241}
1242
1243static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
1244{
1245 unsigned long pgprot_pmd = 0;
1246
1247 if (pgprot_val(pgprot) & _PAGE_INVALID) {
1248 if (pgprot_val(pgprot) & _PAGE_SWT)
1249 pgprot_pmd |= _HPAGE_TYPE_NONE;
1250 pgprot_pmd |= _SEGMENT_ENTRY_INV;
1251 }
1252 if (pgprot_val(pgprot) & _PAGE_RO)
1253 pgprot_pmd |= _SEGMENT_ENTRY_RO;
1254 return pgprot_pmd;
1255}
1256
1257static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
1258{
1259 pmd_val(pmd) &= _SEGMENT_CHG_MASK;
1260 pmd_val(pmd) |= massage_pgprot_pmd(newprot);
1261 return pmd;
1262}
1263
1264static inline pmd_t pmd_mkhuge(pmd_t pmd)
1265{
1266 pmd_val(pmd) |= _SEGMENT_ENTRY_LARGE;
1267 return pmd;
1268}
1269
1270static inline pmd_t pmd_mkwrite(pmd_t pmd)
1271{
1272 pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
1273 return pmd;
1274}
1275
1276static inline pmd_t pmd_wrprotect(pmd_t pmd)
1277{
1278 pmd_val(pmd) |= _SEGMENT_ENTRY_RO;
1279 return pmd;
1280}
1281
1282static inline pmd_t pmd_mkdirty(pmd_t pmd)
1283{
1284 /* No dirty bit in the segment table entry. */
1285 return pmd;
1286}
1287
1288static inline pmd_t pmd_mkold(pmd_t pmd)
1289{
1290 /* No referenced bit in the segment table entry. */
1291 return pmd;
1292}
1293
1294static inline pmd_t pmd_mkyoung(pmd_t pmd)
1295{
1296 /* No referenced bit in the segment table entry. */
1297 return pmd;
1298}
1299
1300#define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
1301static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
1302 unsigned long address, pmd_t *pmdp)
1303{
1304 unsigned long pmd_addr = pmd_val(*pmdp) & HPAGE_MASK;
1305 long tmp, rc;
1306 int counter;
1307
1308 rc = 0;
1309 if (MACHINE_HAS_RRBM) {
1310 counter = PTRS_PER_PTE >> 6;
1311 asm volatile(
1312 "0: .insn rre,0xb9ae0000,%0,%3\n" /* rrbm */
1313 " ogr %1,%0\n"
1314 " la %3,0(%4,%3)\n"
1315 " brct %2,0b\n"
1316 : "=&d" (tmp), "+&d" (rc), "+d" (counter),
1317 "+a" (pmd_addr)
1318 : "a" (64 * 4096UL) : "cc");
1319 rc = !!rc;
1320 } else {
1321 counter = PTRS_PER_PTE;
1322 asm volatile(
1323 "0: rrbe 0,%2\n"
1324 " la %2,0(%3,%2)\n"
1325 " brc 12,1f\n"
1326 " lhi %0,1\n"
1327 "1: brct %1,0b\n"
1328 : "+d" (rc), "+d" (counter), "+a" (pmd_addr)
1329 : "a" (4096UL) : "cc");
1330 }
1331 return rc;
1332}
1333
1334#define __HAVE_ARCH_PMDP_GET_AND_CLEAR
1335static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
1336 unsigned long address, pmd_t *pmdp)
1337{
1338 pmd_t pmd = *pmdp;
1339
1340 __pmd_idte(address, pmdp);
1341 pmd_clear(pmdp);
1342 return pmd;
1343}
1344
1345#define __HAVE_ARCH_PMDP_CLEAR_FLUSH
1346static inline pmd_t pmdp_clear_flush(struct vm_area_struct *vma,
1347 unsigned long address, pmd_t *pmdp)
1348{
1349 return pmdp_get_and_clear(vma->vm_mm, address, pmdp);
1350}
1351
1352#define __HAVE_ARCH_PMDP_INVALIDATE
1353static inline void pmdp_invalidate(struct vm_area_struct *vma,
1354 unsigned long address, pmd_t *pmdp)
1355{
1356 __pmd_idte(address, pmdp);
1357}
1358
1359static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
1360{
1361 pmd_t __pmd;
1362 pmd_val(__pmd) = physpage + massage_pgprot_pmd(pgprot);
1363 return __pmd;
1364}
1365
1366#define pfn_pmd(pfn, pgprot) mk_pmd_phys(__pa((pfn) << PAGE_SHIFT), (pgprot))
1367#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
1368
1369static inline int pmd_trans_huge(pmd_t pmd)
1370{
1371 return pmd_val(pmd) & _SEGMENT_ENTRY_LARGE;
1372}
1373
1374static inline int has_transparent_hugepage(void)
1375{
1376 return MACHINE_HAS_HPAGE ? 1 : 0;
1377}
1378
1379static inline unsigned long pmd_pfn(pmd_t pmd)
1380{
1381 if (pmd_trans_huge(pmd))
1382 return pmd_val(pmd) >> HPAGE_SHIFT;
1383 else
1384 return pmd_val(pmd) >> PAGE_SHIFT;
1385}
1386#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
1387
1162/* 1388/*
1163 * 31 bit swap entry format: 1389 * 31 bit swap entry format:
1164 * A page-table entry has some bits we have to treat in a special way. 1390 * A page-table entry has some bits we have to treat in a special way.
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 56831dfa9198..94e749c90230 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -35,6 +35,7 @@ static inline void get_cpu_id(struct cpuid *ptr)
35extern void s390_adjust_jiffies(void); 35extern void s390_adjust_jiffies(void);
36extern const struct seq_operations cpuinfo_op; 36extern const struct seq_operations cpuinfo_op;
37extern int sysctl_ieee_emulation_warnings; 37extern int sysctl_ieee_emulation_warnings;
38extern void execve_tail(void);
38 39
39/* 40/*
40 * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit. 41 * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit.
@@ -126,6 +127,7 @@ struct stack_frame {
126 regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \ 127 regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \
127 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 128 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
128 regs->gprs[15] = new_stackp; \ 129 regs->gprs[15] = new_stackp; \
130 execve_tail(); \
129} while (0) 131} while (0)
130 132
131#define start_thread31(regs, new_psw, new_stackp) do { \ 133#define start_thread31(regs, new_psw, new_stackp) do { \
@@ -135,6 +137,7 @@ struct stack_frame {
135 __tlb_flush_mm(current->mm); \ 137 __tlb_flush_mm(current->mm); \
136 crst_table_downgrade(current->mm, 1UL << 31); \ 138 crst_table_downgrade(current->mm, 1UL << 31); \
137 update_mm(current->mm, current); \ 139 update_mm(current->mm, current); \
140 execve_tail(); \
138} while (0) 141} while (0)
139 142
140/* Forward declaration, a strange C thing */ 143/* Forward declaration, a strange C thing */
@@ -150,7 +153,6 @@ static inline void show_cacheinfo(struct seq_file *m) { }
150 153
151/* Free all resources held by a thread. */ 154/* Free all resources held by a thread. */
152extern void release_thread(struct task_struct *); 155extern void release_thread(struct task_struct *);
153extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
154 156
155/* 157/*
156 * Return saved PC of a blocked thread. 158 * Return saved PC of a blocked thread.
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index ce20a53afe91..3ee5da3bc10c 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -3,316 +3,17 @@
3 * Copyright IBM Corp. 1999, 2000 3 * Copyright IBM Corp. 1999, 2000
4 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 4 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
5 */ 5 */
6
7#ifndef _S390_PTRACE_H 6#ifndef _S390_PTRACE_H
8#define _S390_PTRACE_H 7#define _S390_PTRACE_H
9 8
10/* 9#include <uapi/asm/ptrace.h>
11 * Offsets in the user_regs_struct. They are used for the ptrace
12 * system call and in entry.S
13 */
14#ifndef __s390x__
15
16#define PT_PSWMASK 0x00
17#define PT_PSWADDR 0x04
18#define PT_GPR0 0x08
19#define PT_GPR1 0x0C
20#define PT_GPR2 0x10
21#define PT_GPR3 0x14
22#define PT_GPR4 0x18
23#define PT_GPR5 0x1C
24#define PT_GPR6 0x20
25#define PT_GPR7 0x24
26#define PT_GPR8 0x28
27#define PT_GPR9 0x2C
28#define PT_GPR10 0x30
29#define PT_GPR11 0x34
30#define PT_GPR12 0x38
31#define PT_GPR13 0x3C
32#define PT_GPR14 0x40
33#define PT_GPR15 0x44
34#define PT_ACR0 0x48
35#define PT_ACR1 0x4C
36#define PT_ACR2 0x50
37#define PT_ACR3 0x54
38#define PT_ACR4 0x58
39#define PT_ACR5 0x5C
40#define PT_ACR6 0x60
41#define PT_ACR7 0x64
42#define PT_ACR8 0x68
43#define PT_ACR9 0x6C
44#define PT_ACR10 0x70
45#define PT_ACR11 0x74
46#define PT_ACR12 0x78
47#define PT_ACR13 0x7C
48#define PT_ACR14 0x80
49#define PT_ACR15 0x84
50#define PT_ORIGGPR2 0x88
51#define PT_FPC 0x90
52/*
53 * A nasty fact of life that the ptrace api
54 * only supports passing of longs.
55 */
56#define PT_FPR0_HI 0x98
57#define PT_FPR0_LO 0x9C
58#define PT_FPR1_HI 0xA0
59#define PT_FPR1_LO 0xA4
60#define PT_FPR2_HI 0xA8
61#define PT_FPR2_LO 0xAC
62#define PT_FPR3_HI 0xB0
63#define PT_FPR3_LO 0xB4
64#define PT_FPR4_HI 0xB8
65#define PT_FPR4_LO 0xBC
66#define PT_FPR5_HI 0xC0
67#define PT_FPR5_LO 0xC4
68#define PT_FPR6_HI 0xC8
69#define PT_FPR6_LO 0xCC
70#define PT_FPR7_HI 0xD0
71#define PT_FPR7_LO 0xD4
72#define PT_FPR8_HI 0xD8
73#define PT_FPR8_LO 0XDC
74#define PT_FPR9_HI 0xE0
75#define PT_FPR9_LO 0xE4
76#define PT_FPR10_HI 0xE8
77#define PT_FPR10_LO 0xEC
78#define PT_FPR11_HI 0xF0
79#define PT_FPR11_LO 0xF4
80#define PT_FPR12_HI 0xF8
81#define PT_FPR12_LO 0xFC
82#define PT_FPR13_HI 0x100
83#define PT_FPR13_LO 0x104
84#define PT_FPR14_HI 0x108
85#define PT_FPR14_LO 0x10C
86#define PT_FPR15_HI 0x110
87#define PT_FPR15_LO 0x114
88#define PT_CR_9 0x118
89#define PT_CR_10 0x11C
90#define PT_CR_11 0x120
91#define PT_IEEE_IP 0x13C
92#define PT_LASTOFF PT_IEEE_IP
93#define PT_ENDREGS 0x140-1
94
95#define GPR_SIZE 4
96#define CR_SIZE 4
97
98#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */
99
100#else /* __s390x__ */
101
102#define PT_PSWMASK 0x00
103#define PT_PSWADDR 0x08
104#define PT_GPR0 0x10
105#define PT_GPR1 0x18
106#define PT_GPR2 0x20
107#define PT_GPR3 0x28
108#define PT_GPR4 0x30
109#define PT_GPR5 0x38
110#define PT_GPR6 0x40
111#define PT_GPR7 0x48
112#define PT_GPR8 0x50
113#define PT_GPR9 0x58
114#define PT_GPR10 0x60
115#define PT_GPR11 0x68
116#define PT_GPR12 0x70
117#define PT_GPR13 0x78
118#define PT_GPR14 0x80
119#define PT_GPR15 0x88
120#define PT_ACR0 0x90
121#define PT_ACR1 0x94
122#define PT_ACR2 0x98
123#define PT_ACR3 0x9C
124#define PT_ACR4 0xA0
125#define PT_ACR5 0xA4
126#define PT_ACR6 0xA8
127#define PT_ACR7 0xAC
128#define PT_ACR8 0xB0
129#define PT_ACR9 0xB4
130#define PT_ACR10 0xB8
131#define PT_ACR11 0xBC
132#define PT_ACR12 0xC0
133#define PT_ACR13 0xC4
134#define PT_ACR14 0xC8
135#define PT_ACR15 0xCC
136#define PT_ORIGGPR2 0xD0
137#define PT_FPC 0xD8
138#define PT_FPR0 0xE0
139#define PT_FPR1 0xE8
140#define PT_FPR2 0xF0
141#define PT_FPR3 0xF8
142#define PT_FPR4 0x100
143#define PT_FPR5 0x108
144#define PT_FPR6 0x110
145#define PT_FPR7 0x118
146#define PT_FPR8 0x120
147#define PT_FPR9 0x128
148#define PT_FPR10 0x130
149#define PT_FPR11 0x138
150#define PT_FPR12 0x140
151#define PT_FPR13 0x148
152#define PT_FPR14 0x150
153#define PT_FPR15 0x158
154#define PT_CR_9 0x160
155#define PT_CR_10 0x168
156#define PT_CR_11 0x170
157#define PT_IEEE_IP 0x1A8
158#define PT_LASTOFF PT_IEEE_IP
159#define PT_ENDREGS 0x1B0-1
160
161#define GPR_SIZE 8
162#define CR_SIZE 8
163
164#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
165
166#endif /* __s390x__ */
167
168#define NUM_GPRS 16
169#define NUM_FPRS 16
170#define NUM_CRS 16
171#define NUM_ACRS 16
172
173#define NUM_CR_WORDS 3
174
175#define FPR_SIZE 8
176#define FPC_SIZE 4
177#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
178#define ACR_SIZE 4
179
180
181#define PTRACE_OLDSETOPTIONS 21
182 10
183#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
184#include <linux/stddef.h>
185#include <linux/types.h>
186
187typedef union
188{
189 float f;
190 double d;
191 __u64 ui;
192 struct
193 {
194 __u32 hi;
195 __u32 lo;
196 } fp;
197} freg_t;
198
199typedef struct
200{
201 __u32 fpc;
202 freg_t fprs[NUM_FPRS];
203} s390_fp_regs;
204
205#define FPC_EXCEPTION_MASK 0xF8000000
206#define FPC_FLAGS_MASK 0x00F80000
207#define FPC_DXC_MASK 0x0000FF00
208#define FPC_RM_MASK 0x00000003
209#define FPC_VALID_MASK 0xF8F8FF03
210
211/* this typedef defines how a Program Status Word looks like */
212typedef struct
213{
214 unsigned long mask;
215 unsigned long addr;
216} __attribute__ ((aligned(8))) psw_t;
217
218typedef struct
219{
220 __u32 mask;
221 __u32 addr;
222} __attribute__ ((aligned(8))) psw_compat_t;
223
224#ifndef __s390x__ 12#ifndef __s390x__
225
226#define PSW_MASK_PER 0x40000000UL
227#define PSW_MASK_DAT 0x04000000UL
228#define PSW_MASK_IO 0x02000000UL
229#define PSW_MASK_EXT 0x01000000UL
230#define PSW_MASK_KEY 0x00F00000UL
231#define PSW_MASK_BASE 0x00080000UL /* always one */
232#define PSW_MASK_MCHECK 0x00040000UL
233#define PSW_MASK_WAIT 0x00020000UL
234#define PSW_MASK_PSTATE 0x00010000UL
235#define PSW_MASK_ASC 0x0000C000UL
236#define PSW_MASK_CC 0x00003000UL
237#define PSW_MASK_PM 0x00000F00UL
238#define PSW_MASK_RI 0x00000000UL
239#define PSW_MASK_EA 0x00000000UL
240#define PSW_MASK_BA 0x00000000UL
241
242#define PSW_MASK_USER 0x00003F00UL
243
244#define PSW_ADDR_AMODE 0x80000000UL
245#define PSW_ADDR_INSN 0x7FFFFFFFUL
246
247#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
248
249#define PSW_ASC_PRIMARY 0x00000000UL
250#define PSW_ASC_ACCREG 0x00004000UL
251#define PSW_ASC_SECONDARY 0x00008000UL
252#define PSW_ASC_HOME 0x0000C000UL
253
254#else /* __s390x__ */ 13#else /* __s390x__ */
255
256#define PSW_MASK_PER 0x4000000000000000UL
257#define PSW_MASK_DAT 0x0400000000000000UL
258#define PSW_MASK_IO 0x0200000000000000UL
259#define PSW_MASK_EXT 0x0100000000000000UL
260#define PSW_MASK_BASE 0x0000000000000000UL
261#define PSW_MASK_KEY 0x00F0000000000000UL
262#define PSW_MASK_MCHECK 0x0004000000000000UL
263#define PSW_MASK_WAIT 0x0002000000000000UL
264#define PSW_MASK_PSTATE 0x0001000000000000UL
265#define PSW_MASK_ASC 0x0000C00000000000UL
266#define PSW_MASK_CC 0x0000300000000000UL
267#define PSW_MASK_PM 0x00000F0000000000UL
268#define PSW_MASK_RI 0x0000008000000000UL
269#define PSW_MASK_EA 0x0000000100000000UL
270#define PSW_MASK_BA 0x0000000080000000UL
271
272#define PSW_MASK_USER 0x00003F8180000000UL
273
274#define PSW_ADDR_AMODE 0x0000000000000000UL
275#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
276
277#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
278
279#define PSW_ASC_PRIMARY 0x0000000000000000UL
280#define PSW_ASC_ACCREG 0x0000400000000000UL
281#define PSW_ASC_SECONDARY 0x0000800000000000UL
282#define PSW_ASC_HOME 0x0000C00000000000UL
283
284#endif /* __s390x__ */ 14#endif /* __s390x__ */
285
286#ifdef __KERNEL__
287extern long psw_kernel_bits; 15extern long psw_kernel_bits;
288extern long psw_user_bits; 16extern long psw_user_bits;
289#endif
290
291/*
292 * The s390_regs structure is used to define the elf_gregset_t.
293 */
294typedef struct
295{
296 psw_t psw;
297 unsigned long gprs[NUM_GPRS];
298 unsigned int acrs[NUM_ACRS];
299 unsigned long orig_gpr2;
300} s390_regs;
301
302typedef struct
303{
304 psw_compat_t psw;
305 __u32 gprs[NUM_GPRS];
306 __u32 acrs[NUM_ACRS];
307 __u32 orig_gpr2;
308} s390_compat_regs;
309
310typedef struct
311{
312 __u32 gprs_high[NUM_GPRS];
313} s390_compat_regs_high;
314
315#ifdef __KERNEL__
316 17
317/* 18/*
318 * The pt_regs struct defines the way the registers are stored on 19 * The pt_regs struct defines the way the registers are stored on
@@ -376,167 +77,8 @@ struct per_struct_kernel {
376#define PER_CONTROL_SUSPENSION 0x00400000UL 77#define PER_CONTROL_SUSPENSION 0x00400000UL
377#define PER_CONTROL_ALTERATION 0x00200000UL 78#define PER_CONTROL_ALTERATION 0x00200000UL
378 79
379#endif
380
381/*
382 * Now for the user space program event recording (trace) definitions.
383 * The following structures are used only for the ptrace interface, don't
384 * touch or even look at it if you don't want to modify the user-space
385 * ptrace interface. In particular stay away from it for in-kernel PER.
386 */
387typedef struct
388{
389 unsigned long cr[NUM_CR_WORDS];
390} per_cr_words;
391
392#define PER_EM_MASK 0xE8000000UL
393
394typedef struct
395{
396#ifdef __s390x__ 80#ifdef __s390x__
397 unsigned : 32;
398#endif /* __s390x__ */ 81#endif /* __s390x__ */
399 unsigned em_branching : 1;
400 unsigned em_instruction_fetch : 1;
401 /*
402 * Switching on storage alteration automatically fixes
403 * the storage alteration event bit in the users std.
404 */
405 unsigned em_storage_alteration : 1;
406 unsigned em_gpr_alt_unused : 1;
407 unsigned em_store_real_address : 1;
408 unsigned : 3;
409 unsigned branch_addr_ctl : 1;
410 unsigned : 1;
411 unsigned storage_alt_space_ctl : 1;
412 unsigned : 21;
413 unsigned long starting_addr;
414 unsigned long ending_addr;
415} per_cr_bits;
416
417typedef struct
418{
419 unsigned short perc_atmid;
420 unsigned long address;
421 unsigned char access_id;
422} per_lowcore_words;
423
424typedef struct
425{
426 unsigned perc_branching : 1;
427 unsigned perc_instruction_fetch : 1;
428 unsigned perc_storage_alteration : 1;
429 unsigned perc_gpr_alt_unused : 1;
430 unsigned perc_store_real_address : 1;
431 unsigned : 3;
432 unsigned atmid_psw_bit_31 : 1;
433 unsigned atmid_validity_bit : 1;
434 unsigned atmid_psw_bit_32 : 1;
435 unsigned atmid_psw_bit_5 : 1;
436 unsigned atmid_psw_bit_16 : 1;
437 unsigned atmid_psw_bit_17 : 1;
438 unsigned si : 2;
439 unsigned long address;
440 unsigned : 4;
441 unsigned access_id : 4;
442} per_lowcore_bits;
443
444typedef struct
445{
446 union {
447 per_cr_words words;
448 per_cr_bits bits;
449 } control_regs;
450 /*
451 * Use these flags instead of setting em_instruction_fetch
452 * directly they are used so that single stepping can be
453 * switched on & off while not affecting other tracing
454 */
455 unsigned single_step : 1;
456 unsigned instruction_fetch : 1;
457 unsigned : 30;
458 /*
459 * These addresses are copied into cr10 & cr11 if single
460 * stepping is switched off
461 */
462 unsigned long starting_addr;
463 unsigned long ending_addr;
464 union {
465 per_lowcore_words words;
466 per_lowcore_bits bits;
467 } lowcore;
468} per_struct;
469
470typedef struct
471{
472 unsigned int len;
473 unsigned long kernel_addr;
474 unsigned long process_addr;
475} ptrace_area;
476
477/*
478 * S/390 specific non posix ptrace requests. I chose unusual values so
479 * they are unlikely to clash with future ptrace definitions.
480 */
481#define PTRACE_PEEKUSR_AREA 0x5000
482#define PTRACE_POKEUSR_AREA 0x5001
483#define PTRACE_PEEKTEXT_AREA 0x5002
484#define PTRACE_PEEKDATA_AREA 0x5003
485#define PTRACE_POKETEXT_AREA 0x5004
486#define PTRACE_POKEDATA_AREA 0x5005
487#define PTRACE_GET_LAST_BREAK 0x5006
488#define PTRACE_PEEK_SYSTEM_CALL 0x5007
489#define PTRACE_POKE_SYSTEM_CALL 0x5008
490#define PTRACE_ENABLE_TE 0x5009
491#define PTRACE_DISABLE_TE 0x5010
492
493/*
494 * PT_PROT definition is loosely based on hppa bsd definition in
495 * gdb/hppab-nat.c
496 */
497#define PTRACE_PROT 21
498
499typedef enum
500{
501 ptprot_set_access_watchpoint,
502 ptprot_set_write_watchpoint,
503 ptprot_disable_watchpoint
504} ptprot_flags;
505
506typedef struct
507{
508 unsigned long lowaddr;
509 unsigned long hiaddr;
510 ptprot_flags prot;
511} ptprot_area;
512
513/* Sequence of bytes for breakpoint illegal instruction. */
514#define S390_BREAKPOINT {0x0,0x1}
515#define S390_BREAKPOINT_U16 ((__u16)0x0001)
516#define S390_SYSCALL_OPCODE ((__u16)0x0a00)
517#define S390_SYSCALL_SIZE 2
518
519/*
520 * The user_regs_struct defines the way the user registers are
521 * store on the stack for signal handling.
522 */
523struct user_regs_struct
524{
525 psw_t psw;
526 unsigned long gprs[NUM_GPRS];
527 unsigned int acrs[NUM_ACRS];
528 unsigned long orig_gpr2;
529 s390_fp_regs fp_regs;
530 /*
531 * These per registers are in here so that gdb can modify them
532 * itself as there is no "official" ptrace interface for hardware
533 * watchpoints. This is the way intel does it.
534 */
535 per_struct per_info;
536 unsigned long ieee_instruction_pointer; /* obsolete, always 0 */
537};
538
539#ifdef __KERNEL__
540/* 82/*
541 * These are defined as per linux/ptrace.h, which see. 83 * These are defined as per linux/ptrace.h, which see.
542 */ 84 */
@@ -562,7 +104,5 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
562 return regs->gprs[15] & PSW_ADDR_INSN; 104 return regs->gprs[15] & PSW_ADDR_INSN;
563} 105}
564 106
565#endif /* __KERNEL__ */
566#endif /* __ASSEMBLY__ */ 107#endif /* __ASSEMBLY__ */
567
568#endif /* _S390_PTRACE_H */ 108#endif /* _S390_PTRACE_H */
diff --git a/arch/s390/include/asm/schid.h b/arch/s390/include/asm/schid.h
index 3e4d401b4e45..40b47dfa9d66 100644
--- a/arch/s390/include/asm/schid.h
+++ b/arch/s390/include/asm/schid.h
@@ -1,19 +1,8 @@
1#ifndef ASM_SCHID_H 1#ifndef ASM_SCHID_H
2#define ASM_SCHID_H 2#define ASM_SCHID_H
3 3
4#include <linux/types.h>
5
6struct subchannel_id {
7 __u32 cssid : 8;
8 __u32 : 4;
9 __u32 m : 1;
10 __u32 ssid : 2;
11 __u32 one : 1;
12 __u32 sch_no : 16;
13} __attribute__ ((packed, aligned(4)));
14
15#ifdef __KERNEL__
16#include <linux/string.h> 4#include <linux/string.h>
5#include <uapi/asm/schid.h>
17 6
18/* Helper function for sane state of pre-allocated subchannel_id. */ 7/* Helper function for sane state of pre-allocated subchannel_id. */
19static inline void 8static inline void
@@ -29,6 +18,4 @@ schid_equal(struct subchannel_id *schid1, struct subchannel_id *schid2)
29 return !memcmp(schid1, schid2, sizeof(struct subchannel_id)); 18 return !memcmp(schid1, schid2, sizeof(struct subchannel_id));
30} 19}
31 20
32#endif /* __KERNEL__ */
33
34#endif /* ASM_SCHID_H */ 21#endif /* ASM_SCHID_H */
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index 87b47ca954f1..f69f76b3447a 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -2,15 +2,11 @@
2 * S390 version 2 * S390 version
3 * Copyright IBM Corp. 1999, 2010 3 * Copyright IBM Corp. 1999, 2010
4 */ 4 */
5
6#ifndef _ASM_S390_SETUP_H 5#ifndef _ASM_S390_SETUP_H
7#define _ASM_S390_SETUP_H 6#define _ASM_S390_SETUP_H
8 7
9#define COMMAND_LINE_SIZE 4096 8#include <uapi/asm/setup.h>
10
11#define ARCH_COMMAND_LINE_SIZE 896
12 9
13#ifdef __KERNEL__
14 10
15#define PARMAREA 0x10400 11#define PARMAREA 0x10400
16#define MEMORY_CHUNKS 256 12#define MEMORY_CHUNKS 256
@@ -75,18 +71,21 @@ extern unsigned int s390_user_mode;
75#define MACHINE_FLAG_DIAG9C (1UL << 7) 71#define MACHINE_FLAG_DIAG9C (1UL << 7)
76#define MACHINE_FLAG_MVCOS (1UL << 8) 72#define MACHINE_FLAG_MVCOS (1UL << 8)
77#define MACHINE_FLAG_KVM (1UL << 9) 73#define MACHINE_FLAG_KVM (1UL << 9)
78#define MACHINE_FLAG_HPAGE (1UL << 10) 74#define MACHINE_FLAG_EDAT1 (1UL << 10)
79#define MACHINE_FLAG_PFMF (1UL << 11) 75#define MACHINE_FLAG_EDAT2 (1UL << 11)
80#define MACHINE_FLAG_LPAR (1UL << 12) 76#define MACHINE_FLAG_LPAR (1UL << 12)
81#define MACHINE_FLAG_SPP (1UL << 13) 77#define MACHINE_FLAG_SPP (1UL << 13)
82#define MACHINE_FLAG_TOPOLOGY (1UL << 14) 78#define MACHINE_FLAG_TOPOLOGY (1UL << 14)
83#define MACHINE_FLAG_TE (1UL << 15) 79#define MACHINE_FLAG_TE (1UL << 15)
80#define MACHINE_FLAG_RRBM (1UL << 16)
84 81
85#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 82#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
86#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 83#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
87#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) 84#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
88 85
89#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) 86#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
87#define MACHINE_HAS_PFMF MACHINE_HAS_EDAT1
88#define MACHINE_HAS_HPAGE MACHINE_HAS_EDAT1
90 89
91#ifndef CONFIG_64BIT 90#ifndef CONFIG_64BIT
92#define MACHINE_HAS_IEEE (S390_lowcore.machine_flags & MACHINE_FLAG_IEEE) 91#define MACHINE_HAS_IEEE (S390_lowcore.machine_flags & MACHINE_FLAG_IEEE)
@@ -95,11 +94,12 @@ extern unsigned int s390_user_mode;
95#define MACHINE_HAS_DIAG44 (1) 94#define MACHINE_HAS_DIAG44 (1)
96#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG) 95#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG)
97#define MACHINE_HAS_MVCOS (0) 96#define MACHINE_HAS_MVCOS (0)
98#define MACHINE_HAS_HPAGE (0) 97#define MACHINE_HAS_EDAT1 (0)
99#define MACHINE_HAS_PFMF (0) 98#define MACHINE_HAS_EDAT2 (0)
100#define MACHINE_HAS_SPP (0) 99#define MACHINE_HAS_SPP (0)
101#define MACHINE_HAS_TOPOLOGY (0) 100#define MACHINE_HAS_TOPOLOGY (0)
102#define MACHINE_HAS_TE (0) 101#define MACHINE_HAS_TE (0)
102#define MACHINE_HAS_RRBM (0)
103#else /* CONFIG_64BIT */ 103#else /* CONFIG_64BIT */
104#define MACHINE_HAS_IEEE (1) 104#define MACHINE_HAS_IEEE (1)
105#define MACHINE_HAS_CSP (1) 105#define MACHINE_HAS_CSP (1)
@@ -107,11 +107,12 @@ extern unsigned int s390_user_mode;
107#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44) 107#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
108#define MACHINE_HAS_MVPG (1) 108#define MACHINE_HAS_MVPG (1)
109#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS) 109#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
110#define MACHINE_HAS_HPAGE (S390_lowcore.machine_flags & MACHINE_FLAG_HPAGE) 110#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
111#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) 111#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2)
112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
114#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE) 114#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE)
115#define MACHINE_HAS_RRBM (S390_lowcore.machine_flags & MACHINE_FLAG_RRBM)
115#endif /* CONFIG_64BIT */ 116#endif /* CONFIG_64BIT */
116 117
117#define ZFCPDUMP_HSA_SIZE (32UL<<20) 118#define ZFCPDUMP_HSA_SIZE (32UL<<20)
@@ -170,5 +171,4 @@ extern void (*_machine_power_off)(void);
170#define COMMAND_LINE 0x10480 171#define COMMAND_LINE 0x10480
171 172
172#endif /* __ASSEMBLY__ */ 173#endif /* __ASSEMBLY__ */
173#endif /* __KERNEL__ */
174#endif /* _ASM_S390_SETUP_H */ 174#endif /* _ASM_S390_SETUP_H */
diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h
index 6d4d9d1faee9..bffdbdd5b3d7 100644
--- a/arch/s390/include/asm/signal.h
+++ b/arch/s390/include/asm/signal.h
@@ -3,18 +3,11 @@
3 * 3 *
4 * Derived from "include/asm-i386/signal.h" 4 * Derived from "include/asm-i386/signal.h"
5 */ 5 */
6
7#ifndef _ASMS390_SIGNAL_H 6#ifndef _ASMS390_SIGNAL_H
8#define _ASMS390_SIGNAL_H 7#define _ASMS390_SIGNAL_H
9 8
10#include <linux/types.h> 9#include <uapi/asm/signal.h>
11#include <linux/time.h>
12
13/* Avoid too many header ordering problems. */
14struct siginfo;
15struct pt_regs;
16 10
17#ifdef __KERNEL__
18/* Most things should be clean enough to redefine this at will, if care 11/* Most things should be clean enough to redefine this at will, if care
19 is taken to make libc match. */ 12 is taken to make libc match. */
20#include <asm/sigcontext.h> 13#include <asm/sigcontext.h>
@@ -28,94 +21,6 @@ typedef struct {
28 unsigned long sig[_NSIG_WORDS]; 21 unsigned long sig[_NSIG_WORDS];
29} sigset_t; 22} sigset_t;
30 23
31#else
32/* Here we must cater to libcs that poke about in kernel headers. */
33
34#define NSIG 32
35typedef unsigned long sigset_t;
36
37#endif /* __KERNEL__ */
38
39#define SIGHUP 1
40#define SIGINT 2
41#define SIGQUIT 3
42#define SIGILL 4
43#define SIGTRAP 5
44#define SIGABRT 6
45#define SIGIOT 6
46#define SIGBUS 7
47#define SIGFPE 8
48#define SIGKILL 9
49#define SIGUSR1 10
50#define SIGSEGV 11
51#define SIGUSR2 12
52#define SIGPIPE 13
53#define SIGALRM 14
54#define SIGTERM 15
55#define SIGSTKFLT 16
56#define SIGCHLD 17
57#define SIGCONT 18
58#define SIGSTOP 19
59#define SIGTSTP 20
60#define SIGTTIN 21
61#define SIGTTOU 22
62#define SIGURG 23
63#define SIGXCPU 24
64#define SIGXFSZ 25
65#define SIGVTALRM 26
66#define SIGPROF 27
67#define SIGWINCH 28
68#define SIGIO 29
69#define SIGPOLL SIGIO
70/*
71#define SIGLOST 29
72*/
73#define SIGPWR 30
74#define SIGSYS 31
75#define SIGUNUSED 31
76
77/* These should not be considered constants from userland. */
78#define SIGRTMIN 32
79#define SIGRTMAX _NSIG
80
81/*
82 * SA_FLAGS values:
83 *
84 * SA_ONSTACK indicates that a registered stack_t will be used.
85 * SA_RESTART flag to get restarting signals (which were the default long ago)
86 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
87 * SA_RESETHAND clears the handler when the signal is delivered.
88 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
89 * SA_NODEFER prevents the current signal from being masked in the handler.
90 *
91 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
92 * Unix names RESETHAND and NODEFER respectively.
93 */
94#define SA_NOCLDSTOP 0x00000001
95#define SA_NOCLDWAIT 0x00000002
96#define SA_SIGINFO 0x00000004
97#define SA_ONSTACK 0x08000000
98#define SA_RESTART 0x10000000
99#define SA_NODEFER 0x40000000
100#define SA_RESETHAND 0x80000000
101
102#define SA_NOMASK SA_NODEFER
103#define SA_ONESHOT SA_RESETHAND
104
105#define SA_RESTORER 0x04000000
106
107/*
108 * sigaltstack controls
109 */
110#define SS_ONSTACK 1
111#define SS_DISABLE 2
112
113#define MINSIGSTKSZ 2048
114#define SIGSTKSZ 8192
115
116#include <asm-generic/signal-defs.h>
117
118#ifdef __KERNEL__
119struct old_sigaction { 24struct old_sigaction {
120 __sighandler_t sa_handler; 25 __sighandler_t sa_handler;
121 old_sigset_t sa_mask; 26 old_sigset_t sa_mask;
@@ -136,35 +41,4 @@ struct k_sigaction {
136 41
137#define ptrace_signal_deliver(regs, cookie) do { } while (0) 42#define ptrace_signal_deliver(regs, cookie) do { } while (0)
138 43
139#else
140/* Here we must cater to libcs that poke about in kernel headers. */
141
142struct sigaction {
143 union {
144 __sighandler_t _sa_handler;
145 void (*_sa_sigaction)(int, struct siginfo *, void *);
146 } _u;
147#ifndef __s390x__ /* lovely */
148 sigset_t sa_mask;
149 unsigned long sa_flags;
150 void (*sa_restorer)(void);
151#else /* __s390x__ */
152 unsigned long sa_flags;
153 void (*sa_restorer)(void);
154 sigset_t sa_mask;
155#endif /* __s390x__ */
156};
157
158#define sa_handler _u._sa_handler
159#define sa_sigaction _u._sa_sigaction
160
161#endif /* __KERNEL__ */
162
163typedef struct sigaltstack {
164 void __user *ss_sp;
165 int ss_flags;
166 size_t ss_size;
167} stack_t;
168
169
170#endif 44#endif
diff --git a/arch/s390/include/asm/termios.h b/arch/s390/include/asm/termios.h
index cb9fe2786b81..db028d17f061 100644
--- a/arch/s390/include/asm/termios.h
+++ b/arch/s390/include/asm/termios.h
@@ -3,49 +3,11 @@
3 * 3 *
4 * Derived from "include/asm-i386/termios.h" 4 * Derived from "include/asm-i386/termios.h"
5 */ 5 */
6
7#ifndef _S390_TERMIOS_H 6#ifndef _S390_TERMIOS_H
8#define _S390_TERMIOS_H 7#define _S390_TERMIOS_H
9 8
10#include <asm/termbits.h> 9#include <uapi/asm/termios.h>
11#include <asm/ioctls.h>
12
13struct winsize {
14 unsigned short ws_row;
15 unsigned short ws_col;
16 unsigned short ws_xpixel;
17 unsigned short ws_ypixel;
18};
19
20#define NCC 8
21struct termio {
22 unsigned short c_iflag; /* input mode flags */
23 unsigned short c_oflag; /* output mode flags */
24 unsigned short c_cflag; /* control mode flags */
25 unsigned short c_lflag; /* local mode flags */
26 unsigned char c_line; /* line discipline */
27 unsigned char c_cc[NCC]; /* control characters */
28};
29 10
30/* modem lines */
31#define TIOCM_LE 0x001
32#define TIOCM_DTR 0x002
33#define TIOCM_RTS 0x004
34#define TIOCM_ST 0x008
35#define TIOCM_SR 0x010
36#define TIOCM_CTS 0x020
37#define TIOCM_CAR 0x040
38#define TIOCM_RNG 0x080
39#define TIOCM_DSR 0x100
40#define TIOCM_CD TIOCM_CAR
41#define TIOCM_RI TIOCM_RNG
42#define TIOCM_OUT1 0x2000
43#define TIOCM_OUT2 0x4000
44#define TIOCM_LOOP 0x8000
45
46/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
47
48#ifdef __KERNEL__
49 11
50/* intr=^C quit=^\ erase=del kill=^U 12/* intr=^C quit=^\ erase=del kill=^U
51 eof=^D vtime=\0 vmin=\1 sxtc=\0 13 eof=^D vtime=\0 vmin=\1 sxtc=\0
@@ -60,6 +22,4 @@ struct termio {
60 22
61#include <asm-generic/termios-base.h> 23#include <asm-generic/termios-base.h>
62 24
63#endif /* __KERNEL__ */
64
65#endif /* _S390_TERMIOS_H */ 25#endif /* _S390_TERMIOS_H */
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index bb08e2afc5de..9e2cfe0349c3 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -91,8 +91,6 @@ static inline struct thread_info *current_thread_info(void)
91#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 91#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
92#define TIF_SECCOMP 10 /* secure computing */ 92#define TIF_SECCOMP 10 /* secure computing */
93#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 93#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
94#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
95 TIF_NEED_RESCHED */
96#define TIF_31BIT 17 /* 32bit process */ 94#define TIF_31BIT 17 /* 32bit process */
97#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 95#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
98#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ 96#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
@@ -100,7 +98,6 @@ static inline struct thread_info *current_thread_info(void)
100 98
101#define _TIF_SYSCALL (1<<TIF_SYSCALL) 99#define _TIF_SYSCALL (1<<TIF_SYSCALL)
102#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 100#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
103#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
104#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 101#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
105#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 102#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
106#define _TIF_PER_TRAP (1<<TIF_PER_TRAP) 103#define _TIF_PER_TRAP (1<<TIF_PER_TRAP)
@@ -109,7 +106,6 @@ static inline struct thread_info *current_thread_info(void)
109#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 106#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
110#define _TIF_SECCOMP (1<<TIF_SECCOMP) 107#define _TIF_SECCOMP (1<<TIF_SECCOMP)
111#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 108#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
112#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
113#define _TIF_31BIT (1<<TIF_31BIT) 109#define _TIF_31BIT (1<<TIF_31BIT)
114#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) 110#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP)
115 111
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index 06e5acbc84bd..b75d7d686684 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -137,6 +137,7 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
137#define tlb_start_vma(tlb, vma) do { } while (0) 137#define tlb_start_vma(tlb, vma) do { } while (0)
138#define tlb_end_vma(tlb, vma) do { } while (0) 138#define tlb_end_vma(tlb, vma) do { } while (0)
139#define tlb_remove_tlb_entry(tlb, ptep, addr) do { } while (0) 139#define tlb_remove_tlb_entry(tlb, ptep, addr) do { } while (0)
140#define tlb_remove_pmd_tlb_entry(tlb, pmdp, addr) do { } while (0)
140#define tlb_migrate_finish(mm) do { } while (0) 141#define tlb_migrate_finish(mm) do { } while (0)
141 142
142#endif /* _S390_TLB_H */ 143#endif /* _S390_TLB_H */
diff --git a/arch/s390/include/asm/types.h b/arch/s390/include/asm/types.h
index 6ba7c2c7217a..dccef3ca91fa 100644
--- a/arch/s390/include/asm/types.h
+++ b/arch/s390/include/asm/types.h
@@ -3,26 +3,14 @@
3 * 3 *
4 * Derived from "include/asm-i386/types.h" 4 * Derived from "include/asm-i386/types.h"
5 */ 5 */
6
7#ifndef _S390_TYPES_H 6#ifndef _S390_TYPES_H
8#define _S390_TYPES_H 7#define _S390_TYPES_H
9 8
10#include <asm-generic/int-ll64.h> 9#include <uapi/asm/types.h>
11
12#ifndef __ASSEMBLY__
13
14/* A address type so that arithmetic can be done on it & it can be upgraded to
15 64 bit when necessary
16*/
17typedef unsigned long addr_t;
18typedef __signed__ long saddr_t;
19
20#endif /* __ASSEMBLY__ */
21 10
22/* 11/*
23 * These aren't exported outside the kernel to avoid name space clashes 12 * These aren't exported outside the kernel to avoid name space clashes
24 */ 13 */
25#ifdef __KERNEL__
26 14
27#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
28 16
@@ -37,5 +25,4 @@ typedef union {
37 25
38#endif /* ! CONFIG_64BIT */ 26#endif /* ! CONFIG_64BIT */
39#endif /* __ASSEMBLY__ */ 27#endif /* __ASSEMBLY__ */
40#endif /* __KERNEL__ */
41#endif /* _S390_TYPES_H */ 28#endif /* _S390_TYPES_H */
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 4e64b5cd1558..bbbae41fa9a5 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -3,375 +3,11 @@
3 * 3 *
4 * Derived from "include/asm-i386/unistd.h" 4 * Derived from "include/asm-i386/unistd.h"
5 */ 5 */
6
7#ifndef _ASM_S390_UNISTD_H_ 6#ifndef _ASM_S390_UNISTD_H_
8#define _ASM_S390_UNISTD_H_ 7#define _ASM_S390_UNISTD_H_
9 8
10/* 9#include <uapi/asm/unistd.h>
11 * This file contains the system call numbers.
12 */
13
14#define __NR_exit 1
15#define __NR_fork 2
16#define __NR_read 3
17#define __NR_write 4
18#define __NR_open 5
19#define __NR_close 6
20#define __NR_restart_syscall 7
21#define __NR_creat 8
22#define __NR_link 9
23#define __NR_unlink 10
24#define __NR_execve 11
25#define __NR_chdir 12
26#define __NR_mknod 14
27#define __NR_chmod 15
28#define __NR_lseek 19
29#define __NR_getpid 20
30#define __NR_mount 21
31#define __NR_umount 22
32#define __NR_ptrace 26
33#define __NR_alarm 27
34#define __NR_pause 29
35#define __NR_utime 30
36#define __NR_access 33
37#define __NR_nice 34
38#define __NR_sync 36
39#define __NR_kill 37
40#define __NR_rename 38
41#define __NR_mkdir 39
42#define __NR_rmdir 40
43#define __NR_dup 41
44#define __NR_pipe 42
45#define __NR_times 43
46#define __NR_brk 45
47#define __NR_signal 48
48#define __NR_acct 51
49#define __NR_umount2 52
50#define __NR_ioctl 54
51#define __NR_fcntl 55
52#define __NR_setpgid 57
53#define __NR_umask 60
54#define __NR_chroot 61
55#define __NR_ustat 62
56#define __NR_dup2 63
57#define __NR_getppid 64
58#define __NR_getpgrp 65
59#define __NR_setsid 66
60#define __NR_sigaction 67
61#define __NR_sigsuspend 72
62#define __NR_sigpending 73
63#define __NR_sethostname 74
64#define __NR_setrlimit 75
65#define __NR_getrusage 77
66#define __NR_gettimeofday 78
67#define __NR_settimeofday 79
68#define __NR_symlink 83
69#define __NR_readlink 85
70#define __NR_uselib 86
71#define __NR_swapon 87
72#define __NR_reboot 88
73#define __NR_readdir 89
74#define __NR_mmap 90
75#define __NR_munmap 91
76#define __NR_truncate 92
77#define __NR_ftruncate 93
78#define __NR_fchmod 94
79#define __NR_getpriority 96
80#define __NR_setpriority 97
81#define __NR_statfs 99
82#define __NR_fstatfs 100
83#define __NR_socketcall 102
84#define __NR_syslog 103
85#define __NR_setitimer 104
86#define __NR_getitimer 105
87#define __NR_stat 106
88#define __NR_lstat 107
89#define __NR_fstat 108
90#define __NR_lookup_dcookie 110
91#define __NR_vhangup 111
92#define __NR_idle 112
93#define __NR_wait4 114
94#define __NR_swapoff 115
95#define __NR_sysinfo 116
96#define __NR_ipc 117
97#define __NR_fsync 118
98#define __NR_sigreturn 119
99#define __NR_clone 120
100#define __NR_setdomainname 121
101#define __NR_uname 122
102#define __NR_adjtimex 124
103#define __NR_mprotect 125
104#define __NR_sigprocmask 126
105#define __NR_create_module 127
106#define __NR_init_module 128
107#define __NR_delete_module 129
108#define __NR_get_kernel_syms 130
109#define __NR_quotactl 131
110#define __NR_getpgid 132
111#define __NR_fchdir 133
112#define __NR_bdflush 134
113#define __NR_sysfs 135
114#define __NR_personality 136
115#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
116#define __NR_getdents 141
117#define __NR_flock 143
118#define __NR_msync 144
119#define __NR_readv 145
120#define __NR_writev 146
121#define __NR_getsid 147
122#define __NR_fdatasync 148
123#define __NR__sysctl 149
124#define __NR_mlock 150
125#define __NR_munlock 151
126#define __NR_mlockall 152
127#define __NR_munlockall 153
128#define __NR_sched_setparam 154
129#define __NR_sched_getparam 155
130#define __NR_sched_setscheduler 156
131#define __NR_sched_getscheduler 157
132#define __NR_sched_yield 158
133#define __NR_sched_get_priority_max 159
134#define __NR_sched_get_priority_min 160
135#define __NR_sched_rr_get_interval 161
136#define __NR_nanosleep 162
137#define __NR_mremap 163
138#define __NR_query_module 167
139#define __NR_poll 168
140#define __NR_nfsservctl 169
141#define __NR_prctl 172
142#define __NR_rt_sigreturn 173
143#define __NR_rt_sigaction 174
144#define __NR_rt_sigprocmask 175
145#define __NR_rt_sigpending 176
146#define __NR_rt_sigtimedwait 177
147#define __NR_rt_sigqueueinfo 178
148#define __NR_rt_sigsuspend 179
149#define __NR_pread64 180
150#define __NR_pwrite64 181
151#define __NR_getcwd 183
152#define __NR_capget 184
153#define __NR_capset 185
154#define __NR_sigaltstack 186
155#define __NR_sendfile 187
156#define __NR_getpmsg 188
157#define __NR_putpmsg 189
158#define __NR_vfork 190
159#define __NR_pivot_root 217
160#define __NR_mincore 218
161#define __NR_madvise 219
162#define __NR_getdents64 220
163#define __NR_readahead 222
164#define __NR_setxattr 224
165#define __NR_lsetxattr 225
166#define __NR_fsetxattr 226
167#define __NR_getxattr 227
168#define __NR_lgetxattr 228
169#define __NR_fgetxattr 229
170#define __NR_listxattr 230
171#define __NR_llistxattr 231
172#define __NR_flistxattr 232
173#define __NR_removexattr 233
174#define __NR_lremovexattr 234
175#define __NR_fremovexattr 235
176#define __NR_gettid 236
177#define __NR_tkill 237
178#define __NR_futex 238
179#define __NR_sched_setaffinity 239
180#define __NR_sched_getaffinity 240
181#define __NR_tgkill 241
182/* Number 242 is reserved for tux */
183#define __NR_io_setup 243
184#define __NR_io_destroy 244
185#define __NR_io_getevents 245
186#define __NR_io_submit 246
187#define __NR_io_cancel 247
188#define __NR_exit_group 248
189#define __NR_epoll_create 249
190#define __NR_epoll_ctl 250
191#define __NR_epoll_wait 251
192#define __NR_set_tid_address 252
193#define __NR_fadvise64 253
194#define __NR_timer_create 254
195#define __NR_timer_settime (__NR_timer_create+1)
196#define __NR_timer_gettime (__NR_timer_create+2)
197#define __NR_timer_getoverrun (__NR_timer_create+3)
198#define __NR_timer_delete (__NR_timer_create+4)
199#define __NR_clock_settime (__NR_timer_create+5)
200#define __NR_clock_gettime (__NR_timer_create+6)
201#define __NR_clock_getres (__NR_timer_create+7)
202#define __NR_clock_nanosleep (__NR_timer_create+8)
203/* Number 263 is reserved for vserver */
204#define __NR_statfs64 265
205#define __NR_fstatfs64 266
206#define __NR_remap_file_pages 267
207/* Number 268 is reserved for new sys_mbind */
208/* Number 269 is reserved for new sys_get_mempolicy */
209/* Number 270 is reserved for new sys_set_mempolicy */
210#define __NR_mq_open 271
211#define __NR_mq_unlink 272
212#define __NR_mq_timedsend 273
213#define __NR_mq_timedreceive 274
214#define __NR_mq_notify 275
215#define __NR_mq_getsetattr 276
216#define __NR_kexec_load 277
217#define __NR_add_key 278
218#define __NR_request_key 279
219#define __NR_keyctl 280
220#define __NR_waitid 281
221#define __NR_ioprio_set 282
222#define __NR_ioprio_get 283
223#define __NR_inotify_init 284
224#define __NR_inotify_add_watch 285
225#define __NR_inotify_rm_watch 286
226/* Number 287 is reserved for new sys_migrate_pages */
227#define __NR_openat 288
228#define __NR_mkdirat 289
229#define __NR_mknodat 290
230#define __NR_fchownat 291
231#define __NR_futimesat 292
232#define __NR_unlinkat 294
233#define __NR_renameat 295
234#define __NR_linkat 296
235#define __NR_symlinkat 297
236#define __NR_readlinkat 298
237#define __NR_fchmodat 299
238#define __NR_faccessat 300
239#define __NR_pselect6 301
240#define __NR_ppoll 302
241#define __NR_unshare 303
242#define __NR_set_robust_list 304
243#define __NR_get_robust_list 305
244#define __NR_splice 306
245#define __NR_sync_file_range 307
246#define __NR_tee 308
247#define __NR_vmsplice 309
248/* Number 310 is reserved for new sys_move_pages */
249#define __NR_getcpu 311
250#define __NR_epoll_pwait 312
251#define __NR_utimes 313
252#define __NR_fallocate 314
253#define __NR_utimensat 315
254#define __NR_signalfd 316
255#define __NR_timerfd 317
256#define __NR_eventfd 318
257#define __NR_timerfd_create 319
258#define __NR_timerfd_settime 320
259#define __NR_timerfd_gettime 321
260#define __NR_signalfd4 322
261#define __NR_eventfd2 323
262#define __NR_inotify_init1 324
263#define __NR_pipe2 325
264#define __NR_dup3 326
265#define __NR_epoll_create1 327
266#define __NR_preadv 328
267#define __NR_pwritev 329
268#define __NR_rt_tgsigqueueinfo 330
269#define __NR_perf_event_open 331
270#define __NR_fanotify_init 332
271#define __NR_fanotify_mark 333
272#define __NR_prlimit64 334
273#define __NR_name_to_handle_at 335
274#define __NR_open_by_handle_at 336
275#define __NR_clock_adjtime 337
276#define __NR_syncfs 338
277#define __NR_setns 339
278#define __NR_process_vm_readv 340
279#define __NR_process_vm_writev 341
280#define __NR_s390_runtime_instr 342
281#define __NR_kcmp 343
282#define NR_syscalls 344
283
284/*
285 * There are some system calls that are not present on 64 bit, some
286 * have a different name although they do the same (e.g. __NR_chown32
287 * is __NR_chown on 64 bit).
288 */
289#ifndef __s390x__
290
291#define __NR_time 13
292#define __NR_lchown 16
293#define __NR_setuid 23
294#define __NR_getuid 24
295#define __NR_stime 25
296#define __NR_setgid 46
297#define __NR_getgid 47
298#define __NR_geteuid 49
299#define __NR_getegid 50
300#define __NR_setreuid 70
301#define __NR_setregid 71
302#define __NR_getrlimit 76
303#define __NR_getgroups 80
304#define __NR_setgroups 81
305#define __NR_fchown 95
306#define __NR_ioperm 101
307#define __NR_setfsuid 138
308#define __NR_setfsgid 139
309#define __NR__llseek 140
310#define __NR__newselect 142
311#define __NR_setresuid 164
312#define __NR_getresuid 165
313#define __NR_setresgid 170
314#define __NR_getresgid 171
315#define __NR_chown 182
316#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
317#define __NR_mmap2 192
318#define __NR_truncate64 193
319#define __NR_ftruncate64 194
320#define __NR_stat64 195
321#define __NR_lstat64 196
322#define __NR_fstat64 197
323#define __NR_lchown32 198
324#define __NR_getuid32 199
325#define __NR_getgid32 200
326#define __NR_geteuid32 201
327#define __NR_getegid32 202
328#define __NR_setreuid32 203
329#define __NR_setregid32 204
330#define __NR_getgroups32 205
331#define __NR_setgroups32 206
332#define __NR_fchown32 207
333#define __NR_setresuid32 208
334#define __NR_getresuid32 209
335#define __NR_setresgid32 210
336#define __NR_getresgid32 211
337#define __NR_chown32 212
338#define __NR_setuid32 213
339#define __NR_setgid32 214
340#define __NR_setfsuid32 215
341#define __NR_setfsgid32 216
342#define __NR_fcntl64 221
343#define __NR_sendfile64 223
344#define __NR_fadvise64_64 264
345#define __NR_fstatat64 293
346
347#else
348
349#define __NR_select 142
350#define __NR_getrlimit 191 /* SuS compliant getrlimit */
351#define __NR_lchown 198
352#define __NR_getuid 199
353#define __NR_getgid 200
354#define __NR_geteuid 201
355#define __NR_getegid 202
356#define __NR_setreuid 203
357#define __NR_setregid 204
358#define __NR_getgroups 205
359#define __NR_setgroups 206
360#define __NR_fchown 207
361#define __NR_setresuid 208
362#define __NR_getresuid 209
363#define __NR_setresgid 210
364#define __NR_getresgid 211
365#define __NR_chown 212
366#define __NR_setuid 213
367#define __NR_setgid 214
368#define __NR_setfsuid 215
369#define __NR_setfsgid 216
370#define __NR_newfstatat 293
371
372#endif
373 10
374#ifdef __KERNEL__
375 11
376#ifndef CONFIG_64BIT 12#ifndef CONFIG_64BIT
377#define __IGNORE_select 13#define __IGNORE_select
@@ -417,6 +53,8 @@
417# define __ARCH_WANT_COMPAT_SYS_TIME 53# define __ARCH_WANT_COMPAT_SYS_TIME
418# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 54# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
419# endif 55# endif
56#define __ARCH_WANT_SYS_EXECVE
57#define __ARCH_WANT_KERNEL_EXECVE
420 58
421/* 59/*
422 * "Conditional" syscalls 60 * "Conditional" syscalls
@@ -426,5 +64,4 @@
426 */ 64 */
427#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 65#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
428 66
429#endif /* __KERNEL__ */
430#endif /* _ASM_S390_UNISTD_H_ */ 67#endif /* _ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index baebb3da1d44..7bf68fff7c5d 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -1,3 +1,48 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += auxvec.h
5header-y += bitsperlong.h
6header-y += byteorder.h
7header-y += chpid.h
8header-y += chsc.h
9header-y += cmb.h
10header-y += dasd.h
11header-y += debug.h
12header-y += errno.h
13header-y += fcntl.h
14header-y += ioctl.h
15header-y += ioctls.h
16header-y += ipcbuf.h
17header-y += kvm.h
18header-y += kvm_para.h
19header-y += kvm_virtio.h
20header-y += mman.h
21header-y += monwriter.h
22header-y += msgbuf.h
23header-y += param.h
24header-y += poll.h
25header-y += posix_types.h
26header-y += ptrace.h
27header-y += qeth.h
28header-y += resource.h
29header-y += schid.h
30header-y += sembuf.h
31header-y += setup.h
32header-y += shmbuf.h
33header-y += sigcontext.h
34header-y += siginfo.h
35header-y += signal.h
36header-y += socket.h
37header-y += sockios.h
38header-y += stat.h
39header-y += statfs.h
40header-y += swab.h
41header-y += tape390.h
42header-y += termbits.h
43header-y += termios.h
44header-y += types.h
45header-y += ucontext.h
46header-y += unistd.h
47header-y += vtoc.h
48header-y += zcrypt.h
diff --git a/arch/s390/include/asm/auxvec.h b/arch/s390/include/uapi/asm/auxvec.h
index a1f153e89133..a1f153e89133 100644
--- a/arch/s390/include/asm/auxvec.h
+++ b/arch/s390/include/uapi/asm/auxvec.h
diff --git a/arch/s390/include/asm/bitsperlong.h b/arch/s390/include/uapi/asm/bitsperlong.h
index 6b235aea9c66..6b235aea9c66 100644
--- a/arch/s390/include/asm/bitsperlong.h
+++ b/arch/s390/include/uapi/asm/bitsperlong.h
diff --git a/arch/s390/include/asm/byteorder.h b/arch/s390/include/uapi/asm/byteorder.h
index a332e59e26fc..a332e59e26fc 100644
--- a/arch/s390/include/asm/byteorder.h
+++ b/arch/s390/include/uapi/asm/byteorder.h
diff --git a/arch/s390/include/uapi/asm/chpid.h b/arch/s390/include/uapi/asm/chpid.h
new file mode 100644
index 000000000000..6b4fb29cc197
--- /dev/null
+++ b/arch/s390/include/uapi/asm/chpid.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright IBM Corp. 2007, 2012
3 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
4 */
5
6#ifndef _UAPI_ASM_S390_CHPID_H
7#define _UAPI_ASM_S390_CHPID_H
8
9#include <linux/string.h>
10#include <linux/types.h>
11
12#define __MAX_CHPID 255
13
14struct chp_id {
15 __u8 reserved1;
16 __u8 cssid;
17 __u8 reserved2;
18 __u8 id;
19} __attribute__((packed));
20
21
22#endif /* _UAPI_ASM_S390_CHPID_H */
diff --git a/arch/s390/include/asm/chsc.h b/arch/s390/include/uapi/asm/chsc.h
index aea451fd182e..1c6a7f85a581 100644
--- a/arch/s390/include/asm/chsc.h
+++ b/arch/s390/include/uapi/asm/chsc.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * ioctl interface for /dev/chsc 2 * ioctl interface for /dev/chsc
3 * 3 *
4 * Copyright IBM Corp. 2008 4 * Copyright IBM Corp. 2008, 2012
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 */ 6 */
7 7
@@ -9,9 +9,12 @@
9#define _ASM_CHSC_H 9#define _ASM_CHSC_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ioctl.h>
12#include <asm/chpid.h> 13#include <asm/chpid.h>
13#include <asm/schid.h> 14#include <asm/schid.h>
14 15
16#define CHSC_SIZE 0x1000
17
15struct chsc_async_header { 18struct chsc_async_header {
16 __u16 length; 19 __u16 length;
17 __u16 code; 20 __u16 code;
@@ -23,15 +26,14 @@ struct chsc_async_header {
23 26
24struct chsc_async_area { 27struct chsc_async_area {
25 struct chsc_async_header header; 28 struct chsc_async_header header;
26 __u8 data[PAGE_SIZE - 16 /* size of chsc_async_header */]; 29 __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)];
27} __attribute__ ((packed)); 30} __attribute__ ((packed));
28 31
29
30struct chsc_response_struct { 32struct chsc_response_struct {
31 __u16 length; 33 __u16 length;
32 __u16 code; 34 __u16 code;
33 __u32 parms; 35 __u32 parms;
34 __u8 data[PAGE_SIZE - 8]; 36 __u8 data[CHSC_SIZE - 2 * sizeof(__u16) - sizeof(__u32)];
35} __attribute__ ((packed)); 37} __attribute__ ((packed));
36 38
37struct chsc_chp_cd { 39struct chsc_chp_cd {
diff --git a/arch/s390/include/uapi/asm/cmb.h b/arch/s390/include/uapi/asm/cmb.h
new file mode 100644
index 000000000000..0c086d00d89e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/cmb.h
@@ -0,0 +1,53 @@
1#ifndef _UAPIS390_CMB_H
2#define _UAPIS390_CMB_H
3
4#include <linux/types.h>
5
6/**
7 * struct cmbdata - channel measurement block data for user space
8 * @size: size of the stored data
9 * @elapsed_time: time since last sampling
10 * @ssch_rsch_count: number of ssch and rsch
11 * @sample_count: number of samples
12 * @device_connect_time: time of device connect
13 * @function_pending_time: time of function pending
14 * @device_disconnect_time: time of device disconnect
15 * @control_unit_queuing_time: time of control unit queuing
16 * @device_active_only_time: time of device active only
17 * @device_busy_time: time of device busy (ext. format)
18 * @initial_command_response_time: initial command response time (ext. format)
19 *
20 * All values are stored as 64 bit for simplicity, especially
21 * in 32 bit emulation mode. All time values are normalized to
22 * nanoseconds.
23 * Currently, two formats are known, which differ by the size of
24 * this structure, i.e. the last two members are only set when
25 * the extended channel measurement facility (first shipped in
26 * z990 machines) is activated.
27 * Potentially, more fields could be added, which would result in a
28 * new ioctl number.
29 */
30struct cmbdata {
31 __u64 size;
32 __u64 elapsed_time;
33 /* basic and exended format: */
34 __u64 ssch_rsch_count;
35 __u64 sample_count;
36 __u64 device_connect_time;
37 __u64 function_pending_time;
38 __u64 device_disconnect_time;
39 __u64 control_unit_queuing_time;
40 __u64 device_active_only_time;
41 /* extended format only: */
42 __u64 device_busy_time;
43 __u64 initial_command_response_time;
44};
45
46/* enable channel measurement */
47#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER, 32)
48/* enable channel measurement */
49#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER, 33)
50/* read channel measurement data */
51#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER, 33, struct cmbdata)
52
53#endif /* _UAPIS390_CMB_H */
diff --git a/arch/s390/include/asm/dasd.h b/arch/s390/include/uapi/asm/dasd.h
index 38eca3ba40e2..38eca3ba40e2 100644
--- a/arch/s390/include/asm/dasd.h
+++ b/arch/s390/include/uapi/asm/dasd.h
diff --git a/arch/s390/include/uapi/asm/debug.h b/arch/s390/include/uapi/asm/debug.h
new file mode 100644
index 000000000000..c59fc79125f2
--- /dev/null
+++ b/arch/s390/include/uapi/asm/debug.h
@@ -0,0 +1,34 @@
1/*
2 * S/390 debug facility
3 *
4 * Copyright IBM Corp. 1999, 2000
5 */
6
7#ifndef _UAPIDEBUG_H
8#define _UAPIDEBUG_H
9
10#include <linux/fs.h>
11
12/* Note:
13 * struct __debug_entry must be defined outside of #ifdef __KERNEL__
14 * in order to allow a user program to analyze the 'raw'-view.
15 */
16
17struct __debug_entry{
18 union {
19 struct {
20 unsigned long long clock:52;
21 unsigned long long exception:1;
22 unsigned long long level:3;
23 unsigned long long cpuid:8;
24 } fields;
25
26 unsigned long long stck;
27 } id;
28 void* caller;
29} __attribute__((packed));
30
31
32#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
33
34#endif /* _UAPIDEBUG_H */
diff --git a/arch/s390/include/asm/errno.h b/arch/s390/include/uapi/asm/errno.h
index 395e97d8005e..395e97d8005e 100644
--- a/arch/s390/include/asm/errno.h
+++ b/arch/s390/include/uapi/asm/errno.h
diff --git a/arch/s390/include/asm/fcntl.h b/arch/s390/include/uapi/asm/fcntl.h
index 46ab12db5739..46ab12db5739 100644
--- a/arch/s390/include/asm/fcntl.h
+++ b/arch/s390/include/uapi/asm/fcntl.h
diff --git a/arch/s390/include/asm/ioctl.h b/arch/s390/include/uapi/asm/ioctl.h
index b279fe06dfe5..b279fe06dfe5 100644
--- a/arch/s390/include/asm/ioctl.h
+++ b/arch/s390/include/uapi/asm/ioctl.h
diff --git a/arch/s390/include/asm/ioctls.h b/arch/s390/include/uapi/asm/ioctls.h
index 960a4c1ebdf1..960a4c1ebdf1 100644
--- a/arch/s390/include/asm/ioctls.h
+++ b/arch/s390/include/uapi/asm/ioctls.h
diff --git a/arch/s390/include/asm/ipcbuf.h b/arch/s390/include/uapi/asm/ipcbuf.h
index 37f293d12c8f..37f293d12c8f 100644
--- a/arch/s390/include/asm/ipcbuf.h
+++ b/arch/s390/include/uapi/asm/ipcbuf.h
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
index d25da598ec62..d25da598ec62 100644
--- a/arch/s390/include/asm/kvm.h
+++ b/arch/s390/include/uapi/asm/kvm.h
diff --git a/arch/s390/include/uapi/asm/kvm_para.h b/arch/s390/include/uapi/asm/kvm_para.h
new file mode 100644
index 000000000000..ff1f4e7b3015
--- /dev/null
+++ b/arch/s390/include/uapi/asm/kvm_para.h
@@ -0,0 +1,11 @@
1/*
2 * User API definitions for paravirtual devices on s390
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
11 */
diff --git a/arch/s390/include/asm/kvm_virtio.h b/arch/s390/include/uapi/asm/kvm_virtio.h
index 44a438ca9e72..44a438ca9e72 100644
--- a/arch/s390/include/asm/kvm_virtio.h
+++ b/arch/s390/include/uapi/asm/kvm_virtio.h
diff --git a/arch/s390/include/uapi/asm/mman.h b/arch/s390/include/uapi/asm/mman.h
new file mode 100644
index 000000000000..de23da1f41b2
--- /dev/null
+++ b/arch/s390/include/uapi/asm/mman.h
@@ -0,0 +1,6 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/mman.h"
5 */
6#include <asm-generic/mman.h>
diff --git a/arch/s390/include/asm/monwriter.h b/arch/s390/include/uapi/asm/monwriter.h
index f845c8e2f861..f845c8e2f861 100644
--- a/arch/s390/include/asm/monwriter.h
+++ b/arch/s390/include/uapi/asm/monwriter.h
diff --git a/arch/s390/include/asm/msgbuf.h b/arch/s390/include/uapi/asm/msgbuf.h
index 1bbdee927924..1bbdee927924 100644
--- a/arch/s390/include/asm/msgbuf.h
+++ b/arch/s390/include/uapi/asm/msgbuf.h
diff --git a/arch/s390/include/asm/param.h b/arch/s390/include/uapi/asm/param.h
index c616821bf2ac..c616821bf2ac 100644
--- a/arch/s390/include/asm/param.h
+++ b/arch/s390/include/uapi/asm/param.h
diff --git a/arch/s390/include/asm/poll.h b/arch/s390/include/uapi/asm/poll.h
index c98509d3149e..c98509d3149e 100644
--- a/arch/s390/include/asm/poll.h
+++ b/arch/s390/include/uapi/asm/poll.h
diff --git a/arch/s390/include/asm/posix_types.h b/arch/s390/include/uapi/asm/posix_types.h
index bf2a2ad2f800..bf2a2ad2f800 100644
--- a/arch/s390/include/asm/posix_types.h
+++ b/arch/s390/include/uapi/asm/posix_types.h
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..705588a16d70
--- /dev/null
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -0,0 +1,472 @@
1/*
2 * S390 version
3 * Copyright IBM Corp. 1999, 2000
4 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
5 */
6
7#ifndef _UAPI_S390_PTRACE_H
8#define _UAPI_S390_PTRACE_H
9
10/*
11 * Offsets in the user_regs_struct. They are used for the ptrace
12 * system call and in entry.S
13 */
14#ifndef __s390x__
15
16#define PT_PSWMASK 0x00
17#define PT_PSWADDR 0x04
18#define PT_GPR0 0x08
19#define PT_GPR1 0x0C
20#define PT_GPR2 0x10
21#define PT_GPR3 0x14
22#define PT_GPR4 0x18
23#define PT_GPR5 0x1C
24#define PT_GPR6 0x20
25#define PT_GPR7 0x24
26#define PT_GPR8 0x28
27#define PT_GPR9 0x2C
28#define PT_GPR10 0x30
29#define PT_GPR11 0x34
30#define PT_GPR12 0x38
31#define PT_GPR13 0x3C
32#define PT_GPR14 0x40
33#define PT_GPR15 0x44
34#define PT_ACR0 0x48
35#define PT_ACR1 0x4C
36#define PT_ACR2 0x50
37#define PT_ACR3 0x54
38#define PT_ACR4 0x58
39#define PT_ACR5 0x5C
40#define PT_ACR6 0x60
41#define PT_ACR7 0x64
42#define PT_ACR8 0x68
43#define PT_ACR9 0x6C
44#define PT_ACR10 0x70
45#define PT_ACR11 0x74
46#define PT_ACR12 0x78
47#define PT_ACR13 0x7C
48#define PT_ACR14 0x80
49#define PT_ACR15 0x84
50#define PT_ORIGGPR2 0x88
51#define PT_FPC 0x90
52/*
53 * A nasty fact of life that the ptrace api
54 * only supports passing of longs.
55 */
56#define PT_FPR0_HI 0x98
57#define PT_FPR0_LO 0x9C
58#define PT_FPR1_HI 0xA0
59#define PT_FPR1_LO 0xA4
60#define PT_FPR2_HI 0xA8
61#define PT_FPR2_LO 0xAC
62#define PT_FPR3_HI 0xB0
63#define PT_FPR3_LO 0xB4
64#define PT_FPR4_HI 0xB8
65#define PT_FPR4_LO 0xBC
66#define PT_FPR5_HI 0xC0
67#define PT_FPR5_LO 0xC4
68#define PT_FPR6_HI 0xC8
69#define PT_FPR6_LO 0xCC
70#define PT_FPR7_HI 0xD0
71#define PT_FPR7_LO 0xD4
72#define PT_FPR8_HI 0xD8
73#define PT_FPR8_LO 0XDC
74#define PT_FPR9_HI 0xE0
75#define PT_FPR9_LO 0xE4
76#define PT_FPR10_HI 0xE8
77#define PT_FPR10_LO 0xEC
78#define PT_FPR11_HI 0xF0
79#define PT_FPR11_LO 0xF4
80#define PT_FPR12_HI 0xF8
81#define PT_FPR12_LO 0xFC
82#define PT_FPR13_HI 0x100
83#define PT_FPR13_LO 0x104
84#define PT_FPR14_HI 0x108
85#define PT_FPR14_LO 0x10C
86#define PT_FPR15_HI 0x110
87#define PT_FPR15_LO 0x114
88#define PT_CR_9 0x118
89#define PT_CR_10 0x11C
90#define PT_CR_11 0x120
91#define PT_IEEE_IP 0x13C
92#define PT_LASTOFF PT_IEEE_IP
93#define PT_ENDREGS 0x140-1
94
95#define GPR_SIZE 4
96#define CR_SIZE 4
97
98#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */
99
100#else /* __s390x__ */
101
102#define PT_PSWMASK 0x00
103#define PT_PSWADDR 0x08
104#define PT_GPR0 0x10
105#define PT_GPR1 0x18
106#define PT_GPR2 0x20
107#define PT_GPR3 0x28
108#define PT_GPR4 0x30
109#define PT_GPR5 0x38
110#define PT_GPR6 0x40
111#define PT_GPR7 0x48
112#define PT_GPR8 0x50
113#define PT_GPR9 0x58
114#define PT_GPR10 0x60
115#define PT_GPR11 0x68
116#define PT_GPR12 0x70
117#define PT_GPR13 0x78
118#define PT_GPR14 0x80
119#define PT_GPR15 0x88
120#define PT_ACR0 0x90
121#define PT_ACR1 0x94
122#define PT_ACR2 0x98
123#define PT_ACR3 0x9C
124#define PT_ACR4 0xA0
125#define PT_ACR5 0xA4
126#define PT_ACR6 0xA8
127#define PT_ACR7 0xAC
128#define PT_ACR8 0xB0
129#define PT_ACR9 0xB4
130#define PT_ACR10 0xB8
131#define PT_ACR11 0xBC
132#define PT_ACR12 0xC0
133#define PT_ACR13 0xC4
134#define PT_ACR14 0xC8
135#define PT_ACR15 0xCC
136#define PT_ORIGGPR2 0xD0
137#define PT_FPC 0xD8
138#define PT_FPR0 0xE0
139#define PT_FPR1 0xE8
140#define PT_FPR2 0xF0
141#define PT_FPR3 0xF8
142#define PT_FPR4 0x100
143#define PT_FPR5 0x108
144#define PT_FPR6 0x110
145#define PT_FPR7 0x118
146#define PT_FPR8 0x120
147#define PT_FPR9 0x128
148#define PT_FPR10 0x130
149#define PT_FPR11 0x138
150#define PT_FPR12 0x140
151#define PT_FPR13 0x148
152#define PT_FPR14 0x150
153#define PT_FPR15 0x158
154#define PT_CR_9 0x160
155#define PT_CR_10 0x168
156#define PT_CR_11 0x170
157#define PT_IEEE_IP 0x1A8
158#define PT_LASTOFF PT_IEEE_IP
159#define PT_ENDREGS 0x1B0-1
160
161#define GPR_SIZE 8
162#define CR_SIZE 8
163
164#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
165
166#endif /* __s390x__ */
167
168#define NUM_GPRS 16
169#define NUM_FPRS 16
170#define NUM_CRS 16
171#define NUM_ACRS 16
172
173#define NUM_CR_WORDS 3
174
175#define FPR_SIZE 8
176#define FPC_SIZE 4
177#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
178#define ACR_SIZE 4
179
180
181#define PTRACE_OLDSETOPTIONS 21
182
183#ifndef __ASSEMBLY__
184#include <linux/stddef.h>
185#include <linux/types.h>
186
187typedef union
188{
189 float f;
190 double d;
191 __u64 ui;
192 struct
193 {
194 __u32 hi;
195 __u32 lo;
196 } fp;
197} freg_t;
198
199typedef struct
200{
201 __u32 fpc;
202 freg_t fprs[NUM_FPRS];
203} s390_fp_regs;
204
205#define FPC_EXCEPTION_MASK 0xF8000000
206#define FPC_FLAGS_MASK 0x00F80000
207#define FPC_DXC_MASK 0x0000FF00
208#define FPC_RM_MASK 0x00000003
209#define FPC_VALID_MASK 0xF8F8FF03
210
211/* this typedef defines how a Program Status Word looks like */
212typedef struct
213{
214 unsigned long mask;
215 unsigned long addr;
216} __attribute__ ((aligned(8))) psw_t;
217
218typedef struct
219{
220 __u32 mask;
221 __u32 addr;
222} __attribute__ ((aligned(8))) psw_compat_t;
223
224#ifndef __s390x__
225
226#define PSW_MASK_PER 0x40000000UL
227#define PSW_MASK_DAT 0x04000000UL
228#define PSW_MASK_IO 0x02000000UL
229#define PSW_MASK_EXT 0x01000000UL
230#define PSW_MASK_KEY 0x00F00000UL
231#define PSW_MASK_BASE 0x00080000UL /* always one */
232#define PSW_MASK_MCHECK 0x00040000UL
233#define PSW_MASK_WAIT 0x00020000UL
234#define PSW_MASK_PSTATE 0x00010000UL
235#define PSW_MASK_ASC 0x0000C000UL
236#define PSW_MASK_CC 0x00003000UL
237#define PSW_MASK_PM 0x00000F00UL
238#define PSW_MASK_RI 0x00000000UL
239#define PSW_MASK_EA 0x00000000UL
240#define PSW_MASK_BA 0x00000000UL
241
242#define PSW_MASK_USER 0x00003F00UL
243
244#define PSW_ADDR_AMODE 0x80000000UL
245#define PSW_ADDR_INSN 0x7FFFFFFFUL
246
247#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
248
249#define PSW_ASC_PRIMARY 0x00000000UL
250#define PSW_ASC_ACCREG 0x00004000UL
251#define PSW_ASC_SECONDARY 0x00008000UL
252#define PSW_ASC_HOME 0x0000C000UL
253
254#else /* __s390x__ */
255
256#define PSW_MASK_PER 0x4000000000000000UL
257#define PSW_MASK_DAT 0x0400000000000000UL
258#define PSW_MASK_IO 0x0200000000000000UL
259#define PSW_MASK_EXT 0x0100000000000000UL
260#define PSW_MASK_BASE 0x0000000000000000UL
261#define PSW_MASK_KEY 0x00F0000000000000UL
262#define PSW_MASK_MCHECK 0x0004000000000000UL
263#define PSW_MASK_WAIT 0x0002000000000000UL
264#define PSW_MASK_PSTATE 0x0001000000000000UL
265#define PSW_MASK_ASC 0x0000C00000000000UL
266#define PSW_MASK_CC 0x0000300000000000UL
267#define PSW_MASK_PM 0x00000F0000000000UL
268#define PSW_MASK_RI 0x0000008000000000UL
269#define PSW_MASK_EA 0x0000000100000000UL
270#define PSW_MASK_BA 0x0000000080000000UL
271
272#define PSW_MASK_USER 0x00003F8180000000UL
273
274#define PSW_ADDR_AMODE 0x0000000000000000UL
275#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
276
277#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
278
279#define PSW_ASC_PRIMARY 0x0000000000000000UL
280#define PSW_ASC_ACCREG 0x0000400000000000UL
281#define PSW_ASC_SECONDARY 0x0000800000000000UL
282#define PSW_ASC_HOME 0x0000C00000000000UL
283
284#endif /* __s390x__ */
285
286
287/*
288 * The s390_regs structure is used to define the elf_gregset_t.
289 */
290typedef struct
291{
292 psw_t psw;
293 unsigned long gprs[NUM_GPRS];
294 unsigned int acrs[NUM_ACRS];
295 unsigned long orig_gpr2;
296} s390_regs;
297
298typedef struct
299{
300 psw_compat_t psw;
301 __u32 gprs[NUM_GPRS];
302 __u32 acrs[NUM_ACRS];
303 __u32 orig_gpr2;
304} s390_compat_regs;
305
306typedef struct
307{
308 __u32 gprs_high[NUM_GPRS];
309} s390_compat_regs_high;
310
311
312/*
313 * Now for the user space program event recording (trace) definitions.
314 * The following structures are used only for the ptrace interface, don't
315 * touch or even look at it if you don't want to modify the user-space
316 * ptrace interface. In particular stay away from it for in-kernel PER.
317 */
318typedef struct
319{
320 unsigned long cr[NUM_CR_WORDS];
321} per_cr_words;
322
323#define PER_EM_MASK 0xE8000000UL
324
325typedef struct
326{
327#ifdef __s390x__
328 unsigned : 32;
329#endif /* __s390x__ */
330 unsigned em_branching : 1;
331 unsigned em_instruction_fetch : 1;
332 /*
333 * Switching on storage alteration automatically fixes
334 * the storage alteration event bit in the users std.
335 */
336 unsigned em_storage_alteration : 1;
337 unsigned em_gpr_alt_unused : 1;
338 unsigned em_store_real_address : 1;
339 unsigned : 3;
340 unsigned branch_addr_ctl : 1;
341 unsigned : 1;
342 unsigned storage_alt_space_ctl : 1;
343 unsigned : 21;
344 unsigned long starting_addr;
345 unsigned long ending_addr;
346} per_cr_bits;
347
348typedef struct
349{
350 unsigned short perc_atmid;
351 unsigned long address;
352 unsigned char access_id;
353} per_lowcore_words;
354
355typedef struct
356{
357 unsigned perc_branching : 1;
358 unsigned perc_instruction_fetch : 1;
359 unsigned perc_storage_alteration : 1;
360 unsigned perc_gpr_alt_unused : 1;
361 unsigned perc_store_real_address : 1;
362 unsigned : 3;
363 unsigned atmid_psw_bit_31 : 1;
364 unsigned atmid_validity_bit : 1;
365 unsigned atmid_psw_bit_32 : 1;
366 unsigned atmid_psw_bit_5 : 1;
367 unsigned atmid_psw_bit_16 : 1;
368 unsigned atmid_psw_bit_17 : 1;
369 unsigned si : 2;
370 unsigned long address;
371 unsigned : 4;
372 unsigned access_id : 4;
373} per_lowcore_bits;
374
375typedef struct
376{
377 union {
378 per_cr_words words;
379 per_cr_bits bits;
380 } control_regs;
381 /*
382 * Use these flags instead of setting em_instruction_fetch
383 * directly they are used so that single stepping can be
384 * switched on & off while not affecting other tracing
385 */
386 unsigned single_step : 1;
387 unsigned instruction_fetch : 1;
388 unsigned : 30;
389 /*
390 * These addresses are copied into cr10 & cr11 if single
391 * stepping is switched off
392 */
393 unsigned long starting_addr;
394 unsigned long ending_addr;
395 union {
396 per_lowcore_words words;
397 per_lowcore_bits bits;
398 } lowcore;
399} per_struct;
400
401typedef struct
402{
403 unsigned int len;
404 unsigned long kernel_addr;
405 unsigned long process_addr;
406} ptrace_area;
407
408/*
409 * S/390 specific non posix ptrace requests. I chose unusual values so
410 * they are unlikely to clash with future ptrace definitions.
411 */
412#define PTRACE_PEEKUSR_AREA 0x5000
413#define PTRACE_POKEUSR_AREA 0x5001
414#define PTRACE_PEEKTEXT_AREA 0x5002
415#define PTRACE_PEEKDATA_AREA 0x5003
416#define PTRACE_POKETEXT_AREA 0x5004
417#define PTRACE_POKEDATA_AREA 0x5005
418#define PTRACE_GET_LAST_BREAK 0x5006
419#define PTRACE_PEEK_SYSTEM_CALL 0x5007
420#define PTRACE_POKE_SYSTEM_CALL 0x5008
421#define PTRACE_ENABLE_TE 0x5009
422#define PTRACE_DISABLE_TE 0x5010
423
424/*
425 * PT_PROT definition is loosely based on hppa bsd definition in
426 * gdb/hppab-nat.c
427 */
428#define PTRACE_PROT 21
429
430typedef enum
431{
432 ptprot_set_access_watchpoint,
433 ptprot_set_write_watchpoint,
434 ptprot_disable_watchpoint
435} ptprot_flags;
436
437typedef struct
438{
439 unsigned long lowaddr;
440 unsigned long hiaddr;
441 ptprot_flags prot;
442} ptprot_area;
443
444/* Sequence of bytes for breakpoint illegal instruction. */
445#define S390_BREAKPOINT {0x0,0x1}
446#define S390_BREAKPOINT_U16 ((__u16)0x0001)
447#define S390_SYSCALL_OPCODE ((__u16)0x0a00)
448#define S390_SYSCALL_SIZE 2
449
450/*
451 * The user_regs_struct defines the way the user registers are
452 * store on the stack for signal handling.
453 */
454struct user_regs_struct
455{
456 psw_t psw;
457 unsigned long gprs[NUM_GPRS];
458 unsigned int acrs[NUM_ACRS];
459 unsigned long orig_gpr2;
460 s390_fp_regs fp_regs;
461 /*
462 * These per registers are in here so that gdb can modify them
463 * itself as there is no "official" ptrace interface for hardware
464 * watchpoints. This is the way intel does it.
465 */
466 per_struct per_info;
467 unsigned long ieee_instruction_pointer; /* obsolete, always 0 */
468};
469
470#endif /* __ASSEMBLY__ */
471
472#endif /* _UAPI_S390_PTRACE_H */
diff --git a/arch/s390/include/asm/qeth.h b/arch/s390/include/uapi/asm/qeth.h
index 3a896cf52589..3a896cf52589 100644
--- a/arch/s390/include/asm/qeth.h
+++ b/arch/s390/include/uapi/asm/qeth.h
diff --git a/arch/s390/include/asm/resource.h b/arch/s390/include/uapi/asm/resource.h
index ec23d1c73c92..ec23d1c73c92 100644
--- a/arch/s390/include/asm/resource.h
+++ b/arch/s390/include/uapi/asm/resource.h
diff --git a/arch/s390/include/uapi/asm/schid.h b/arch/s390/include/uapi/asm/schid.h
new file mode 100644
index 000000000000..32f3ab2a8200
--- /dev/null
+++ b/arch/s390/include/uapi/asm/schid.h
@@ -0,0 +1,16 @@
1#ifndef _UAPIASM_SCHID_H
2#define _UAPIASM_SCHID_H
3
4#include <linux/types.h>
5
6struct subchannel_id {
7 __u32 cssid : 8;
8 __u32 : 4;
9 __u32 m : 1;
10 __u32 ssid : 2;
11 __u32 one : 1;
12 __u32 sch_no : 16;
13} __attribute__ ((packed, aligned(4)));
14
15
16#endif /* _UAPIASM_SCHID_H */
diff --git a/arch/s390/include/asm/sembuf.h b/arch/s390/include/uapi/asm/sembuf.h
index 32626b0cac4b..32626b0cac4b 100644
--- a/arch/s390/include/asm/sembuf.h
+++ b/arch/s390/include/uapi/asm/sembuf.h
diff --git a/arch/s390/include/uapi/asm/setup.h b/arch/s390/include/uapi/asm/setup.h
new file mode 100644
index 000000000000..5a637e3e385e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/setup.h
@@ -0,0 +1,13 @@
1/*
2 * S390 version
3 * Copyright IBM Corp. 1999, 2010
4 */
5
6#ifndef _UAPI_ASM_S390_SETUP_H
7#define _UAPI_ASM_S390_SETUP_H
8
9#define COMMAND_LINE_SIZE 4096
10
11#define ARCH_COMMAND_LINE_SIZE 896
12
13#endif /* _UAPI_ASM_S390_SETUP_H */
diff --git a/arch/s390/include/asm/shmbuf.h b/arch/s390/include/uapi/asm/shmbuf.h
index eed2e280ce37..eed2e280ce37 100644
--- a/arch/s390/include/asm/shmbuf.h
+++ b/arch/s390/include/uapi/asm/shmbuf.h
diff --git a/arch/s390/include/asm/sigcontext.h b/arch/s390/include/uapi/asm/sigcontext.h
index 584787f6ce44..584787f6ce44 100644
--- a/arch/s390/include/asm/sigcontext.h
+++ b/arch/s390/include/uapi/asm/sigcontext.h
diff --git a/arch/s390/include/asm/siginfo.h b/arch/s390/include/uapi/asm/siginfo.h
index 91fd3e4b70ce..91fd3e4b70ce 100644
--- a/arch/s390/include/asm/siginfo.h
+++ b/arch/s390/include/uapi/asm/siginfo.h
diff --git a/arch/s390/include/uapi/asm/signal.h b/arch/s390/include/uapi/asm/signal.h
new file mode 100644
index 000000000000..8c6a49e392ee
--- /dev/null
+++ b/arch/s390/include/uapi/asm/signal.h
@@ -0,0 +1,135 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/signal.h"
5 */
6
7#ifndef _UAPI_ASMS390_SIGNAL_H
8#define _UAPI_ASMS390_SIGNAL_H
9
10#include <linux/types.h>
11#include <linux/time.h>
12
13/* Avoid too many header ordering problems. */
14struct siginfo;
15struct pt_regs;
16
17#ifndef __KERNEL__
18/* Here we must cater to libcs that poke about in kernel headers. */
19
20#define NSIG 32
21typedef unsigned long sigset_t;
22
23#endif /* __KERNEL__ */
24
25#define SIGHUP 1
26#define SIGINT 2
27#define SIGQUIT 3
28#define SIGILL 4
29#define SIGTRAP 5
30#define SIGABRT 6
31#define SIGIOT 6
32#define SIGBUS 7
33#define SIGFPE 8
34#define SIGKILL 9
35#define SIGUSR1 10
36#define SIGSEGV 11
37#define SIGUSR2 12
38#define SIGPIPE 13
39#define SIGALRM 14
40#define SIGTERM 15
41#define SIGSTKFLT 16
42#define SIGCHLD 17
43#define SIGCONT 18
44#define SIGSTOP 19
45#define SIGTSTP 20
46#define SIGTTIN 21
47#define SIGTTOU 22
48#define SIGURG 23
49#define SIGXCPU 24
50#define SIGXFSZ 25
51#define SIGVTALRM 26
52#define SIGPROF 27
53#define SIGWINCH 28
54#define SIGIO 29
55#define SIGPOLL SIGIO
56/*
57#define SIGLOST 29
58*/
59#define SIGPWR 30
60#define SIGSYS 31
61#define SIGUNUSED 31
62
63/* These should not be considered constants from userland. */
64#define SIGRTMIN 32
65#define SIGRTMAX _NSIG
66
67/*
68 * SA_FLAGS values:
69 *
70 * SA_ONSTACK indicates that a registered stack_t will be used.
71 * SA_RESTART flag to get restarting signals (which were the default long ago)
72 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
73 * SA_RESETHAND clears the handler when the signal is delivered.
74 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
75 * SA_NODEFER prevents the current signal from being masked in the handler.
76 *
77 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
78 * Unix names RESETHAND and NODEFER respectively.
79 */
80#define SA_NOCLDSTOP 0x00000001
81#define SA_NOCLDWAIT 0x00000002
82#define SA_SIGINFO 0x00000004
83#define SA_ONSTACK 0x08000000
84#define SA_RESTART 0x10000000
85#define SA_NODEFER 0x40000000
86#define SA_RESETHAND 0x80000000
87
88#define SA_NOMASK SA_NODEFER
89#define SA_ONESHOT SA_RESETHAND
90
91#define SA_RESTORER 0x04000000
92
93/*
94 * sigaltstack controls
95 */
96#define SS_ONSTACK 1
97#define SS_DISABLE 2
98
99#define MINSIGSTKSZ 2048
100#define SIGSTKSZ 8192
101
102#include <asm-generic/signal-defs.h>
103
104#ifndef __KERNEL__
105/* Here we must cater to libcs that poke about in kernel headers. */
106
107struct sigaction {
108 union {
109 __sighandler_t _sa_handler;
110 void (*_sa_sigaction)(int, struct siginfo *, void *);
111 } _u;
112#ifndef __s390x__ /* lovely */
113 sigset_t sa_mask;
114 unsigned long sa_flags;
115 void (*sa_restorer)(void);
116#else /* __s390x__ */
117 unsigned long sa_flags;
118 void (*sa_restorer)(void);
119 sigset_t sa_mask;
120#endif /* __s390x__ */
121};
122
123#define sa_handler _u._sa_handler
124#define sa_sigaction _u._sa_sigaction
125
126#endif /* __KERNEL__ */
127
128typedef struct sigaltstack {
129 void __user *ss_sp;
130 int ss_flags;
131 size_t ss_size;
132} stack_t;
133
134
135#endif /* _UAPI_ASMS390_SIGNAL_H */
diff --git a/arch/s390/include/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
index 69718cd6d635..69718cd6d635 100644
--- a/arch/s390/include/asm/socket.h
+++ b/arch/s390/include/uapi/asm/socket.h
diff --git a/arch/s390/include/asm/sockios.h b/arch/s390/include/uapi/asm/sockios.h
index 6f60eee73242..6f60eee73242 100644
--- a/arch/s390/include/asm/sockios.h
+++ b/arch/s390/include/uapi/asm/sockios.h
diff --git a/arch/s390/include/asm/stat.h b/arch/s390/include/uapi/asm/stat.h
index b4ca97d91466..b4ca97d91466 100644
--- a/arch/s390/include/asm/stat.h
+++ b/arch/s390/include/uapi/asm/stat.h
diff --git a/arch/s390/include/asm/statfs.h b/arch/s390/include/uapi/asm/statfs.h
index 5acca0a34c20..5acca0a34c20 100644
--- a/arch/s390/include/asm/statfs.h
+++ b/arch/s390/include/uapi/asm/statfs.h
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/uapi/asm/swab.h
index da3bfe5cc161..da3bfe5cc161 100644
--- a/arch/s390/include/asm/swab.h
+++ b/arch/s390/include/uapi/asm/swab.h
diff --git a/arch/s390/include/asm/tape390.h b/arch/s390/include/uapi/asm/tape390.h
index b2bc4bab7929..b2bc4bab7929 100644
--- a/arch/s390/include/asm/tape390.h
+++ b/arch/s390/include/uapi/asm/tape390.h
diff --git a/arch/s390/include/asm/termbits.h b/arch/s390/include/uapi/asm/termbits.h
index 71bf6ac6a2b9..71bf6ac6a2b9 100644
--- a/arch/s390/include/asm/termbits.h
+++ b/arch/s390/include/uapi/asm/termbits.h
diff --git a/arch/s390/include/uapi/asm/termios.h b/arch/s390/include/uapi/asm/termios.h
new file mode 100644
index 000000000000..554f973db1e6
--- /dev/null
+++ b/arch/s390/include/uapi/asm/termios.h
@@ -0,0 +1,49 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/termios.h"
5 */
6
7#ifndef _UAPI_S390_TERMIOS_H
8#define _UAPI_S390_TERMIOS_H
9
10#include <asm/termbits.h>
11#include <asm/ioctls.h>
12
13struct winsize {
14 unsigned short ws_row;
15 unsigned short ws_col;
16 unsigned short ws_xpixel;
17 unsigned short ws_ypixel;
18};
19
20#define NCC 8
21struct termio {
22 unsigned short c_iflag; /* input mode flags */
23 unsigned short c_oflag; /* output mode flags */
24 unsigned short c_cflag; /* control mode flags */
25 unsigned short c_lflag; /* local mode flags */
26 unsigned char c_line; /* line discipline */
27 unsigned char c_cc[NCC]; /* control characters */
28};
29
30/* modem lines */
31#define TIOCM_LE 0x001
32#define TIOCM_DTR 0x002
33#define TIOCM_RTS 0x004
34#define TIOCM_ST 0x008
35#define TIOCM_SR 0x010
36#define TIOCM_CTS 0x020
37#define TIOCM_CAR 0x040
38#define TIOCM_RNG 0x080
39#define TIOCM_DSR 0x100
40#define TIOCM_CD TIOCM_CAR
41#define TIOCM_RI TIOCM_RNG
42#define TIOCM_OUT1 0x2000
43#define TIOCM_OUT2 0x4000
44#define TIOCM_LOOP 0x8000
45
46/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
47
48
49#endif /* _UAPI_S390_TERMIOS_H */
diff --git a/arch/s390/include/uapi/asm/types.h b/arch/s390/include/uapi/asm/types.h
new file mode 100644
index 000000000000..038f2b9178a4
--- /dev/null
+++ b/arch/s390/include/uapi/asm/types.h
@@ -0,0 +1,22 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/types.h"
5 */
6
7#ifndef _UAPI_S390_TYPES_H
8#define _UAPI_S390_TYPES_H
9
10#include <asm-generic/int-ll64.h>
11
12#ifndef __ASSEMBLY__
13
14/* A address type so that arithmetic can be done on it & it can be upgraded to
15 64 bit when necessary
16*/
17typedef unsigned long addr_t;
18typedef __signed__ long saddr_t;
19
20#endif /* __ASSEMBLY__ */
21
22#endif /* _UAPI_S390_TYPES_H */
diff --git a/arch/s390/include/asm/ucontext.h b/arch/s390/include/uapi/asm/ucontext.h
index 200e06325c6a..200e06325c6a 100644
--- a/arch/s390/include/asm/ucontext.h
+++ b/arch/s390/include/uapi/asm/ucontext.h
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
new file mode 100644
index 000000000000..63e6078699f1
--- /dev/null
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -0,0 +1,374 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/unistd.h"
5 */
6
7#ifndef _UAPI_ASM_S390_UNISTD_H_
8#define _UAPI_ASM_S390_UNISTD_H_
9
10/*
11 * This file contains the system call numbers.
12 */
13
14#define __NR_exit 1
15#define __NR_fork 2
16#define __NR_read 3
17#define __NR_write 4
18#define __NR_open 5
19#define __NR_close 6
20#define __NR_restart_syscall 7
21#define __NR_creat 8
22#define __NR_link 9
23#define __NR_unlink 10
24#define __NR_execve 11
25#define __NR_chdir 12
26#define __NR_mknod 14
27#define __NR_chmod 15
28#define __NR_lseek 19
29#define __NR_getpid 20
30#define __NR_mount 21
31#define __NR_umount 22
32#define __NR_ptrace 26
33#define __NR_alarm 27
34#define __NR_pause 29
35#define __NR_utime 30
36#define __NR_access 33
37#define __NR_nice 34
38#define __NR_sync 36
39#define __NR_kill 37
40#define __NR_rename 38
41#define __NR_mkdir 39
42#define __NR_rmdir 40
43#define __NR_dup 41
44#define __NR_pipe 42
45#define __NR_times 43
46#define __NR_brk 45
47#define __NR_signal 48
48#define __NR_acct 51
49#define __NR_umount2 52
50#define __NR_ioctl 54
51#define __NR_fcntl 55
52#define __NR_setpgid 57
53#define __NR_umask 60
54#define __NR_chroot 61
55#define __NR_ustat 62
56#define __NR_dup2 63
57#define __NR_getppid 64
58#define __NR_getpgrp 65
59#define __NR_setsid 66
60#define __NR_sigaction 67
61#define __NR_sigsuspend 72
62#define __NR_sigpending 73
63#define __NR_sethostname 74
64#define __NR_setrlimit 75
65#define __NR_getrusage 77
66#define __NR_gettimeofday 78
67#define __NR_settimeofday 79
68#define __NR_symlink 83
69#define __NR_readlink 85
70#define __NR_uselib 86
71#define __NR_swapon 87
72#define __NR_reboot 88
73#define __NR_readdir 89
74#define __NR_mmap 90
75#define __NR_munmap 91
76#define __NR_truncate 92
77#define __NR_ftruncate 93
78#define __NR_fchmod 94
79#define __NR_getpriority 96
80#define __NR_setpriority 97
81#define __NR_statfs 99
82#define __NR_fstatfs 100
83#define __NR_socketcall 102
84#define __NR_syslog 103
85#define __NR_setitimer 104
86#define __NR_getitimer 105
87#define __NR_stat 106
88#define __NR_lstat 107
89#define __NR_fstat 108
90#define __NR_lookup_dcookie 110
91#define __NR_vhangup 111
92#define __NR_idle 112
93#define __NR_wait4 114
94#define __NR_swapoff 115
95#define __NR_sysinfo 116
96#define __NR_ipc 117
97#define __NR_fsync 118
98#define __NR_sigreturn 119
99#define __NR_clone 120
100#define __NR_setdomainname 121
101#define __NR_uname 122
102#define __NR_adjtimex 124
103#define __NR_mprotect 125
104#define __NR_sigprocmask 126
105#define __NR_create_module 127
106#define __NR_init_module 128
107#define __NR_delete_module 129
108#define __NR_get_kernel_syms 130
109#define __NR_quotactl 131
110#define __NR_getpgid 132
111#define __NR_fchdir 133
112#define __NR_bdflush 134
113#define __NR_sysfs 135
114#define __NR_personality 136
115#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
116#define __NR_getdents 141
117#define __NR_flock 143
118#define __NR_msync 144
119#define __NR_readv 145
120#define __NR_writev 146
121#define __NR_getsid 147
122#define __NR_fdatasync 148
123#define __NR__sysctl 149
124#define __NR_mlock 150
125#define __NR_munlock 151
126#define __NR_mlockall 152
127#define __NR_munlockall 153
128#define __NR_sched_setparam 154
129#define __NR_sched_getparam 155
130#define __NR_sched_setscheduler 156
131#define __NR_sched_getscheduler 157
132#define __NR_sched_yield 158
133#define __NR_sched_get_priority_max 159
134#define __NR_sched_get_priority_min 160
135#define __NR_sched_rr_get_interval 161
136#define __NR_nanosleep 162
137#define __NR_mremap 163
138#define __NR_query_module 167
139#define __NR_poll 168
140#define __NR_nfsservctl 169
141#define __NR_prctl 172
142#define __NR_rt_sigreturn 173
143#define __NR_rt_sigaction 174
144#define __NR_rt_sigprocmask 175
145#define __NR_rt_sigpending 176
146#define __NR_rt_sigtimedwait 177
147#define __NR_rt_sigqueueinfo 178
148#define __NR_rt_sigsuspend 179
149#define __NR_pread64 180
150#define __NR_pwrite64 181
151#define __NR_getcwd 183
152#define __NR_capget 184
153#define __NR_capset 185
154#define __NR_sigaltstack 186
155#define __NR_sendfile 187
156#define __NR_getpmsg 188
157#define __NR_putpmsg 189
158#define __NR_vfork 190
159#define __NR_pivot_root 217
160#define __NR_mincore 218
161#define __NR_madvise 219
162#define __NR_getdents64 220
163#define __NR_readahead 222
164#define __NR_setxattr 224
165#define __NR_lsetxattr 225
166#define __NR_fsetxattr 226
167#define __NR_getxattr 227
168#define __NR_lgetxattr 228
169#define __NR_fgetxattr 229
170#define __NR_listxattr 230
171#define __NR_llistxattr 231
172#define __NR_flistxattr 232
173#define __NR_removexattr 233
174#define __NR_lremovexattr 234
175#define __NR_fremovexattr 235
176#define __NR_gettid 236
177#define __NR_tkill 237
178#define __NR_futex 238
179#define __NR_sched_setaffinity 239
180#define __NR_sched_getaffinity 240
181#define __NR_tgkill 241
182/* Number 242 is reserved for tux */
183#define __NR_io_setup 243
184#define __NR_io_destroy 244
185#define __NR_io_getevents 245
186#define __NR_io_submit 246
187#define __NR_io_cancel 247
188#define __NR_exit_group 248
189#define __NR_epoll_create 249
190#define __NR_epoll_ctl 250
191#define __NR_epoll_wait 251
192#define __NR_set_tid_address 252
193#define __NR_fadvise64 253
194#define __NR_timer_create 254
195#define __NR_timer_settime (__NR_timer_create+1)
196#define __NR_timer_gettime (__NR_timer_create+2)
197#define __NR_timer_getoverrun (__NR_timer_create+3)
198#define __NR_timer_delete (__NR_timer_create+4)
199#define __NR_clock_settime (__NR_timer_create+5)
200#define __NR_clock_gettime (__NR_timer_create+6)
201#define __NR_clock_getres (__NR_timer_create+7)
202#define __NR_clock_nanosleep (__NR_timer_create+8)
203/* Number 263 is reserved for vserver */
204#define __NR_statfs64 265
205#define __NR_fstatfs64 266
206#define __NR_remap_file_pages 267
207/* Number 268 is reserved for new sys_mbind */
208/* Number 269 is reserved for new sys_get_mempolicy */
209/* Number 270 is reserved for new sys_set_mempolicy */
210#define __NR_mq_open 271
211#define __NR_mq_unlink 272
212#define __NR_mq_timedsend 273
213#define __NR_mq_timedreceive 274
214#define __NR_mq_notify 275
215#define __NR_mq_getsetattr 276
216#define __NR_kexec_load 277
217#define __NR_add_key 278
218#define __NR_request_key 279
219#define __NR_keyctl 280
220#define __NR_waitid 281
221#define __NR_ioprio_set 282
222#define __NR_ioprio_get 283
223#define __NR_inotify_init 284
224#define __NR_inotify_add_watch 285
225#define __NR_inotify_rm_watch 286
226/* Number 287 is reserved for new sys_migrate_pages */
227#define __NR_openat 288
228#define __NR_mkdirat 289
229#define __NR_mknodat 290
230#define __NR_fchownat 291
231#define __NR_futimesat 292
232#define __NR_unlinkat 294
233#define __NR_renameat 295
234#define __NR_linkat 296
235#define __NR_symlinkat 297
236#define __NR_readlinkat 298
237#define __NR_fchmodat 299
238#define __NR_faccessat 300
239#define __NR_pselect6 301
240#define __NR_ppoll 302
241#define __NR_unshare 303
242#define __NR_set_robust_list 304
243#define __NR_get_robust_list 305
244#define __NR_splice 306
245#define __NR_sync_file_range 307
246#define __NR_tee 308
247#define __NR_vmsplice 309
248/* Number 310 is reserved for new sys_move_pages */
249#define __NR_getcpu 311
250#define __NR_epoll_pwait 312
251#define __NR_utimes 313
252#define __NR_fallocate 314
253#define __NR_utimensat 315
254#define __NR_signalfd 316
255#define __NR_timerfd 317
256#define __NR_eventfd 318
257#define __NR_timerfd_create 319
258#define __NR_timerfd_settime 320
259#define __NR_timerfd_gettime 321
260#define __NR_signalfd4 322
261#define __NR_eventfd2 323
262#define __NR_inotify_init1 324
263#define __NR_pipe2 325
264#define __NR_dup3 326
265#define __NR_epoll_create1 327
266#define __NR_preadv 328
267#define __NR_pwritev 329
268#define __NR_rt_tgsigqueueinfo 330
269#define __NR_perf_event_open 331
270#define __NR_fanotify_init 332
271#define __NR_fanotify_mark 333
272#define __NR_prlimit64 334
273#define __NR_name_to_handle_at 335
274#define __NR_open_by_handle_at 336
275#define __NR_clock_adjtime 337
276#define __NR_syncfs 338
277#define __NR_setns 339
278#define __NR_process_vm_readv 340
279#define __NR_process_vm_writev 341
280#define __NR_s390_runtime_instr 342
281#define __NR_kcmp 343
282#define NR_syscalls 344
283
284/*
285 * There are some system calls that are not present on 64 bit, some
286 * have a different name although they do the same (e.g. __NR_chown32
287 * is __NR_chown on 64 bit).
288 */
289#ifndef __s390x__
290
291#define __NR_time 13
292#define __NR_lchown 16
293#define __NR_setuid 23
294#define __NR_getuid 24
295#define __NR_stime 25
296#define __NR_setgid 46
297#define __NR_getgid 47
298#define __NR_geteuid 49
299#define __NR_getegid 50
300#define __NR_setreuid 70
301#define __NR_setregid 71
302#define __NR_getrlimit 76
303#define __NR_getgroups 80
304#define __NR_setgroups 81
305#define __NR_fchown 95
306#define __NR_ioperm 101
307#define __NR_setfsuid 138
308#define __NR_setfsgid 139
309#define __NR__llseek 140
310#define __NR__newselect 142
311#define __NR_setresuid 164
312#define __NR_getresuid 165
313#define __NR_setresgid 170
314#define __NR_getresgid 171
315#define __NR_chown 182
316#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
317#define __NR_mmap2 192
318#define __NR_truncate64 193
319#define __NR_ftruncate64 194
320#define __NR_stat64 195
321#define __NR_lstat64 196
322#define __NR_fstat64 197
323#define __NR_lchown32 198
324#define __NR_getuid32 199
325#define __NR_getgid32 200
326#define __NR_geteuid32 201
327#define __NR_getegid32 202
328#define __NR_setreuid32 203
329#define __NR_setregid32 204
330#define __NR_getgroups32 205
331#define __NR_setgroups32 206
332#define __NR_fchown32 207
333#define __NR_setresuid32 208
334#define __NR_getresuid32 209
335#define __NR_setresgid32 210
336#define __NR_getresgid32 211
337#define __NR_chown32 212
338#define __NR_setuid32 213
339#define __NR_setgid32 214
340#define __NR_setfsuid32 215
341#define __NR_setfsgid32 216
342#define __NR_fcntl64 221
343#define __NR_sendfile64 223
344#define __NR_fadvise64_64 264
345#define __NR_fstatat64 293
346
347#else
348
349#define __NR_select 142
350#define __NR_getrlimit 191 /* SuS compliant getrlimit */
351#define __NR_lchown 198
352#define __NR_getuid 199
353#define __NR_getgid 200
354#define __NR_geteuid 201
355#define __NR_getegid 202
356#define __NR_setreuid 203
357#define __NR_setregid 204
358#define __NR_getgroups 205
359#define __NR_setgroups 206
360#define __NR_fchown 207
361#define __NR_setresuid 208
362#define __NR_getresuid 209
363#define __NR_setresgid 210
364#define __NR_getresgid 211
365#define __NR_chown 212
366#define __NR_setuid 213
367#define __NR_setgid 214
368#define __NR_setfsuid 215
369#define __NR_setfsgid 216
370#define __NR_newfstatat 293
371
372#endif
373
374#endif /* _UAPI_ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/include/asm/vtoc.h b/arch/s390/include/uapi/asm/vtoc.h
index 221419de275e..221419de275e 100644
--- a/arch/s390/include/asm/vtoc.h
+++ b/arch/s390/include/uapi/asm/vtoc.h
diff --git a/arch/s390/include/asm/zcrypt.h b/arch/s390/include/uapi/asm/zcrypt.h
index e83fc116f5bf..e83fc116f5bf 100644
--- a/arch/s390/include/asm/zcrypt.h
+++ b/arch/s390/include/uapi/asm/zcrypt.h
diff --git a/arch/s390/kernel/cache.c b/arch/s390/kernel/cache.c
index 8df8d8a19c98..64b24650e4f8 100644
--- a/arch/s390/kernel/cache.c
+++ b/arch/s390/kernel/cache.c
@@ -59,8 +59,8 @@ enum {
59 59
60enum { 60enum {
61 CACHE_TI_UNIFIED = 0, 61 CACHE_TI_UNIFIED = 0,
62 CACHE_TI_INSTRUCTION = 0, 62 CACHE_TI_DATA = 0,
63 CACHE_TI_DATA, 63 CACHE_TI_INSTRUCTION,
64}; 64};
65 65
66struct cache_info { 66struct cache_info {
@@ -121,7 +121,10 @@ static int __init cache_add(int level, int private, int type)
121 cache = kzalloc(sizeof(*cache), GFP_KERNEL); 121 cache = kzalloc(sizeof(*cache), GFP_KERNEL);
122 if (!cache) 122 if (!cache)
123 return -ENOMEM; 123 return -ENOMEM;
124 ti = type == CACHE_TYPE_DATA ? CACHE_TI_DATA : CACHE_TI_UNIFIED; 124 if (type == CACHE_TYPE_INSTRUCTION)
125 ti = CACHE_TI_INSTRUCTION;
126 else
127 ti = CACHE_TI_UNIFIED;
125 cache->size = ecag(EXTRACT_SIZE, level, ti); 128 cache->size = ecag(EXTRACT_SIZE, level, ti);
126 cache->line_size = ecag(EXTRACT_LINE_SIZE, level, ti); 129 cache->line_size = ecag(EXTRACT_LINE_SIZE, level, ti);
127 cache->associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti); 130 cache->associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti);
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 189963c90c6e..65cca95843e1 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -432,32 +432,6 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
432 return ret; 432 return ret;
433} 433}
434 434
435/*
436 * sys32_execve() executes a new program after the asm stub has set
437 * things up for us. This should basically do what I want it to.
438 */
439asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
440 compat_uptr_t __user *envp)
441{
442 struct pt_regs *regs = task_pt_regs(current);
443 char *filename;
444 long rc;
445
446 filename = getname(name);
447 rc = PTR_ERR(filename);
448 if (IS_ERR(filename))
449 return rc;
450 rc = compat_do_execve(filename, argv, envp, regs);
451 if (rc)
452 goto out;
453 current->thread.fp_regs.fpc=0;
454 asm volatile("sfpc %0,0" : : "d" (0));
455 rc = regs->gprs[2];
456out:
457 putname(filename);
458 return rc;
459}
460
461asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 435asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
462 size_t count, u32 poshi, u32 poslo) 436 size_t count, u32 poshi, u32 poslo)
463{ 437{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 9635d759c2b9..d4d0239970ac 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -23,74 +23,6 @@ struct old_sigaction32 {
23 __u32 sa_flags; 23 __u32 sa_flags;
24 __u32 sa_restorer; /* Another 32 bit pointer */ 24 __u32 sa_restorer; /* Another 32 bit pointer */
25}; 25};
26
27typedef struct compat_siginfo {
28 int si_signo;
29 int si_errno;
30 int si_code;
31
32 union {
33 int _pad[((128/sizeof(int)) - 3)];
34
35 /* kill() */
36 struct {
37 pid_t _pid; /* sender's pid */
38 uid_t _uid; /* sender's uid */
39 } _kill;
40
41 /* POSIX.1b timers */
42 struct {
43 compat_timer_t _tid; /* timer id */
44 int _overrun; /* overrun count */
45 compat_sigval_t _sigval; /* same as below */
46 int _sys_private; /* not to be passed to user */
47 } _timer;
48
49 /* POSIX.1b signals */
50 struct {
51 pid_t _pid; /* sender's pid */
52 uid_t _uid; /* sender's uid */
53 compat_sigval_t _sigval;
54 } _rt;
55
56 /* SIGCHLD */
57 struct {
58 pid_t _pid; /* which child */
59 uid_t _uid; /* sender's uid */
60 int _status;/* exit code */
61 compat_clock_t _utime;
62 compat_clock_t _stime;
63 } _sigchld;
64
65 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
66 struct {
67 __u32 _addr; /* faulting insn/memory ref. - pointer */
68 } _sigfault;
69
70 /* SIGPOLL */
71 struct {
72 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
73 int _fd;
74 } _sigpoll;
75 } _sifields;
76} compat_siginfo_t;
77
78/*
79 * How these fields are to be accessed.
80 */
81#define si_pid _sifields._kill._pid
82#define si_uid _sifields._kill._uid
83#define si_status _sifields._sigchld._status
84#define si_utime _sifields._sigchld._utime
85#define si_stime _sifields._sigchld._stime
86#define si_value _sifields._rt._sigval
87#define si_int _sifields._rt._sigval.sival_int
88#define si_ptr _sifields._rt._sigval.sival_ptr
89#define si_addr _sifields._sigfault._addr
90#define si_band _sifields._sigpoll._band
91#define si_fd _sifields._sigpoll._fd
92#define si_tid _sifields._timer._tid
93#define si_overrun _sifields._timer._overrun
94 26
95/* asm/sigcontext.h */ 27/* asm/sigcontext.h */
96typedef union 28typedef union
@@ -193,8 +125,6 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
193 compat_sigset_t __user *oset, size_t sigsetsize); 125 compat_sigset_t __user *oset, size_t sigsetsize);
194long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize); 126long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
195long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo); 127long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
196long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
197 compat_uptr_t __user *envp);
198long sys32_init_module(void __user *umod, unsigned long len, 128long sys32_init_module(void __user *umod, unsigned long len,
199 const char __user *uargs); 129 const char __user *uargs);
200long sys32_delete_module(const char __user *name_user, unsigned int flags); 130long sys32_delete_module(const char __user *name_user, unsigned int flags);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 3afba804fe97..ad79b846535c 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1576,7 +1576,7 @@ ENTRY(sys32_execve_wrapper)
1576 llgtr %r2,%r2 # char * 1576 llgtr %r2,%r2 # char *
1577 llgtr %r3,%r3 # compat_uptr_t * 1577 llgtr %r3,%r3 # compat_uptr_t *
1578 llgtr %r4,%r4 # compat_uptr_t * 1578 llgtr %r4,%r4 # compat_uptr_t *
1579 jg sys32_execve # branch to system call 1579 jg compat_sys_execve # branch to system call
1580 1580
1581ENTRY(sys_fanotify_init_wrapper) 1581ENTRY(sys_fanotify_init_wrapper)
1582 llgfr %r2,%r2 # unsigned int 1582 llgfr %r2,%r2 # unsigned int
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 7f4717675c19..1f0eee9e7daa 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -283,14 +283,6 @@ static noinline __init void setup_facility_list(void)
283 ARRAY_SIZE(S390_lowcore.stfle_fac_list)); 283 ARRAY_SIZE(S390_lowcore.stfle_fac_list));
284} 284}
285 285
286static noinline __init void setup_hpage(void)
287{
288 if (!test_facility(2) || !test_facility(8))
289 return;
290 S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE;
291 __ctl_set_bit(0, 23);
292}
293
294static __init void detect_mvpg(void) 286static __init void detect_mvpg(void)
295{ 287{
296#ifndef CONFIG_64BIT 288#ifndef CONFIG_64BIT
@@ -378,16 +370,22 @@ static __init void detect_diag44(void)
378static __init void detect_machine_facilities(void) 370static __init void detect_machine_facilities(void)
379{ 371{
380#ifdef CONFIG_64BIT 372#ifdef CONFIG_64BIT
373 if (test_facility(8)) {
374 S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT1;
375 __ctl_set_bit(0, 23);
376 }
377 if (test_facility(78))
378 S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT2;
381 if (test_facility(3)) 379 if (test_facility(3))
382 S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; 380 S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE;
383 if (test_facility(8))
384 S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF;
385 if (test_facility(27)) 381 if (test_facility(27))
386 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; 382 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
387 if (test_facility(40)) 383 if (test_facility(40))
388 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; 384 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP;
389 if (test_facility(50) && test_facility(73)) 385 if (test_facility(50) && test_facility(73))
390 S390_lowcore.machine_flags |= MACHINE_FLAG_TE; 386 S390_lowcore.machine_flags |= MACHINE_FLAG_TE;
387 if (test_facility(66))
388 S390_lowcore.machine_flags |= MACHINE_FLAG_RRBM;
391#endif 389#endif
392} 390}
393 391
@@ -482,7 +480,6 @@ void __init startup_init(void)
482 detect_diag9c(); 480 detect_diag9c();
483 detect_diag44(); 481 detect_diag44();
484 detect_machine_facilities(); 482 detect_machine_facilities();
485 setup_hpage();
486 setup_topology(); 483 setup_topology();
487 sclp_facilities_detect(); 484 sclp_facilities_detect();
488 detect_memory_layout(memory_chunk); 485 detect_memory_layout(memory_chunk);
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 870bad6d56fc..ef46f66bc0d6 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -331,45 +331,38 @@ ENTRY(ret_from_fork)
331 l %r12,__LC_THREAD_INFO 331 l %r12,__LC_THREAD_INFO
332 l %r13,__LC_SVC_NEW_PSW+4 332 l %r13,__LC_SVC_NEW_PSW+4
333 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? 333 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
334 jo 0f 334 je 1f
335 st %r15,__PT_R15(%r11) # store stack pointer for new kthread 335 l %r1,BASED(.Lschedule_tail)
3360: l %r1,BASED(.Lschedule_tail)
337 basr %r14,%r1 # call schedule_tail 336 basr %r14,%r1 # call schedule_tail
338 TRACE_IRQS_ON 337 TRACE_IRQS_ON
339 ssm __LC_SVC_NEW_PSW # reenable interrupts 338 ssm __LC_SVC_NEW_PSW # reenable interrupts
340 j sysc_tracenogo 339 j sysc_tracenogo
341 340
3411: # it's a kernel thread
342 st %r15,__PT_R15(%r11) # store stack pointer for new kthread
343 l %r1,BASED(.Lschedule_tail)
344 basr %r14,%r1 # call schedule_tail
345 TRACE_IRQS_ON
346 ssm __LC_SVC_NEW_PSW # reenable interrupts
347 lm %r9,%r11,__PT_R9(%r11) # load gprs
348ENTRY(kernel_thread_starter)
349 la %r2,0(%r10)
350 basr %r14,%r9
351 la %r2,0
352 br %r11 # do_exit
353
342# 354#
343# kernel_execve function needs to deal with pt_regs that is not 355# kernel_execve function needs to deal with pt_regs that is not
344# at the usual place 356# at the usual place
345# 357#
346ENTRY(kernel_execve) 358ENTRY(ret_from_kernel_execve)
347 stm %r12,%r15,48(%r15) 359 ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts
348 lr %r14,%r15 360 lr %r15,%r2
349 l %r13,__LC_SVC_NEW_PSW+4 361 lr %r11,%r2
350 ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 362 ahi %r15,-STACK_FRAME_OVERHEAD
351 st %r14,__SF_BACKCHAIN(%r15)
352 la %r12,STACK_FRAME_OVERHEAD(%r15)
353 xc 0(__PT_SIZE,%r12),0(%r12)
354 l %r1,BASED(.Ldo_execve)
355 lr %r5,%r12
356 basr %r14,%r1 # call do_execve
357 ltr %r2,%r2
358 je 0f
359 ahi %r15,(STACK_FRAME_OVERHEAD + __PT_SIZE)
360 lm %r12,%r15,48(%r15)
361 br %r14
362 # execve succeeded.
3630: ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts
364 l %r15,__LC_KERNEL_STACK # load ksp
365 ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
366 la %r11,STACK_FRAME_OVERHEAD(%r15)
367 mvc 0(__PT_SIZE,%r11),0(%r12) # copy pt_regs
368 l %r12,__LC_THREAD_INFO
369 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 363 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
364 l %r12,__LC_THREAD_INFO
370 ssm __LC_SVC_NEW_PSW # reenable interrupts 365 ssm __LC_SVC_NEW_PSW # reenable interrupts
371 l %r1,BASED(.Lexecve_tail)
372 basr %r14,%r1 # call execve_tail
373 j sysc_return 366 j sysc_return
374 367
375/* 368/*
@@ -931,8 +924,6 @@ cleanup_idle_wait:
931.Ldo_signal: .long do_signal 924.Ldo_signal: .long do_signal
932.Ldo_notify_resume: .long do_notify_resume 925.Ldo_notify_resume: .long do_notify_resume
933.Ldo_per_trap: .long do_per_trap 926.Ldo_per_trap: .long do_per_trap
934.Ldo_execve: .long do_execve
935.Lexecve_tail: .long execve_tail
936.Ljump_table: .long pgm_check_table 927.Ljump_table: .long pgm_check_table
937.Lschedule: .long schedule 928.Lschedule: .long schedule
938#ifdef CONFIG_PREEMPT 929#ifdef CONFIG_PREEMPT
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index a5f4dc42a5db..d0d3f69a7346 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -58,9 +58,6 @@ long sys_fork(void);
58long sys_clone(unsigned long newsp, unsigned long clone_flags, 58long sys_clone(unsigned long newsp, unsigned long clone_flags,
59 int __user *parent_tidptr, int __user *child_tidptr); 59 int __user *parent_tidptr, int __user *child_tidptr);
60long sys_vfork(void); 60long sys_vfork(void);
61void execve_tail(void);
62long sys_execve(const char __user *name, const char __user *const __user *argv,
63 const char __user *const __user *envp);
64long sys_sigsuspend(int history0, int history1, old_sigset_t mask); 61long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
65long sys_sigaction(int sig, const struct old_sigaction __user *act, 62long sys_sigaction(int sig, const struct old_sigaction __user *act,
66 struct old_sigaction __user *oact); 63 struct old_sigaction __user *oact);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 7549985402f7..07d8de353984 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -295,7 +295,7 @@ sysc_sigpending:
295 jno sysc_return 295 jno sysc_return
296 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments 296 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments
297 lghi %r8,0 # svc 0 returns -ENOSYS 297 lghi %r8,0 # svc 0 returns -ENOSYS
298 lh %r1,__PT_INT_CODE+2(%r11) # load new svc number 298 llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number
299 cghi %r1,NR_syscalls 299 cghi %r1,NR_syscalls
300 jnl sysc_nr_ok # invalid svc number -> do svc 0 300 jnl sysc_nr_ok # invalid svc number -> do svc 0
301 slag %r8,%r1,2 301 slag %r8,%r1,2
@@ -353,41 +353,31 @@ ENTRY(ret_from_fork)
353 la %r11,STACK_FRAME_OVERHEAD(%r15) 353 la %r11,STACK_FRAME_OVERHEAD(%r15)
354 lg %r12,__LC_THREAD_INFO 354 lg %r12,__LC_THREAD_INFO
355 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? 355 tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
356 jo 0f 356 je 1f
357 stg %r15,__PT_R15(%r11) # store stack pointer for new kthread 357 brasl %r14,schedule_tail
3580: brasl %r14,schedule_tail
359 TRACE_IRQS_ON 358 TRACE_IRQS_ON
360 ssm __LC_SVC_NEW_PSW # reenable interrupts 359 ssm __LC_SVC_NEW_PSW # reenable interrupts
361 j sysc_tracenogo 360 j sysc_tracenogo
362 3611: # it's a kernel thread
363# 362 stg %r15,__PT_R15(%r11) # store stack pointer for new kthread
364# kernel_execve function needs to deal with pt_regs that is not 363 brasl %r14,schedule_tail
365# at the usual place 364 TRACE_IRQS_ON
366# 365 ssm __LC_SVC_NEW_PSW # reenable interrupts
367ENTRY(kernel_execve) 366 lmg %r9,%r11,__PT_R9(%r11) # load gprs
368 stmg %r12,%r15,96(%r15) 367ENTRY(kernel_thread_starter)
369 lgr %r14,%r15 368 la %r2,0(%r10)
370 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 369 basr %r14,%r9
371 stg %r14,__SF_BACKCHAIN(%r15) 370 la %r2,0
372 la %r12,STACK_FRAME_OVERHEAD(%r15) 371 br %r11 # do_exit
373 xc 0(__PT_SIZE,%r12),0(%r12) 372
374 lgr %r5,%r12 373ENTRY(ret_from_kernel_execve)
375 brasl %r14,do_execve 374 ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts
376 ltgfr %r2,%r2 375 lgr %r15,%r2
377 je 0f 376 lgr %r11,%r2
378 aghi %r15,(STACK_FRAME_OVERHEAD + __PT_SIZE) 377 aghi %r15,-STACK_FRAME_OVERHEAD
379 lmg %r12,%r15,96(%r15)
380 br %r14
381 # execve succeeded.
3820: ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts
383 lg %r15,__LC_KERNEL_STACK # load ksp
384 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
385 la %r11,STACK_FRAME_OVERHEAD(%r15)
386 mvc 0(__PT_SIZE,%r11),0(%r12) # copy pt_regs
387 lg %r12,__LC_THREAD_INFO
388 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 378 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
379 lg %r12,__LC_THREAD_INFO
389 ssm __LC_SVC_NEW_PSW # reenable interrupts 380 ssm __LC_SVC_NEW_PSW # reenable interrupts
390 brasl %r14,execve_tail
391 j sysc_return 381 j sysc_return
392 382
393/* 383/*
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 805b6686b641..984726cbce16 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -52,7 +52,7 @@ __HEAD
52 .long 0x02000370,0x60000050 # the channel program the PSW 52 .long 0x02000370,0x60000050 # the channel program the PSW
53 .long 0x020003c0,0x60000050 # at location 0 is loaded. 53 .long 0x020003c0,0x60000050 # at location 0 is loaded.
54 .long 0x02000410,0x60000050 # Initial processing starts 54 .long 0x02000410,0x60000050 # Initial processing starts
55 .long 0x02000460,0x60000050 # at 0xf0 = iplstart. 55 .long 0x02000460,0x60000050 # at 0x200 = iplstart.
56 .long 0x020004b0,0x60000050 56 .long 0x020004b0,0x60000050
57 .long 0x02000500,0x60000050 57 .long 0x02000500,0x60000050
58 .long 0x02000550,0x60000050 58 .long 0x02000550,0x60000050
@@ -62,11 +62,54 @@ __HEAD
62 .long 0x02000690,0x60000050 62 .long 0x02000690,0x60000050
63 .long 0x020006e0,0x20000050 63 .long 0x020006e0,0x20000050
64 64
65 .org 0xf0 65 .org 0x200
66#
67# subroutine to set architecture mode
68#
69.Lsetmode:
70#ifdef CONFIG_64BIT
71 mvi __LC_AR_MODE_ID,1 # set esame flag
72 slr %r0,%r0 # set cpuid to zero
73 lhi %r1,2 # mode 2 = esame (dump)
74 sigp %r1,%r0,0x12 # switch to esame mode
75 bras %r13,0f
76 .fill 16,4,0x0
770: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
78 sam31 # switch to 31 bit addressing mode
79#else
80 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
81#endif
82 br %r14
83
84#
85# subroutine to wait for end I/O
86#
87.Lirqwait:
88#ifdef CONFIG_64BIT
89 mvc 0x1f0(16),.Lnewpsw # set up IO interrupt psw
90 lpsw .Lwaitpsw
91.Lioint:
92 br %r14
93 .align 8
94.Lnewpsw:
95 .quad 0x0000000080000000,.Lioint
96#else
97 mvc 0x78(8),.Lnewpsw # set up IO interrupt psw
98 lpsw .Lwaitpsw
99.Lioint:
100 br %r14
101 .align 8
102.Lnewpsw:
103 .long 0x00080000,0x80000000+.Lioint
104#endif
105.Lwaitpsw:
106 .long 0x020a0000,0x80000000+.Lioint
107
66# 108#
67# subroutine for loading cards from the reader 109# subroutine for loading cards from the reader
68# 110#
69.Lloader: 111.Lloader:
112 la %r4,0(%r14)
70 la %r3,.Lorb # r2 = address of orb into r2 113 la %r3,.Lorb # r2 = address of orb into r2
71 la %r5,.Lirb # r4 = address of irb 114 la %r5,.Lirb # r4 = address of irb
72 la %r6,.Lccws 115 la %r6,.Lccws
@@ -83,9 +126,7 @@ __HEAD
83 ssch 0(%r3) # load chunk of 1600 bytes 126 ssch 0(%r3) # load chunk of 1600 bytes
84 bnz .Llderr 127 bnz .Llderr
85.Lwait4irq: 128.Lwait4irq:
86 mvc 0x78(8),.Lnewpsw # set up IO interrupt psw 129 bas %r14,.Lirqwait
87 lpsw .Lwaitpsw
88.Lioint:
89 c %r1,0xb8 # compare subchannel number 130 c %r1,0xb8 # compare subchannel number
90 bne .Lwait4irq 131 bne .Lwait4irq
91 tsch 0(%r5) 132 tsch 0(%r5)
@@ -104,7 +145,7 @@ __HEAD
104 sr %r0,%r3 # #ccws*80-residual=#bytes read 145 sr %r0,%r3 # #ccws*80-residual=#bytes read
105 ar %r2,%r0 146 ar %r2,%r0
106 147
107 br %r14 # r2 contains the total size 148 br %r4 # r2 contains the total size
108 149
109.Lcont: 150.Lcont:
110 ahi %r2,0x640 # add 0x640 to total size 151 ahi %r2,0x640 # add 0x640 to total size
@@ -128,10 +169,6 @@ __HEAD
128.Lloadp:.long 0,0 169.Lloadp:.long 0,0
129 .align 8 170 .align 8
130.Lcrash:.long 0x000a0000,0x00000000 171.Lcrash:.long 0x000a0000,0x00000000
131.Lnewpsw:
132 .long 0x00080000,0x80000000+.Lioint
133.Lwaitpsw:
134 .long 0x020a0000,0x80000000+.Lioint
135 172
136 .align 8 173 .align 8
137.Lccws: .rept 19 174.Lccws: .rept 19
@@ -140,6 +177,7 @@ __HEAD
140 .long 0x02200050,0x00000000 177 .long 0x02200050,0x00000000
141 178
142iplstart: 179iplstart:
180 bas %r14,.Lsetmode # Immediately switch to 64 bit mode
143 lh %r1,0xb8 # test if subchannel number 181 lh %r1,0xb8 # test if subchannel number
144 bct %r1,.Lnoload # is valid 182 bct %r1,.Lnoload # is valid
145 l %r1,0xb8 # load ipl subchannel number 183 l %r1,0xb8 # load ipl subchannel number
@@ -209,8 +247,8 @@ iplstart:
209# 247#
210# reset files in VM reader 248# reset files in VM reader
211# 249#
212 stidp __LC_SAVE_AREA_SYNC # store cpuid 250 stidp .Lcpuid # store cpuid
213 tm __LC_SAVE_AREA_SYNC,0xff# running VM ? 251 tm .Lcpuid,0xff # running VM ?
214 bno .Lnoreset 252 bno .Lnoreset
215 la %r2,.Lreset 253 la %r2,.Lreset
216 lhi %r3,26 254 lhi %r3,26
@@ -222,23 +260,14 @@ iplstart:
222 tm 31(%r5),0xff # bits is set in the schib 260 tm 31(%r5),0xff # bits is set in the schib
223 bz .Lnoreset 261 bz .Lnoreset
224.Lwaitforirq: 262.Lwaitforirq:
225 mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw 263 bas %r14,.Lirqwait # wait for IO interrupt
226.Lwaitrdrirq:
227 lpsw .Lrdrwaitpsw
228.Lrdrint:
229 c %r1,0xb8 # compare subchannel number 264 c %r1,0xb8 # compare subchannel number
230 bne .Lwaitrdrirq 265 bne .Lwaitforirq
231 la %r5,.Lirb 266 la %r5,.Lirb
232 tsch 0(%r5) 267 tsch 0(%r5)
233.Lnoreset: 268.Lnoreset:
234 b .Lnoload 269 b .Lnoload
235 270
236 .align 8
237.Lrdrnewpsw:
238 .long 0x00080000,0x80000000+.Lrdrint
239.Lrdrwaitpsw:
240 .long 0x020a0000,0x80000000+.Lrdrint
241
242# 271#
243# everything loaded, go for it 272# everything loaded, go for it
244# 273#
@@ -254,6 +283,8 @@ iplstart:
254 .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" 283 .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold"
255.L_eof: .long 0xc5d6c600 /* C'EOF' */ 284.L_eof: .long 0xc5d6c600 /* C'EOF' */
256.L_hdr: .long 0xc8c4d900 /* C'HDR' */ 285.L_hdr: .long 0xc8c4d900 /* C'HDR' */
286 .align 8
287.Lcpuid:.fill 8,1,0
257 288
258# 289#
259# SALIPL loader support. Based on a patch by Rob van der Heij. 290# SALIPL loader support. Based on a patch by Rob van der Heij.
@@ -263,6 +294,7 @@ iplstart:
263 .org 0x800 294 .org 0x800
264ENTRY(start) 295ENTRY(start)
265 stm %r0,%r15,0x07b0 # store registers 296 stm %r0,%r15,0x07b0 # store registers
297 bas %r14,.Lsetmode # Immediately switch to 64 bit mode
266 basr %r12,%r0 298 basr %r12,%r0
267.base: 299.base:
268 l %r11,.parm 300 l %r11,.parm
@@ -343,6 +375,18 @@ ENTRY(startup)
343ENTRY(startup_kdump) 375ENTRY(startup_kdump)
344 j .Lep_startup_kdump 376 j .Lep_startup_kdump
345.Lep_startup_normal: 377.Lep_startup_normal:
378#ifdef CONFIG_64BIT
379 mvi __LC_AR_MODE_ID,1 # set esame flag
380 slr %r0,%r0 # set cpuid to zero
381 lhi %r1,2 # mode 2 = esame (dump)
382 sigp %r1,%r0,0x12 # switch to esame mode
383 bras %r13,0f
384 .fill 16,4,0x0
3850: lmh %r0,%r15,0(%r13) # clear high-order half of gprs
386 sam31 # switch to 31 bit addressing mode
387#else
388 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
389#endif
346 basr %r13,0 # get base 390 basr %r13,0 # get base
347.LPG0: 391.LPG0:
348 xc 0x200(256),0x200 # partially clear lowcore 392 xc 0x200(256),0x200 # partially clear lowcore
@@ -410,22 +454,17 @@ ENTRY(startup_kdump)
410#endif 454#endif
411 455
412#ifdef CONFIG_64BIT 456#ifdef CONFIG_64BIT
413 mvi __LC_AR_MODE_ID,1 # set esame flag 457 /* Continue with 64bit startup code in head64.S */
414 slr %r0,%r0 # set cpuid to zero
415 lhi %r1,2 # mode 2 = esame (dump)
416 sigp %r1,%r0,0x12 # switch to esame mode
417 sam64 # switch to 64 bit mode 458 sam64 # switch to 64 bit mode
418 larl %r13,4f
419 lmh %r0,%r15,0(%r13) # clear high-order half
420 jg startup_continue 459 jg startup_continue
4214: .fill 16,4,0x0
422#else 460#else
423 mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) 461 /* Continue with 31bit startup code in head31.S */
424 l %r13,4f-.LPG0(%r13) 462 l %r13,4f-.LPG0(%r13)
425 b 0(%r13) 463 b 0(%r13)
426 .align 8 464 .align 8
4274: .long startup_continue 4654: .long startup_continue
428#endif 466#endif
467
429 .align 8 468 .align 8
4305: .long 0x7fffffff,0xffffffff 4695: .long 0x7fffffff,0xffffffff
431 470
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index a1372ae24ae1..9a99856df1c9 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -78,10 +78,7 @@ ENTRY(startup_continue)
78 78
79ENTRY(_ehead) 79ENTRY(_ehead)
80 80
81#ifdef CONFIG_SHARED_KERNEL
82 .org 0x100000 - 0x11000 # head.o ends at 0x11000 81 .org 0x100000 - 0x11000 # head.o ends at 0x11000
83#endif
84
85# 82#
86# startup-code, running in absolute addressing mode 83# startup-code, running in absolute addressing mode
87# 84#
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index c108af28bbe8..b9e25ae2579c 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -76,10 +76,7 @@ ENTRY(startup_continue)
76 76
77ENTRY(_ehead) 77ENTRY(_ehead)
78 78
79#ifdef CONFIG_SHARED_KERNEL
80 .org 0x100000 - 0x11000 # head.o ends at 0x11000 79 .org 0x100000 - 0x11000 # head.o ends at 0x11000
81#endif
82
83# 80#
84# startup-code, running in absolute addressing mode 81# startup-code, running in absolute addressing mode
85# 82#
diff --git a/arch/s390/kernel/head_kdump.S b/arch/s390/kernel/head_kdump.S
index acaaaf4b7055..085a95eb315f 100644
--- a/arch/s390/kernel/head_kdump.S
+++ b/arch/s390/kernel/head_kdump.S
@@ -85,16 +85,10 @@
85.align 2 85.align 2
86startup_kdump_relocated: 86startup_kdump_relocated:
87 basr %r13,0 87 basr %r13,0
880: 880: lpswe .Lrestart_psw-0b(%r13) # Start new kernel...
89 mvc 0(8,%r0),.Lrestart_psw-0b(%r13) # Setup restart PSW
90 sam31 # Switch to 31 bit addr mode
91 sr %r1,%r1 # Erase register r1
92 sr %r2,%r2 # Erase register r2
93 sigp %r1,%r2,SIGP_SET_ARCHITECTURE # Switch to 31 bit arch mode
94 lpsw 0 # Start new kernel...
95.align 8 89.align 8
96.Lrestart_psw: 90.Lrestart_psw:
97 .long 0x00080000,0x80000000 + startup 91 .quad 0x0000000080000000,0x0000000000000000 + startup
98#else 92#else
99.align 2 93.align 2
100.Lep_startup_kdump: 94.Lep_startup_kdump:
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 46412b1d7e1e..4610deafd953 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -44,6 +44,17 @@
44#define PLT_ENTRY_SIZE 20 44#define PLT_ENTRY_SIZE 20
45#endif /* CONFIG_64BIT */ 45#endif /* CONFIG_64BIT */
46 46
47#ifdef CONFIG_64BIT
48void *module_alloc(unsigned long size)
49{
50 if (PAGE_ALIGN(size) > MODULES_LEN)
51 return NULL;
52 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
53 GFP_KERNEL, PAGE_KERNEL, -1,
54 __builtin_return_address(0));
55}
56#endif
57
47/* Free memory returned from module_alloc */ 58/* Free memory returned from module_alloc */
48void module_free(struct module *mod, void *module_region) 59void module_free(struct module *mod, void *module_region)
49{ 60{
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 9871b1971ed7..c4e7269d4a09 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -94,7 +94,7 @@ static int get_counter_set(u64 event)
94 set = CPUMF_CTR_SET_USER; 94 set = CPUMF_CTR_SET_USER;
95 else if (event < 128) 95 else if (event < 128)
96 set = CPUMF_CTR_SET_CRYPTO; 96 set = CPUMF_CTR_SET_CRYPTO;
97 else if (event < 160) 97 else if (event < 256)
98 set = CPUMF_CTR_SET_EXT; 98 set = CPUMF_CTR_SET_EXT;
99 99
100 return set; 100 return set;
@@ -138,6 +138,10 @@ static int validate_ctr_version(const struct hw_perf_event *hwc)
138 case CPUMF_CTR_SET_EXT: 138 case CPUMF_CTR_SET_EXT:
139 if (cpuhw->info.csvn < 1) 139 if (cpuhw->info.csvn < 1)
140 err = -EOPNOTSUPP; 140 err = -EOPNOTSUPP;
141 if ((cpuhw->info.csvn == 1 && hwc->config > 159) ||
142 (cpuhw->info.csvn == 2 && hwc->config > 175) ||
143 (cpuhw->info.csvn > 2 && hwc->config > 255))
144 err = -EOPNOTSUPP;
141 break; 145 break;
142 } 146 }
143 147
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 5024be27df44..cd31ad457a9b 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -100,35 +100,6 @@ void cpu_idle(void)
100 100
101extern void __kprobes kernel_thread_starter(void); 101extern void __kprobes kernel_thread_starter(void);
102 102
103asm(
104 ".section .kprobes.text, \"ax\"\n"
105 ".global kernel_thread_starter\n"
106 "kernel_thread_starter:\n"
107 " la 2,0(10)\n"
108 " basr 14,9\n"
109 " la 2,0\n"
110 " br 11\n"
111 ".previous\n");
112
113int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
114{
115 struct pt_regs regs;
116
117 memset(&regs, 0, sizeof(regs));
118 regs.psw.mask = psw_kernel_bits |
119 PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
120 regs.psw.addr = (unsigned long) kernel_thread_starter | PSW_ADDR_AMODE;
121 regs.gprs[9] = (unsigned long) fn;
122 regs.gprs[10] = (unsigned long) arg;
123 regs.gprs[11] = (unsigned long) do_exit;
124 regs.orig_gpr2 = -1;
125
126 /* Ok, create the new process.. */
127 return do_fork(flags | CLONE_VM | CLONE_UNTRACED,
128 0, &regs, 0, NULL, NULL);
129}
130EXPORT_SYMBOL(kernel_thread);
131
132/* 103/*
133 * Free current thread data structures etc.. 104 * Free current thread data structures etc..
134 */ 105 */
@@ -146,7 +117,7 @@ void release_thread(struct task_struct *dead_task)
146} 117}
147 118
148int copy_thread(unsigned long clone_flags, unsigned long new_stackp, 119int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
149 unsigned long unused, 120 unsigned long arg,
150 struct task_struct *p, struct pt_regs *regs) 121 struct task_struct *p, struct pt_regs *regs)
151{ 122{
152 struct thread_info *ti; 123 struct thread_info *ti;
@@ -158,20 +129,44 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
158 129
159 frame = container_of(task_pt_regs(p), struct fake_frame, childregs); 130 frame = container_of(task_pt_regs(p), struct fake_frame, childregs);
160 p->thread.ksp = (unsigned long) frame; 131 p->thread.ksp = (unsigned long) frame;
161 /* Store access registers to kernel stack of new process. */ 132 /* Save access registers to new thread structure. */
162 frame->childregs = *regs; 133 save_access_regs(&p->thread.acrs[0]);
163 frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */ 134 /* start new process with ar4 pointing to the correct address space */
164 frame->childregs.gprs[15] = new_stackp; 135 p->thread.mm_segment = get_fs();
165 frame->sf.back_chain = 0; 136 /* Don't copy debug registers */
137 memset(&p->thread.per_user, 0, sizeof(p->thread.per_user));
138 memset(&p->thread.per_event, 0, sizeof(p->thread.per_event));
139 clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
140 clear_tsk_thread_flag(p, TIF_PER_TRAP);
141 /* Initialize per thread user and system timer values */
142 ti = task_thread_info(p);
143 ti->user_timer = 0;
144 ti->system_timer = 0;
166 145
146 frame->sf.back_chain = 0;
167 /* new return point is ret_from_fork */ 147 /* new return point is ret_from_fork */
168 frame->sf.gprs[8] = (unsigned long) ret_from_fork; 148 frame->sf.gprs[8] = (unsigned long) ret_from_fork;
169
170 /* fake return stack for resume(), don't go back to schedule */ 149 /* fake return stack for resume(), don't go back to schedule */
171 frame->sf.gprs[9] = (unsigned long) frame; 150 frame->sf.gprs[9] = (unsigned long) frame;
172 151
173 /* Save access registers to new thread structure. */ 152 /* Store access registers to kernel stack of new process. */
174 save_access_regs(&p->thread.acrs[0]); 153 if (unlikely(!regs)) {
154 /* kernel thread */
155 memset(&frame->childregs, 0, sizeof(struct pt_regs));
156 frame->childregs.psw.mask = psw_kernel_bits | PSW_MASK_DAT |
157 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
158 frame->childregs.psw.addr = PSW_ADDR_AMODE |
159 (unsigned long) kernel_thread_starter;
160 frame->childregs.gprs[9] = new_stackp; /* function */
161 frame->childregs.gprs[10] = arg;
162 frame->childregs.gprs[11] = (unsigned long) do_exit;
163 frame->childregs.orig_gpr2 = -1;
164
165 return 0;
166 }
167 frame->childregs = *regs;
168 frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */
169 frame->childregs.gprs[15] = new_stackp;
175 170
176 /* Don't copy runtime instrumentation info */ 171 /* Don't copy runtime instrumentation info */
177 p->thread.ri_cb = NULL; 172 p->thread.ri_cb = NULL;
@@ -202,17 +197,6 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
202 } 197 }
203 } 198 }
204#endif /* CONFIG_64BIT */ 199#endif /* CONFIG_64BIT */
205 /* start new process with ar4 pointing to the correct address space */
206 p->thread.mm_segment = get_fs();
207 /* Don't copy debug registers */
208 memset(&p->thread.per_user, 0, sizeof(p->thread.per_user));
209 memset(&p->thread.per_event, 0, sizeof(p->thread.per_event));
210 clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
211 clear_tsk_thread_flag(p, TIF_PER_TRAP);
212 /* Initialize per thread user and system timer values */
213 ti = task_thread_info(p);
214 ti->user_timer = 0;
215 ti->system_timer = 0;
216 return 0; 200 return 0;
217} 201}
218 202
@@ -258,31 +242,6 @@ asmlinkage void execve_tail(void)
258} 242}
259 243
260/* 244/*
261 * sys_execve() executes a new program.
262 */
263SYSCALL_DEFINE3(execve, const char __user *, name,
264 const char __user *const __user *, argv,
265 const char __user *const __user *, envp)
266{
267 struct pt_regs *regs = task_pt_regs(current);
268 char *filename;
269 long rc;
270
271 filename = getname(name);
272 rc = PTR_ERR(filename);
273 if (IS_ERR(filename))
274 return rc;
275 rc = do_execve(filename, argv, envp, regs);
276 if (rc)
277 goto out;
278 execve_tail();
279 rc = regs->gprs[2];
280out:
281 putname(filename);
282 return rc;
283}
284
285/*
286 * fill in the FPU structure for a core dump. 245 * fill in the FPU structure for a core dump.
287 */ 246 */
288int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs) 247int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index afa9fdba200e..b1f2be9aaaad 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -105,6 +105,11 @@ EXPORT_SYMBOL(VMALLOC_END);
105struct page *vmemmap; 105struct page *vmemmap;
106EXPORT_SYMBOL(vmemmap); 106EXPORT_SYMBOL(vmemmap);
107 107
108#ifdef CONFIG_64BIT
109unsigned long MODULES_VADDR;
110unsigned long MODULES_END;
111#endif
112
108/* An array with a pointer to the lowcore of every CPU. */ 113/* An array with a pointer to the lowcore of every CPU. */
109struct _lowcore *lowcore_ptr[NR_CPUS]; 114struct _lowcore *lowcore_ptr[NR_CPUS];
110EXPORT_SYMBOL(lowcore_ptr); 115EXPORT_SYMBOL(lowcore_ptr);
@@ -544,19 +549,23 @@ static void __init setup_memory_end(void)
544 549
545 /* Choose kernel address space layout: 2, 3, or 4 levels. */ 550 /* Choose kernel address space layout: 2, 3, or 4 levels. */
546#ifdef CONFIG_64BIT 551#ifdef CONFIG_64BIT
547 vmalloc_size = VMALLOC_END ?: 128UL << 30; 552 vmalloc_size = VMALLOC_END ?: (128UL << 30) - MODULES_LEN;
548 tmp = (memory_end ?: real_memory_size) / PAGE_SIZE; 553 tmp = (memory_end ?: real_memory_size) / PAGE_SIZE;
549 tmp = tmp * (sizeof(struct page) + PAGE_SIZE) + vmalloc_size; 554 tmp = tmp * (sizeof(struct page) + PAGE_SIZE) + vmalloc_size;
550 if (tmp <= (1UL << 42)) 555 if (tmp <= (1UL << 42))
551 vmax = 1UL << 42; /* 3-level kernel page table */ 556 vmax = 1UL << 42; /* 3-level kernel page table */
552 else 557 else
553 vmax = 1UL << 53; /* 4-level kernel page table */ 558 vmax = 1UL << 53; /* 4-level kernel page table */
559 /* module area is at the end of the kernel address space. */
560 MODULES_END = vmax;
561 MODULES_VADDR = MODULES_END - MODULES_LEN;
562 VMALLOC_END = MODULES_VADDR;
554#else 563#else
555 vmalloc_size = VMALLOC_END ?: 96UL << 20; 564 vmalloc_size = VMALLOC_END ?: 96UL << 20;
556 vmax = 1UL << 31; /* 2-level kernel page table */ 565 vmax = 1UL << 31; /* 2-level kernel page table */
557#endif
558 /* vmalloc area is at the end of the kernel address space. */ 566 /* vmalloc area is at the end of the kernel address space. */
559 VMALLOC_END = vmax; 567 VMALLOC_END = vmax;
568#endif
560 VMALLOC_START = vmax - vmalloc_size; 569 VMALLOC_START = vmax - vmalloc_size;
561 570
562 /* Split remaining virtual space between 1:1 mapping & vmemmap array */ 571 /* Split remaining virtual space between 1:1 mapping & vmemmap array */
@@ -768,6 +777,40 @@ static void __init reserve_crashkernel(void)
768#endif 777#endif
769} 778}
770 779
780static void __init init_storage_keys(unsigned long start, unsigned long end)
781{
782 unsigned long boundary, function, size;
783
784 while (start < end) {
785 if (MACHINE_HAS_EDAT2) {
786 /* set storage keys for a 2GB frame */
787 function = 0x22000 | PAGE_DEFAULT_KEY;
788 size = 1UL << 31;
789 boundary = (start + size) & ~(size - 1);
790 if (boundary <= end) {
791 do {
792 start = pfmf(function, start);
793 } while (start < boundary);
794 continue;
795 }
796 }
797 if (MACHINE_HAS_EDAT1) {
798 /* set storage keys for a 1MB frame */
799 function = 0x21000 | PAGE_DEFAULT_KEY;
800 size = 1UL << 20;
801 boundary = (start + size) & ~(size - 1);
802 if (boundary <= end) {
803 do {
804 start = pfmf(function, start);
805 } while (start < boundary);
806 continue;
807 }
808 }
809 page_set_storage_key(start, PAGE_DEFAULT_KEY, 0);
810 start += PAGE_SIZE;
811 }
812}
813
771static void __init setup_memory(void) 814static void __init setup_memory(void)
772{ 815{
773 unsigned long bootmap_size; 816 unsigned long bootmap_size;
@@ -846,9 +889,7 @@ static void __init setup_memory(void)
846 memblock_add_node(PFN_PHYS(start_chunk), 889 memblock_add_node(PFN_PHYS(start_chunk),
847 PFN_PHYS(end_chunk - start_chunk), 0); 890 PFN_PHYS(end_chunk - start_chunk), 0);
848 pfn = max(start_chunk, start_pfn); 891 pfn = max(start_chunk, start_pfn);
849 for (; pfn < end_chunk; pfn++) 892 init_storage_keys(PFN_PHYS(pfn), PFN_PHYS(end_chunk));
850 page_set_storage_key(PFN_PHYS(pfn),
851 PAGE_DEFAULT_KEY, 0);
852 } 893 }
853 894
854 psw_set_key(PAGE_DEFAULT_KEY); 895 psw_set_key(PAGE_DEFAULT_KEY);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 2db1011b8b19..7fcd690d42c7 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -34,7 +34,7 @@
34#include <linux/profile.h> 34#include <linux/profile.h>
35#include <linux/timex.h> 35#include <linux/timex.h>
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/clocksource.h> 37#include <linux/timekeeper_internal.h>
38#include <linux/clockchips.h> 38#include <linux/clockchips.h>
39#include <linux/gfp.h> 39#include <linux/gfp.h>
40#include <linux/kprobes.h> 40#include <linux/kprobes.h>
@@ -219,7 +219,7 @@ struct clocksource * __init clocksource_default_clock(void)
219 return &clocksource_tod; 219 return &clocksource_tod;
220} 220}
221 221
222void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, 222void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm,
223 struct clocksource *clock, u32 mult) 223 struct clocksource *clock, u32 mult)
224{ 224{
225 if (clock != &clocksource_tod) 225 if (clock != &clocksource_tod)
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index de8fa9bbd35e..79cb51adc741 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -8,7 +8,7 @@
8 8
9#ifndef CONFIG_64BIT 9#ifndef CONFIG_64BIT
10OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") 10OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
11OUTPUT_ARCH(s390) 11OUTPUT_ARCH(s390:31-bit)
12ENTRY(startup) 12ENTRY(startup)
13jiffies = jiffies_64 + 4; 13jiffies = jiffies_64 + 4;
14#else 14#else
diff --git a/arch/s390/mm/Makefile b/arch/s390/mm/Makefile
index 0f5536b0c1a1..1bea6d1f55ab 100644
--- a/arch/s390/mm/Makefile
+++ b/arch/s390/mm/Makefile
@@ -7,3 +7,4 @@ obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o maccess.o \
7obj-$(CONFIG_CMM) += cmm.o 7obj-$(CONFIG_CMM) += cmm.o
8obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 8obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
9obj-$(CONFIG_DEBUG_SET_MODULE_RONX) += pageattr.o 9obj-$(CONFIG_DEBUG_SET_MODULE_RONX) += pageattr.o
10obj-$(CONFIG_S390_PTDUMP) += dump_pagetables.o
diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c
new file mode 100644
index 000000000000..cbc6668acb85
--- /dev/null
+++ b/arch/s390/mm/dump_pagetables.c
@@ -0,0 +1,226 @@
1#include <linux/seq_file.h>
2#include <linux/debugfs.h>
3#include <linux/module.h>
4#include <linux/mm.h>
5#include <asm/sections.h>
6#include <asm/pgtable.h>
7
8static unsigned long max_addr;
9
10struct addr_marker {
11 unsigned long start_address;
12 const char *name;
13};
14
15enum address_markers_idx {
16 IDENTITY_NR = 0,
17 KERNEL_START_NR,
18 KERNEL_END_NR,
19 VMEMMAP_NR,
20 VMALLOC_NR,
21#ifdef CONFIG_64BIT
22 MODULES_NR,
23#endif
24};
25
26static struct addr_marker address_markers[] = {
27 [IDENTITY_NR] = {0, "Identity Mapping"},
28 [KERNEL_START_NR] = {(unsigned long)&_stext, "Kernel Image Start"},
29 [KERNEL_END_NR] = {(unsigned long)&_end, "Kernel Image End"},
30 [VMEMMAP_NR] = {0, "vmemmap Area"},
31 [VMALLOC_NR] = {0, "vmalloc Area"},
32#ifdef CONFIG_64BIT
33 [MODULES_NR] = {0, "Modules Area"},
34#endif
35 { -1, NULL }
36};
37
38struct pg_state {
39 int level;
40 unsigned int current_prot;
41 unsigned long start_address;
42 unsigned long current_address;
43 const struct addr_marker *marker;
44};
45
46static void print_prot(struct seq_file *m, unsigned int pr, int level)
47{
48 static const char * const level_name[] =
49 { "ASCE", "PGD", "PUD", "PMD", "PTE" };
50
51 seq_printf(m, "%s ", level_name[level]);
52 if (pr & _PAGE_INVALID)
53 seq_printf(m, "I\n");
54 else
55 seq_printf(m, "%s\n", pr & _PAGE_RO ? "RO" : "RW");
56}
57
58static void note_page(struct seq_file *m, struct pg_state *st,
59 unsigned int new_prot, int level)
60{
61 static const char units[] = "KMGTPE";
62 int width = sizeof(unsigned long) * 2;
63 const char *unit = units;
64 unsigned int prot, cur;
65 unsigned long delta;
66
67 /*
68 * If we have a "break" in the series, we need to flush the state
69 * that we have now. "break" is either changing perms, levels or
70 * address space marker.
71 */
72 prot = new_prot;
73 cur = st->current_prot;
74
75 if (!st->level) {
76 /* First entry */
77 st->current_prot = new_prot;
78 st->level = level;
79 st->marker = address_markers;
80 seq_printf(m, "---[ %s ]---\n", st->marker->name);
81 } else if (prot != cur || level != st->level ||
82 st->current_address >= st->marker[1].start_address) {
83 /* Print the actual finished series */
84 seq_printf(m, "0x%0*lx-0x%0*lx",
85 width, st->start_address,
86 width, st->current_address);
87 delta = (st->current_address - st->start_address) >> 10;
88 while (!(delta & 0x3ff) && unit[1]) {
89 delta >>= 10;
90 unit++;
91 }
92 seq_printf(m, "%9lu%c ", delta, *unit);
93 print_prot(m, st->current_prot, st->level);
94 if (st->current_address >= st->marker[1].start_address) {
95 st->marker++;
96 seq_printf(m, "---[ %s ]---\n", st->marker->name);
97 }
98 st->start_address = st->current_address;
99 st->current_prot = new_prot;
100 st->level = level;
101 }
102}
103
104/*
105 * The actual page table walker functions. In order to keep the implementation
106 * of print_prot() short, we only check and pass _PAGE_INVALID and _PAGE_RO
107 * flags to note_page() if a region, segment or page table entry is invalid or
108 * read-only.
109 * After all it's just a hint that the current level being walked contains an
110 * invalid or read-only entry.
111 */
112static void walk_pte_level(struct seq_file *m, struct pg_state *st,
113 pmd_t *pmd, unsigned long addr)
114{
115 unsigned int prot;
116 pte_t *pte;
117 int i;
118
119 for (i = 0; i < PTRS_PER_PTE && addr < max_addr; i++) {
120 st->current_address = addr;
121 pte = pte_offset_kernel(pmd, addr);
122 prot = pte_val(*pte) & (_PAGE_RO | _PAGE_INVALID);
123 note_page(m, st, prot, 4);
124 addr += PAGE_SIZE;
125 }
126}
127
128static void walk_pmd_level(struct seq_file *m, struct pg_state *st,
129 pud_t *pud, unsigned long addr)
130{
131 unsigned int prot;
132 pmd_t *pmd;
133 int i;
134
135 for (i = 0; i < PTRS_PER_PMD && addr < max_addr; i++) {
136 st->current_address = addr;
137 pmd = pmd_offset(pud, addr);
138 if (!pmd_none(*pmd)) {
139 if (pmd_large(*pmd)) {
140 prot = pmd_val(*pmd) & _SEGMENT_ENTRY_RO;
141 note_page(m, st, prot, 3);
142 } else
143 walk_pte_level(m, st, pmd, addr);
144 } else
145 note_page(m, st, _PAGE_INVALID, 3);
146 addr += PMD_SIZE;
147 }
148}
149
150static void walk_pud_level(struct seq_file *m, struct pg_state *st,
151 pgd_t *pgd, unsigned long addr)
152{
153 pud_t *pud;
154 int i;
155
156 for (i = 0; i < PTRS_PER_PUD && addr < max_addr; i++) {
157 st->current_address = addr;
158 pud = pud_offset(pgd, addr);
159 if (!pud_none(*pud))
160 walk_pmd_level(m, st, pud, addr);
161 else
162 note_page(m, st, _PAGE_INVALID, 2);
163 addr += PUD_SIZE;
164 }
165}
166
167static void walk_pgd_level(struct seq_file *m)
168{
169 unsigned long addr = 0;
170 struct pg_state st;
171 pgd_t *pgd;
172 int i;
173
174 memset(&st, 0, sizeof(st));
175 for (i = 0; i < PTRS_PER_PGD && addr < max_addr; i++) {
176 st.current_address = addr;
177 pgd = pgd_offset_k(addr);
178 if (!pgd_none(*pgd))
179 walk_pud_level(m, &st, pgd, addr);
180 else
181 note_page(m, &st, _PAGE_INVALID, 1);
182 addr += PGDIR_SIZE;
183 }
184 /* Flush out the last page */
185 st.current_address = max_addr;
186 note_page(m, &st, 0, 0);
187}
188
189static int ptdump_show(struct seq_file *m, void *v)
190{
191 walk_pgd_level(m);
192 return 0;
193}
194
195static int ptdump_open(struct inode *inode, struct file *filp)
196{
197 return single_open(filp, ptdump_show, NULL);
198}
199
200static const struct file_operations ptdump_fops = {
201 .open = ptdump_open,
202 .read = seq_read,
203 .llseek = seq_lseek,
204 .release = single_release,
205};
206
207static int pt_dump_init(void)
208{
209 /*
210 * Figure out the maximum virtual address being accessible with the
211 * kernel ASCE. We need this to keep the page table walker functions
212 * from accessing non-existent entries.
213 */
214#ifdef CONFIG_32BIT
215 max_addr = 1UL << 31;
216#else
217 max_addr = (S390_lowcore.kernel_asce & _REGION_ENTRY_TYPE_MASK) >> 2;
218 max_addr = 1UL << (max_addr * 11 + 31);
219 address_markers[MODULES_NR].start_address = MODULES_VADDR;
220#endif
221 address_markers[VMEMMAP_NR].start_address = (unsigned long) vmemmap;
222 address_markers[VMALLOC_NR].start_address = VMALLOC_START;
223 debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, &ptdump_fops);
224 return 0;
225}
226device_initcall(pt_dump_init);
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index ac9122ca1152..04ad4001a289 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -367,6 +367,7 @@ retry:
367 /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk 367 /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
368 * of starvation. */ 368 * of starvation. */
369 flags &= ~FAULT_FLAG_ALLOW_RETRY; 369 flags &= ~FAULT_FLAG_ALLOW_RETRY;
370 flags |= FAULT_FLAG_TRIED;
370 down_read(&mm->mmap_sem); 371 down_read(&mm->mmap_sem);
371 goto retry; 372 goto retry;
372 } 373 }
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index eeaf8023851f..60acb93a4680 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -115,7 +115,16 @@ static inline int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr,
115 pmd = *pmdp; 115 pmd = *pmdp;
116 barrier(); 116 barrier();
117 next = pmd_addr_end(addr, end); 117 next = pmd_addr_end(addr, end);
118 if (pmd_none(pmd)) 118 /*
119 * The pmd_trans_splitting() check below explains why
120 * pmdp_splitting_flush() has to serialize with
121 * smp_call_function() against our disabled IRQs, to stop
122 * this gup-fast code from running while we set the
123 * splitting bit in the pmd. Returning zero will take
124 * the slow path that will call wait_split_huge_page()
125 * if the pmd is still in splitting state.
126 */
127 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
119 return 0; 128 return 0;
120 if (unlikely(pmd_huge(pmd))) { 129 if (unlikely(pmd_huge(pmd))) {
121 if (!gup_huge_pmd(pmdp, pmd, addr, next, 130 if (!gup_huge_pmd(pmdp, pmd, addr, next,
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index b36537a5f43e..00be01c4b4f3 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -8,25 +8,38 @@
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9#include <asm/pgtable.h> 9#include <asm/pgtable.h>
10 10
11static pte_t *walk_page_table(unsigned long addr)
12{
13 pgd_t *pgdp;
14 pud_t *pudp;
15 pmd_t *pmdp;
16 pte_t *ptep;
17
18 pgdp = pgd_offset_k(addr);
19 if (pgd_none(*pgdp))
20 return NULL;
21 pudp = pud_offset(pgdp, addr);
22 if (pud_none(*pudp))
23 return NULL;
24 pmdp = pmd_offset(pudp, addr);
25 if (pmd_none(*pmdp) || pmd_large(*pmdp))
26 return NULL;
27 ptep = pte_offset_kernel(pmdp, addr);
28 if (pte_none(*ptep))
29 return NULL;
30 return ptep;
31}
32
11static void change_page_attr(unsigned long addr, int numpages, 33static void change_page_attr(unsigned long addr, int numpages,
12 pte_t (*set) (pte_t)) 34 pte_t (*set) (pte_t))
13{ 35{
14 pte_t *ptep, pte; 36 pte_t *ptep, pte;
15 pmd_t *pmdp;
16 pud_t *pudp;
17 pgd_t *pgdp;
18 int i; 37 int i;
19 38
20 for (i = 0; i < numpages; i++) { 39 for (i = 0; i < numpages; i++) {
21 pgdp = pgd_offset(&init_mm, addr); 40 ptep = walk_page_table(addr);
22 pudp = pud_offset(pgdp, addr); 41 if (WARN_ON_ONCE(!ptep))
23 pmdp = pmd_offset(pudp, addr); 42 break;
24 if (pmd_huge(*pmdp)) {
25 WARN_ON_ONCE(1);
26 continue;
27 }
28 ptep = pte_offset_kernel(pmdp, addr);
29
30 pte = *ptep; 43 pte = *ptep;
31 pte = set(pte); 44 pte = set(pte);
32 __ptep_ipte(addr, ptep); 45 __ptep_ipte(addr, ptep);
@@ -40,21 +53,18 @@ int set_memory_ro(unsigned long addr, int numpages)
40 change_page_attr(addr, numpages, pte_wrprotect); 53 change_page_attr(addr, numpages, pte_wrprotect);
41 return 0; 54 return 0;
42} 55}
43EXPORT_SYMBOL_GPL(set_memory_ro);
44 56
45int set_memory_rw(unsigned long addr, int numpages) 57int set_memory_rw(unsigned long addr, int numpages)
46{ 58{
47 change_page_attr(addr, numpages, pte_mkwrite); 59 change_page_attr(addr, numpages, pte_mkwrite);
48 return 0; 60 return 0;
49} 61}
50EXPORT_SYMBOL_GPL(set_memory_rw);
51 62
52/* not possible */ 63/* not possible */
53int set_memory_nx(unsigned long addr, int numpages) 64int set_memory_nx(unsigned long addr, int numpages)
54{ 65{
55 return 0; 66 return 0;
56} 67}
57EXPORT_SYMBOL_GPL(set_memory_nx);
58 68
59int set_memory_x(unsigned long addr, int numpages) 69int set_memory_x(unsigned long addr, int numpages)
60{ 70{
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index b402991e43d7..c8188a18af05 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -787,6 +787,30 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table)
787 tlb_table_flush(tlb); 787 tlb_table_flush(tlb);
788} 788}
789 789
790#ifdef CONFIG_TRANSPARENT_HUGEPAGE
791void thp_split_vma(struct vm_area_struct *vma)
792{
793 unsigned long addr;
794 struct page *page;
795
796 for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) {
797 page = follow_page(vma, addr, FOLL_SPLIT);
798 }
799}
800
801void thp_split_mm(struct mm_struct *mm)
802{
803 struct vm_area_struct *vma = mm->mmap;
804
805 while (vma != NULL) {
806 thp_split_vma(vma);
807 vma->vm_flags &= ~VM_HUGEPAGE;
808 vma->vm_flags |= VM_NOHUGEPAGE;
809 vma = vma->vm_next;
810 }
811}
812#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
813
790/* 814/*
791 * switch on pgstes for its userspace process (for kvm) 815 * switch on pgstes for its userspace process (for kvm)
792 */ 816 */
@@ -824,6 +848,12 @@ int s390_enable_sie(void)
824 if (!mm) 848 if (!mm)
825 return -ENOMEM; 849 return -ENOMEM;
826 850
851#ifdef CONFIG_TRANSPARENT_HUGEPAGE
852 /* split thp mappings and disable thp for future mappings */
853 thp_split_mm(mm);
854 mm->def_flags |= VM_NOHUGEPAGE;
855#endif
856
827 /* Now lets check again if something happened */ 857 /* Now lets check again if something happened */
828 task_lock(tsk); 858 task_lock(tsk);
829 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 || 859 if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
@@ -866,3 +896,81 @@ bool kernel_page_present(struct page *page)
866 return cc == 0; 896 return cc == 0;
867} 897}
868#endif /* CONFIG_HIBERNATION && CONFIG_DEBUG_PAGEALLOC */ 898#endif /* CONFIG_HIBERNATION && CONFIG_DEBUG_PAGEALLOC */
899
900#ifdef CONFIG_TRANSPARENT_HUGEPAGE
901int pmdp_clear_flush_young(struct vm_area_struct *vma, unsigned long address,
902 pmd_t *pmdp)
903{
904 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
905 /* No need to flush TLB
906 * On s390 reference bits are in storage key and never in TLB */
907 return pmdp_test_and_clear_young(vma, address, pmdp);
908}
909
910int pmdp_set_access_flags(struct vm_area_struct *vma,
911 unsigned long address, pmd_t *pmdp,
912 pmd_t entry, int dirty)
913{
914 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
915
916 if (pmd_same(*pmdp, entry))
917 return 0;
918 pmdp_invalidate(vma, address, pmdp);
919 set_pmd_at(vma->vm_mm, address, pmdp, entry);
920 return 1;
921}
922
923static void pmdp_splitting_flush_sync(void *arg)
924{
925 /* Simply deliver the interrupt */
926}
927
928void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
929 pmd_t *pmdp)
930{
931 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
932 if (!test_and_set_bit(_SEGMENT_ENTRY_SPLIT_BIT,
933 (unsigned long *) pmdp)) {
934 /* need to serialize against gup-fast (IRQ disabled) */
935 smp_call_function(pmdp_splitting_flush_sync, NULL, 1);
936 }
937}
938
939void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable)
940{
941 struct list_head *lh = (struct list_head *) pgtable;
942
943 assert_spin_locked(&mm->page_table_lock);
944
945 /* FIFO */
946 if (!mm->pmd_huge_pte)
947 INIT_LIST_HEAD(lh);
948 else
949 list_add(lh, (struct list_head *) mm->pmd_huge_pte);
950 mm->pmd_huge_pte = pgtable;
951}
952
953pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm)
954{
955 struct list_head *lh;
956 pgtable_t pgtable;
957 pte_t *ptep;
958
959 assert_spin_locked(&mm->page_table_lock);
960
961 /* FIFO */
962 pgtable = mm->pmd_huge_pte;
963 lh = (struct list_head *) pgtable;
964 if (list_empty(lh))
965 mm->pmd_huge_pte = NULL;
966 else {
967 mm->pmd_huge_pte = (pgtable_t) lh->next;
968 list_del(lh);
969 }
970 ptep = (pte_t *) pgtable;
971 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
972 ptep++;
973 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
974 return pgtable;
975}
976#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index c22abf900c9e..387c7c60b5b8 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -79,7 +79,8 @@ static pte_t __ref *vmem_pte_alloc(unsigned long address)
79 */ 79 */
80static int vmem_add_mem(unsigned long start, unsigned long size, int ro) 80static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
81{ 81{
82 unsigned long address; 82 unsigned long end = start + size;
83 unsigned long address = start;
83 pgd_t *pg_dir; 84 pgd_t *pg_dir;
84 pud_t *pu_dir; 85 pud_t *pu_dir;
85 pmd_t *pm_dir; 86 pmd_t *pm_dir;
@@ -87,7 +88,7 @@ static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
87 pte_t pte; 88 pte_t pte;
88 int ret = -ENOMEM; 89 int ret = -ENOMEM;
89 90
90 for (address = start; address < start + size; address += PAGE_SIZE) { 91 while (address < end) {
91 pg_dir = pgd_offset_k(address); 92 pg_dir = pgd_offset_k(address);
92 if (pgd_none(*pg_dir)) { 93 if (pgd_none(*pg_dir)) {
93 pu_dir = vmem_pud_alloc(); 94 pu_dir = vmem_pud_alloc();
@@ -108,12 +109,11 @@ static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
108 pm_dir = pmd_offset(pu_dir, address); 109 pm_dir = pmd_offset(pu_dir, address);
109 110
110#if defined(CONFIG_64BIT) && !defined(CONFIG_DEBUG_PAGEALLOC) 111#if defined(CONFIG_64BIT) && !defined(CONFIG_DEBUG_PAGEALLOC)
111 if (MACHINE_HAS_HPAGE && !(address & ~HPAGE_MASK) && 112 if (MACHINE_HAS_EDAT1 && pmd_none(*pm_dir) && address &&
112 (address + HPAGE_SIZE <= start + size) && 113 !(address & ~PMD_MASK) && (address + PMD_SIZE <= end)) {
113 (address >= HPAGE_SIZE)) {
114 pte_val(pte) |= _SEGMENT_ENTRY_LARGE; 114 pte_val(pte) |= _SEGMENT_ENTRY_LARGE;
115 pmd_val(*pm_dir) = pte_val(pte); 115 pmd_val(*pm_dir) = pte_val(pte);
116 address += HPAGE_SIZE - PAGE_SIZE; 116 address += PMD_SIZE;
117 continue; 117 continue;
118 } 118 }
119#endif 119#endif
@@ -126,10 +126,11 @@ static int vmem_add_mem(unsigned long start, unsigned long size, int ro)
126 126
127 pt_dir = pte_offset_kernel(pm_dir, address); 127 pt_dir = pte_offset_kernel(pm_dir, address);
128 *pt_dir = pte; 128 *pt_dir = pte;
129 address += PAGE_SIZE;
129 } 130 }
130 ret = 0; 131 ret = 0;
131out: 132out:
132 flush_tlb_kernel_range(start, start + size); 133 flush_tlb_kernel_range(start, end);
133 return ret; 134 return ret;
134} 135}
135 136
@@ -139,7 +140,8 @@ out:
139 */ 140 */
140static void vmem_remove_range(unsigned long start, unsigned long size) 141static void vmem_remove_range(unsigned long start, unsigned long size)
141{ 142{
142 unsigned long address; 143 unsigned long end = start + size;
144 unsigned long address = start;
143 pgd_t *pg_dir; 145 pgd_t *pg_dir;
144 pud_t *pu_dir; 146 pud_t *pu_dir;
145 pmd_t *pm_dir; 147 pmd_t *pm_dir;
@@ -147,25 +149,32 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
147 pte_t pte; 149 pte_t pte;
148 150
149 pte_val(pte) = _PAGE_TYPE_EMPTY; 151 pte_val(pte) = _PAGE_TYPE_EMPTY;
150 for (address = start; address < start + size; address += PAGE_SIZE) { 152 while (address < end) {
151 pg_dir = pgd_offset_k(address); 153 pg_dir = pgd_offset_k(address);
154 if (pgd_none(*pg_dir)) {
155 address += PGDIR_SIZE;
156 continue;
157 }
152 pu_dir = pud_offset(pg_dir, address); 158 pu_dir = pud_offset(pg_dir, address);
153 if (pud_none(*pu_dir)) 159 if (pud_none(*pu_dir)) {
160 address += PUD_SIZE;
154 continue; 161 continue;
162 }
155 pm_dir = pmd_offset(pu_dir, address); 163 pm_dir = pmd_offset(pu_dir, address);
156 if (pmd_none(*pm_dir)) 164 if (pmd_none(*pm_dir)) {
165 address += PMD_SIZE;
157 continue; 166 continue;
158 167 }
159 if (pmd_huge(*pm_dir)) { 168 if (pmd_large(*pm_dir)) {
160 pmd_clear(pm_dir); 169 pmd_clear(pm_dir);
161 address += HPAGE_SIZE - PAGE_SIZE; 170 address += PMD_SIZE;
162 continue; 171 continue;
163 } 172 }
164
165 pt_dir = pte_offset_kernel(pm_dir, address); 173 pt_dir = pte_offset_kernel(pm_dir, address);
166 *pt_dir = pte; 174 *pt_dir = pte;
175 address += PAGE_SIZE;
167 } 176 }
168 flush_tlb_kernel_range(start, start + size); 177 flush_tlb_kernel_range(start, end);
169} 178}
170 179
171/* 180/*
@@ -330,8 +339,8 @@ void __init vmem_map_init(void)
330 unsigned long start, end; 339 unsigned long start, end;
331 int i; 340 int i;
332 341
333 ro_start = ((unsigned long)&_stext) & PAGE_MASK; 342 ro_start = PFN_ALIGN((unsigned long)&_stext);
334 ro_end = PFN_ALIGN((unsigned long)&_eshared); 343 ro_end = (unsigned long)&_eshared & PAGE_MASK;
335 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 344 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
336 if (memory_chunk[i].type == CHUNK_CRASHK || 345 if (memory_chunk[i].type == CHUNK_CRASHK ||
337 memory_chunk[i].type == CHUNK_OLDMEM) 346 memory_chunk[i].type == CHUNK_OLDMEM)