aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-10 06:48:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-10 06:48:33 -0400
commite1b28147f684af67bfac989756c27c19859d3d4e (patch)
tree11b09d6801b94acf4511b06fb36933e3a163329a /arch/s390
parentba7067651083bdcc37223d8879478cbc51cca923 (diff)
parentab08ff34b44f752b664ebb312d2e110cf37a7f5e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull second s390 update from Martin Schwidefsky: "The big thing in this pull request is the UAPI patch from David, and worth mentioning is the page table dumper. The rest are small improvements and bug fixes." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/entry: fix svc number for TIF_SYSCALL system call restart s390/mm,vmem: fix vmem_add_mem()/vmem_remove_range() s390/vmalloc: have separate modules area s390/zcrypt: remove duplicated include from zcrypt_pcixcc.c s390/css_chars: remove superfluous ifdef s390/chsc: make headers usable s390/mm: let kernel text section always begin at 1MB s390/mm: fix mapping of read-only kernel text section s390/mm: add page table dumper s390: add support to start the kernel in 64 bit mode. s390/mm,pageattr: remove superfluous EXPORT_SYMBOLs s390/mm,pageattr: add more page table walk sanity checks s390/mm: fix pmd_huge() usage for kernel mapping s390/dcssblk: cleanup device attribute usage s390/mm: use pfmf instruction to initialize storage keys s390/facilities: cleanup PFMF and HPAGE machine facility detection UAPI: (Scripted) Disintegrate arch/s390/include/asm
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig.debug12
-rw-r--r--arch/s390/include/asm/Kbuild14
-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/css_chars.h3
-rw-r--r--arch/s390/include/asm/debug.h28
-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/page.h14
-rw-r--r--arch/s390/include/asm/pgtable.h30
-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.h21
-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/types.h15
-rw-r--r--arch/s390/include/asm/unistd.h367
-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.h0
-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/early.c17
-rw-r--r--arch/s390/kernel/entry64.S2
-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/module.c11
-rw-r--r--arch/s390/kernel/setup.c51
-rw-r--r--arch/s390/mm/Makefile1
-rw-r--r--arch/s390/mm/dump_pagetables.c226
-rw-r--r--arch/s390/mm/pageattr.c40
-rw-r--r--arch/s390/mm/vmem.c45
74 files changed, 1732 insertions, 1260 deletions
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/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index f18fc796beef..0633dc6d254d 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -1,17 +1,3 @@
1include include/asm-generic/Kbuild.asm
2 1
3header-y += chpid.h
4header-y += chsc.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
16 2
17generic-y += clkdev.h 3generic-y += clkdev.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/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/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/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/pgtable.h b/arch/s390/include/asm/pgtable.h
index 979fe3dc0788..dd647c919a66 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -119,13 +119,12 @@ static inline int is_zero_pfn(unsigned long pfn)
119 119
120#ifndef __ASSEMBLY__ 120#ifndef __ASSEMBLY__
121/* 121/*
122 * 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
123 * mapping. We reserve 96MB (31bit) / 128GB (64bit) for vmalloc, 123 * mapping. We reserve 96MB (31bit) / 128GB (64bit) for vmalloc and modules.
124 * 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
125 * By putting vmalloc at the top, we maximise the gap between physical 125 * modules will reside. That makes sure that inter module branches always
126 * memory and vmalloc to catch misplaced memory accesses. As a side 126 * happen without trampolines and in addition the placement within a 2GB frame
127 * effect, this also makes sure that 64 bit module code cannot be used 127 * is branch prediction unit friendly.
128 * as system call address.
129 */ 128 */
130extern unsigned long VMALLOC_START; 129extern unsigned long VMALLOC_START;
131extern unsigned long VMALLOC_END; 130extern unsigned long VMALLOC_END;
@@ -133,6 +132,14 @@ extern struct page *vmemmap;
133 132
134#define VMEM_MAX_PHYS ((unsigned long) vmemmap) 133#define VMEM_MAX_PHYS ((unsigned long) vmemmap)
135 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
136/* 143/*
137 * A 31 bit pagetable entry of S390 has following format: 144 * A 31 bit pagetable entry of S390 has following format:
138 * | PFRA | | OS | 145 * | PFRA | | OS |
@@ -507,6 +514,15 @@ static inline int pmd_none(pmd_t pmd)
507 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL; 514 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
508} 515}
509 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
510static inline int pmd_bad(pmd_t pmd) 526static inline int pmd_bad(pmd_t pmd)
511{ 527{
512 unsigned long mask = ~_SEGMENT_ENTRY_ORIGIN & ~_SEGMENT_ENTRY_INV; 528 unsigned long mask = ~_SEGMENT_ENTRY_ORIGIN & ~_SEGMENT_ENTRY_INV;
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 8cfd731a18d8..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,8 +71,8 @@ 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)
@@ -88,6 +84,8 @@ extern unsigned int s390_user_mode;
88#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) 84#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
89 85
90#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
91 89
92#ifndef CONFIG_64BIT 90#ifndef CONFIG_64BIT
93#define MACHINE_HAS_IEEE (S390_lowcore.machine_flags & MACHINE_FLAG_IEEE) 91#define MACHINE_HAS_IEEE (S390_lowcore.machine_flags & MACHINE_FLAG_IEEE)
@@ -96,8 +94,8 @@ extern unsigned int s390_user_mode;
96#define MACHINE_HAS_DIAG44 (1) 94#define MACHINE_HAS_DIAG44 (1)
97#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG) 95#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG)
98#define MACHINE_HAS_MVCOS (0) 96#define MACHINE_HAS_MVCOS (0)
99#define MACHINE_HAS_HPAGE (0) 97#define MACHINE_HAS_EDAT1 (0)
100#define MACHINE_HAS_PFMF (0) 98#define MACHINE_HAS_EDAT2 (0)
101#define MACHINE_HAS_SPP (0) 99#define MACHINE_HAS_SPP (0)
102#define MACHINE_HAS_TOPOLOGY (0) 100#define MACHINE_HAS_TOPOLOGY (0)
103#define MACHINE_HAS_TE (0) 101#define MACHINE_HAS_TE (0)
@@ -109,8 +107,8 @@ extern unsigned int s390_user_mode;
109#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44) 107#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
110#define MACHINE_HAS_MVPG (1) 108#define MACHINE_HAS_MVPG (1)
111#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS) 109#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
112#define MACHINE_HAS_HPAGE (S390_lowcore.machine_flags & MACHINE_FLAG_HPAGE) 110#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
113#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) 111#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2)
114#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
115#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
116#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE) 114#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE)
@@ -173,5 +171,4 @@ extern void (*_machine_power_off)(void);
173#define COMMAND_LINE 0x10480 171#define COMMAND_LINE 0x10480
174 172
175#endif /* __ASSEMBLY__ */ 173#endif /* __ASSEMBLY__ */
176#endif /* __KERNEL__ */
177#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/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 8192e292753a..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
@@ -428,5 +64,4 @@
428 */ 64 */
429#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")
430 66
431#endif /* __KERNEL__ */
432#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..581992dfae27
--- /dev/null
+++ b/arch/s390/include/uapi/asm/chpid.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright IBM Corp. 2007
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..e69de29bb2d1
--- /dev/null
+++ b/arch/s390/include/uapi/asm/kvm_para.h
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/early.c b/arch/s390/kernel/early.c
index 00d114445068..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,10 +370,14 @@ 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))
@@ -484,7 +480,6 @@ void __init startup_init(void)
484 detect_diag9c(); 480 detect_diag9c();
485 detect_diag44(); 481 detect_diag44();
486 detect_machine_facilities(); 482 detect_machine_facilities();
487 setup_hpage();
488 setup_topology(); 483 setup_topology();
489 sclp_facilities_detect(); 484 sclp_facilities_detect();
490 detect_memory_layout(memory_chunk); 485 detect_memory_layout(memory_chunk);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index f9761f806c9e..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
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/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/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/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/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/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)