diff options
Diffstat (limited to 'include/asm-s390')
-rw-r--r-- | include/asm-s390/Kbuild | 1 | ||||
-rw-r--r-- | include/asm-s390/appldata.h | 90 | ||||
-rw-r--r-- | include/asm-s390/cio.h | 7 | ||||
-rw-r--r-- | include/asm-s390/dma.h | 2 | ||||
-rw-r--r-- | include/asm-s390/futex.h | 87 | ||||
-rw-r--r-- | include/asm-s390/io.h | 2 | ||||
-rw-r--r-- | include/asm-s390/kdebug.h | 59 | ||||
-rw-r--r-- | include/asm-s390/kprobes.h | 114 | ||||
-rw-r--r-- | include/asm-s390/lowcore.h | 14 | ||||
-rw-r--r-- | include/asm-s390/monwriter.h | 33 | ||||
-rw-r--r-- | include/asm-s390/pgalloc.h | 67 | ||||
-rw-r--r-- | include/asm-s390/pgtable.h | 124 | ||||
-rw-r--r-- | include/asm-s390/processor.h | 17 | ||||
-rw-r--r-- | include/asm-s390/setup.h | 66 | ||||
-rw-r--r-- | include/asm-s390/smp.h | 2 | ||||
-rw-r--r-- | include/asm-s390/uaccess.h | 172 | ||||
-rw-r--r-- | include/asm-s390/unistd.h | 170 | ||||
-rw-r--r-- | include/asm-s390/z90crypt.h | 212 | ||||
-rw-r--r-- | include/asm-s390/zcrypt.h | 285 |
19 files changed, 882 insertions, 642 deletions
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild index 14158a4a9c87..088969d55e72 100644 --- a/include/asm-s390/Kbuild +++ b/include/asm-s390/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | header-y += dasd.h | 3 | header-y += dasd.h |
4 | header-y += monwriter.h | ||
4 | header-y += qeth.h | 5 | header-y += qeth.h |
5 | header-y += tape390.h | 6 | header-y += tape390.h |
6 | header-y += ucontext.h | 7 | header-y += ucontext.h |
diff --git a/include/asm-s390/appldata.h b/include/asm-s390/appldata.h new file mode 100644 index 000000000000..b1770703b706 --- /dev/null +++ b/include/asm-s390/appldata.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * include/asm-s390/appldata.h | ||
3 | * | ||
4 | * Copyright (C) IBM Corp. 2006 | ||
5 | * | ||
6 | * Author(s): Melissa Howland <melissah@us.ibm.com> | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_S390_APPLDATA_H | ||
10 | #define _ASM_S390_APPLDATA_H | ||
11 | |||
12 | #include <asm/io.h> | ||
13 | |||
14 | #ifndef CONFIG_64BIT | ||
15 | |||
16 | #define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */ | ||
17 | #define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */ | ||
18 | #define APPLDATA_GEN_EVENT_REC 0x02 | ||
19 | #define APPLDATA_START_CONFIG_REC 0x03 | ||
20 | |||
21 | /* | ||
22 | * Parameter list for DIAGNOSE X'DC' | ||
23 | */ | ||
24 | struct appldata_parameter_list { | ||
25 | u16 diag; /* The DIAGNOSE code X'00DC' */ | ||
26 | u8 function; /* The function code for the DIAGNOSE */ | ||
27 | u8 parlist_length; /* Length of the parameter list */ | ||
28 | u32 product_id_addr; /* Address of the 16-byte product ID */ | ||
29 | u16 reserved; | ||
30 | u16 buffer_length; /* Length of the application data buffer */ | ||
31 | u32 buffer_addr; /* Address of the application data buffer */ | ||
32 | } __attribute__ ((packed)); | ||
33 | |||
34 | #else /* CONFIG_64BIT */ | ||
35 | |||
36 | #define APPLDATA_START_INTERVAL_REC 0x80 | ||
37 | #define APPLDATA_STOP_REC 0x81 | ||
38 | #define APPLDATA_GEN_EVENT_REC 0x82 | ||
39 | #define APPLDATA_START_CONFIG_REC 0x83 | ||
40 | |||
41 | /* | ||
42 | * Parameter list for DIAGNOSE X'DC' | ||
43 | */ | ||
44 | struct appldata_parameter_list { | ||
45 | u16 diag; | ||
46 | u8 function; | ||
47 | u8 parlist_length; | ||
48 | u32 unused01; | ||
49 | u16 reserved; | ||
50 | u16 buffer_length; | ||
51 | u32 unused02; | ||
52 | u64 product_id_addr; | ||
53 | u64 buffer_addr; | ||
54 | } __attribute__ ((packed)); | ||
55 | |||
56 | #endif /* CONFIG_64BIT */ | ||
57 | |||
58 | struct appldata_product_id { | ||
59 | char prod_nr[7]; /* product number */ | ||
60 | u16 prod_fn; /* product function */ | ||
61 | u8 record_nr; /* record number */ | ||
62 | u16 version_nr; /* version */ | ||
63 | u16 release_nr; /* release */ | ||
64 | u16 mod_lvl; /* modification level */ | ||
65 | } __attribute__ ((packed)); | ||
66 | |||
67 | static inline int appldata_asm(struct appldata_product_id *id, | ||
68 | unsigned short fn, void *buffer, | ||
69 | unsigned short length) | ||
70 | { | ||
71 | struct appldata_parameter_list parm_list; | ||
72 | int ry; | ||
73 | |||
74 | if (!MACHINE_IS_VM) | ||
75 | return -ENOSYS; | ||
76 | parm_list.diag = 0xdc; | ||
77 | parm_list.function = fn; | ||
78 | parm_list.parlist_length = sizeof(parm_list); | ||
79 | parm_list.buffer_length = length; | ||
80 | parm_list.product_id_addr = (unsigned long) id; | ||
81 | parm_list.buffer_addr = virt_to_phys(buffer); | ||
82 | asm volatile( | ||
83 | "diag %1,%0,0xdc" | ||
84 | : "=d" (ry) | ||
85 | : "d" (&parm_list), "m" (parm_list), "m" (*id) | ||
86 | : "cc"); | ||
87 | return ry; | ||
88 | } | ||
89 | |||
90 | #endif /* _ASM_S390_APPLDATA_H */ | ||
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h index 28fdd6e2b8ba..da063cd5f0a0 100644 --- a/include/asm-s390/cio.h +++ b/include/asm-s390/cio.h | |||
@@ -270,6 +270,11 @@ struct diag210 { | |||
270 | __u32 vrdccrft : 8; /* real device feature (output) */ | 270 | __u32 vrdccrft : 8; /* real device feature (output) */ |
271 | } __attribute__ ((packed,aligned(4))); | 271 | } __attribute__ ((packed,aligned(4))); |
272 | 272 | ||
273 | struct ccw_dev_id { | ||
274 | u8 ssid; | ||
275 | u16 devno; | ||
276 | }; | ||
277 | |||
273 | extern int diag210(struct diag210 *addr); | 278 | extern int diag210(struct diag210 *addr); |
274 | 279 | ||
275 | extern void wait_cons_dev(void); | 280 | extern void wait_cons_dev(void); |
@@ -280,6 +285,8 @@ extern void cio_reset_channel_paths(void); | |||
280 | 285 | ||
281 | extern void css_schedule_reprobe(void); | 286 | extern void css_schedule_reprobe(void); |
282 | 287 | ||
288 | extern void reipl_ccw_dev(struct ccw_dev_id *id); | ||
289 | |||
283 | #endif | 290 | #endif |
284 | 291 | ||
285 | #endif | 292 | #endif |
diff --git a/include/asm-s390/dma.h b/include/asm-s390/dma.h index 02720c449cd8..7425c6af6cd4 100644 --- a/include/asm-s390/dma.h +++ b/include/asm-s390/dma.h | |||
@@ -11,6 +11,6 @@ | |||
11 | 11 | ||
12 | #define MAX_DMA_ADDRESS 0x80000000 | 12 | #define MAX_DMA_ADDRESS 0x80000000 |
13 | 13 | ||
14 | #define free_dma(x) | 14 | #define free_dma(x) do { } while (0) |
15 | 15 | ||
16 | #endif /* _ASM_DMA_H */ | 16 | #endif /* _ASM_DMA_H */ |
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h index ffedf14f89f6..5e261e1de671 100644 --- a/include/asm-s390/futex.h +++ b/include/asm-s390/futex.h | |||
@@ -7,75 +7,21 @@ | |||
7 | #include <asm/errno.h> | 7 | #include <asm/errno.h> |
8 | #include <asm/uaccess.h> | 8 | #include <asm/uaccess.h> |
9 | 9 | ||
10 | #ifndef __s390x__ | ||
11 | #define __futex_atomic_fixup \ | ||
12 | ".section __ex_table,\"a\"\n" \ | ||
13 | " .align 4\n" \ | ||
14 | " .long 0b,4b,2b,4b,3b,4b\n" \ | ||
15 | ".previous" | ||
16 | #else /* __s390x__ */ | ||
17 | #define __futex_atomic_fixup \ | ||
18 | ".section __ex_table,\"a\"\n" \ | ||
19 | " .align 8\n" \ | ||
20 | " .quad 0b,4b,2b,4b,3b,4b\n" \ | ||
21 | ".previous" | ||
22 | #endif /* __s390x__ */ | ||
23 | |||
24 | #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ | ||
25 | asm volatile(" sacf 256\n" \ | ||
26 | "0: l %1,0(%6)\n" \ | ||
27 | "1: " insn \ | ||
28 | "2: cs %1,%2,0(%6)\n" \ | ||
29 | "3: jl 1b\n" \ | ||
30 | " lhi %0,0\n" \ | ||
31 | "4: sacf 0\n" \ | ||
32 | __futex_atomic_fixup \ | ||
33 | : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ | ||
34 | "=m" (*uaddr) \ | ||
35 | : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ | ||
36 | "m" (*uaddr) : "cc" ); | ||
37 | |||
38 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | 10 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) |
39 | { | 11 | { |
40 | int op = (encoded_op >> 28) & 7; | 12 | int op = (encoded_op >> 28) & 7; |
41 | int cmp = (encoded_op >> 24) & 15; | 13 | int cmp = (encoded_op >> 24) & 15; |
42 | int oparg = (encoded_op << 8) >> 20; | 14 | int oparg = (encoded_op << 8) >> 20; |
43 | int cmparg = (encoded_op << 20) >> 20; | 15 | int cmparg = (encoded_op << 20) >> 20; |
44 | int oldval = 0, newval, ret; | 16 | int oldval, ret; |
17 | |||
45 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 18 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
46 | oparg = 1 << oparg; | 19 | oparg = 1 << oparg; |
47 | 20 | ||
48 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) |
49 | return -EFAULT; | 22 | return -EFAULT; |
50 | 23 | ||
51 | inc_preempt_count(); | 24 | ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); |
52 | |||
53 | switch (op) { | ||
54 | case FUTEX_OP_SET: | ||
55 | __futex_atomic_op("lr %2,%5\n", | ||
56 | ret, oldval, newval, uaddr, oparg); | ||
57 | break; | ||
58 | case FUTEX_OP_ADD: | ||
59 | __futex_atomic_op("lr %2,%1\nar %2,%5\n", | ||
60 | ret, oldval, newval, uaddr, oparg); | ||
61 | break; | ||
62 | case FUTEX_OP_OR: | ||
63 | __futex_atomic_op("lr %2,%1\nor %2,%5\n", | ||
64 | ret, oldval, newval, uaddr, oparg); | ||
65 | break; | ||
66 | case FUTEX_OP_ANDN: | ||
67 | __futex_atomic_op("lr %2,%1\nnr %2,%5\n", | ||
68 | ret, oldval, newval, uaddr, oparg); | ||
69 | break; | ||
70 | case FUTEX_OP_XOR: | ||
71 | __futex_atomic_op("lr %2,%1\nxr %2,%5\n", | ||
72 | ret, oldval, newval, uaddr, oparg); | ||
73 | break; | ||
74 | default: | ||
75 | ret = -ENOSYS; | ||
76 | } | ||
77 | |||
78 | dec_preempt_count(); | ||
79 | 25 | ||
80 | if (!ret) { | 26 | if (!ret) { |
81 | switch (cmp) { | 27 | switch (cmp) { |
@@ -91,32 +37,13 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
91 | return ret; | 37 | return ret; |
92 | } | 38 | } |
93 | 39 | ||
94 | static inline int | 40 | static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, |
95 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 41 | int oldval, int newval) |
96 | { | 42 | { |
97 | int ret; | ||
98 | |||
99 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 43 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) |
100 | return -EFAULT; | 44 | return -EFAULT; |
101 | asm volatile(" sacf 256\n" | 45 | |
102 | " cs %1,%4,0(%5)\n" | 46 | return uaccess.futex_atomic_cmpxchg(uaddr, oldval, newval); |
103 | "0: lr %0,%1\n" | ||
104 | "1: sacf 0\n" | ||
105 | #ifndef __s390x__ | ||
106 | ".section __ex_table,\"a\"\n" | ||
107 | " .align 4\n" | ||
108 | " .long 0b,1b\n" | ||
109 | ".previous" | ||
110 | #else /* __s390x__ */ | ||
111 | ".section __ex_table,\"a\"\n" | ||
112 | " .align 8\n" | ||
113 | " .quad 0b,1b\n" | ||
114 | ".previous" | ||
115 | #endif /* __s390x__ */ | ||
116 | : "=d" (ret), "+d" (oldval), "=m" (*uaddr) | ||
117 | : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr) | ||
118 | : "cc", "memory" ); | ||
119 | return oldval; | ||
120 | } | 47 | } |
121 | 48 | ||
122 | #endif /* __KERNEL__ */ | 49 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index d4614b35f423..a6cc27e77007 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h | |||
@@ -116,7 +116,7 @@ extern void iounmap(void *addr); | |||
116 | #define outb(x,addr) ((void) writeb(x,addr)) | 116 | #define outb(x,addr) ((void) writeb(x,addr)) |
117 | #define outb_p(x,addr) outb(x,addr) | 117 | #define outb_p(x,addr) outb(x,addr) |
118 | 118 | ||
119 | #define mmiowb() | 119 | #define mmiowb() do { } while (0) |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | 122 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h new file mode 100644 index 000000000000..40cc68025e01 --- /dev/null +++ b/include/asm-s390/kdebug.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _S390_KDEBUG_H | ||
2 | #define _S390_KDEBUG_H | ||
3 | |||
4 | /* | ||
5 | * Feb 2006 Ported to s390 <grundym@us.ibm.com> | ||
6 | */ | ||
7 | #include <linux/notifier.h> | ||
8 | |||
9 | struct pt_regs; | ||
10 | |||
11 | struct die_args { | ||
12 | struct pt_regs *regs; | ||
13 | const char *str; | ||
14 | long err; | ||
15 | int trapnr; | ||
16 | int signr; | ||
17 | }; | ||
18 | |||
19 | /* Note - you should never unregister because that can race with NMIs. | ||
20 | * If you really want to do it first unregister - then synchronize_sched | ||
21 | * - then free. | ||
22 | */ | ||
23 | extern int register_die_notifier(struct notifier_block *); | ||
24 | extern int unregister_die_notifier(struct notifier_block *); | ||
25 | extern int register_page_fault_notifier(struct notifier_block *); | ||
26 | extern int unregister_page_fault_notifier(struct notifier_block *); | ||
27 | extern struct atomic_notifier_head s390die_chain; | ||
28 | |||
29 | |||
30 | enum die_val { | ||
31 | DIE_OOPS = 1, | ||
32 | DIE_BPT, | ||
33 | DIE_SSTEP, | ||
34 | DIE_PANIC, | ||
35 | DIE_NMI, | ||
36 | DIE_DIE, | ||
37 | DIE_NMIWATCHDOG, | ||
38 | DIE_KERNELDEBUG, | ||
39 | DIE_TRAP, | ||
40 | DIE_GPF, | ||
41 | DIE_CALL, | ||
42 | DIE_NMI_IPI, | ||
43 | DIE_PAGE_FAULT, | ||
44 | }; | ||
45 | |||
46 | static inline int notify_die(enum die_val val, const char *str, | ||
47 | struct pt_regs *regs, long err, int trap, int sig) | ||
48 | { | ||
49 | struct die_args args = { | ||
50 | .regs = regs, | ||
51 | .str = str, | ||
52 | .err = err, | ||
53 | .trapnr = trap, | ||
54 | .signr = sig | ||
55 | }; | ||
56 | return atomic_notifier_call_chain(&s390die_chain, val, &args); | ||
57 | } | ||
58 | |||
59 | #endif | ||
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h new file mode 100644 index 000000000000..b847ff0ec3fa --- /dev/null +++ b/include/asm-s390/kprobes.h | |||
@@ -0,0 +1,114 @@ | |||
1 | #ifndef _ASM_S390_KPROBES_H | ||
2 | #define _ASM_S390_KPROBES_H | ||
3 | /* | ||
4 | * Kernel Probes (KProbes) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | * | ||
20 | * Copyright (C) IBM Corporation, 2002, 2006 | ||
21 | * | ||
22 | * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel | ||
23 | * Probes initial implementation ( includes suggestions from | ||
24 | * Rusty Russell). | ||
25 | * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli | ||
26 | * <ananth@in.ibm.com> | ||
27 | * 2005-Dec Used as a template for s390 by Mike Grundy | ||
28 | * <grundym@us.ibm.com> | ||
29 | */ | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/ptrace.h> | ||
32 | #include <linux/percpu.h> | ||
33 | |||
34 | #define __ARCH_WANT_KPROBES_INSN_SLOT | ||
35 | struct pt_regs; | ||
36 | struct kprobe; | ||
37 | |||
38 | typedef u16 kprobe_opcode_t; | ||
39 | #define BREAKPOINT_INSTRUCTION 0x0002 | ||
40 | |||
41 | /* Maximum instruction size is 3 (16bit) halfwords: */ | ||
42 | #define MAX_INSN_SIZE 0x0003 | ||
43 | #define MAX_STACK_SIZE 64 | ||
44 | #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ | ||
45 | (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ | ||
46 | ? (MAX_STACK_SIZE) \ | ||
47 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | ||
48 | |||
49 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry) | ||
50 | |||
51 | #define ARCH_SUPPORTS_KRETPROBES | ||
52 | #define ARCH_INACTIVE_KPROBE_COUNT 0 | ||
53 | |||
54 | #define KPROBE_SWAP_INST 0x10 | ||
55 | |||
56 | #define FIXUP_PSW_NORMAL 0x08 | ||
57 | #define FIXUP_BRANCH_NOT_TAKEN 0x04 | ||
58 | #define FIXUP_RETURN_REGISTER 0x02 | ||
59 | #define FIXUP_NOT_REQUIRED 0x01 | ||
60 | |||
61 | /* Architecture specific copy of original instruction */ | ||
62 | struct arch_specific_insn { | ||
63 | /* copy of original instruction */ | ||
64 | kprobe_opcode_t *insn; | ||
65 | int fixup; | ||
66 | int ilen; | ||
67 | int reg; | ||
68 | }; | ||
69 | |||
70 | struct ins_replace_args { | ||
71 | kprobe_opcode_t *ptr; | ||
72 | kprobe_opcode_t old; | ||
73 | kprobe_opcode_t new; | ||
74 | }; | ||
75 | struct prev_kprobe { | ||
76 | struct kprobe *kp; | ||
77 | unsigned long status; | ||
78 | unsigned long saved_psw; | ||
79 | unsigned long kprobe_saved_imask; | ||
80 | unsigned long kprobe_saved_ctl[3]; | ||
81 | }; | ||
82 | |||
83 | /* per-cpu kprobe control block */ | ||
84 | struct kprobe_ctlblk { | ||
85 | unsigned long kprobe_status; | ||
86 | unsigned long kprobe_saved_imask; | ||
87 | unsigned long kprobe_saved_ctl[3]; | ||
88 | struct pt_regs jprobe_saved_regs; | ||
89 | unsigned long jprobe_saved_r14; | ||
90 | unsigned long jprobe_saved_r15; | ||
91 | struct prev_kprobe prev_kprobe; | ||
92 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; | ||
93 | }; | ||
94 | |||
95 | void arch_remove_kprobe(struct kprobe *p); | ||
96 | void kretprobe_trampoline(void); | ||
97 | int is_prohibited_opcode(kprobe_opcode_t *instruction); | ||
98 | void get_instruction_type(struct arch_specific_insn *ainsn); | ||
99 | |||
100 | #define flush_insn_slot(p) do { } while (0) | ||
101 | |||
102 | #endif /* _ASM_S390_KPROBES_H */ | ||
103 | |||
104 | #ifdef CONFIG_KPROBES | ||
105 | |||
106 | extern int kprobe_exceptions_notify(struct notifier_block *self, | ||
107 | unsigned long val, void *data); | ||
108 | #else /* !CONFIG_KPROBES */ | ||
109 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
110 | unsigned long val, void *data) | ||
111 | { | ||
112 | return 0; | ||
113 | } | ||
114 | #endif | ||
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index 596c8b172104..18695d10dedf 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define __LC_IO_NEW_PSW 0x01f0 | 35 | #define __LC_IO_NEW_PSW 0x01f0 |
36 | #endif /* !__s390x__ */ | 36 | #endif /* !__s390x__ */ |
37 | 37 | ||
38 | #define __LC_IPL_PARMBLOCK_PTR 0x014 | ||
38 | #define __LC_EXT_PARAMS 0x080 | 39 | #define __LC_EXT_PARAMS 0x080 |
39 | #define __LC_CPU_ADDRESS 0x084 | 40 | #define __LC_CPU_ADDRESS 0x084 |
40 | #define __LC_EXT_INT_CODE 0x086 | 41 | #define __LC_EXT_INT_CODE 0x086 |
@@ -47,6 +48,7 @@ | |||
47 | #define __LC_PER_ATMID 0x096 | 48 | #define __LC_PER_ATMID 0x096 |
48 | #define __LC_PER_ADDRESS 0x098 | 49 | #define __LC_PER_ADDRESS 0x098 |
49 | #define __LC_PER_ACCESS_ID 0x0A1 | 50 | #define __LC_PER_ACCESS_ID 0x0A1 |
51 | #define __LC_AR_MODE_ID 0x0A3 | ||
50 | 52 | ||
51 | #define __LC_SUBCHANNEL_ID 0x0B8 | 53 | #define __LC_SUBCHANNEL_ID 0x0B8 |
52 | #define __LC_SUBCHANNEL_NR 0x0BA | 54 | #define __LC_SUBCHANNEL_NR 0x0BA |
@@ -106,18 +108,28 @@ | |||
106 | #define __LC_INT_CLOCK 0xDE8 | 108 | #define __LC_INT_CLOCK 0xDE8 |
107 | #endif /* __s390x__ */ | 109 | #endif /* __s390x__ */ |
108 | 110 | ||
109 | #define __LC_PANIC_MAGIC 0xE00 | ||
110 | 111 | ||
112 | #define __LC_PANIC_MAGIC 0xE00 | ||
111 | #ifndef __s390x__ | 113 | #ifndef __s390x__ |
112 | #define __LC_PFAULT_INTPARM 0x080 | 114 | #define __LC_PFAULT_INTPARM 0x080 |
113 | #define __LC_CPU_TIMER_SAVE_AREA 0x0D8 | 115 | #define __LC_CPU_TIMER_SAVE_AREA 0x0D8 |
116 | #define __LC_CLOCK_COMP_SAVE_AREA 0x0E0 | ||
117 | #define __LC_PSW_SAVE_AREA 0x100 | ||
118 | #define __LC_PREFIX_SAVE_AREA 0x108 | ||
114 | #define __LC_AREGS_SAVE_AREA 0x120 | 119 | #define __LC_AREGS_SAVE_AREA 0x120 |
120 | #define __LC_FPREGS_SAVE_AREA 0x160 | ||
115 | #define __LC_GPREGS_SAVE_AREA 0x180 | 121 | #define __LC_GPREGS_SAVE_AREA 0x180 |
116 | #define __LC_CREGS_SAVE_AREA 0x1C0 | 122 | #define __LC_CREGS_SAVE_AREA 0x1C0 |
117 | #else /* __s390x__ */ | 123 | #else /* __s390x__ */ |
118 | #define __LC_PFAULT_INTPARM 0x11B8 | 124 | #define __LC_PFAULT_INTPARM 0x11B8 |
125 | #define __LC_FPREGS_SAVE_AREA 0x1200 | ||
119 | #define __LC_GPREGS_SAVE_AREA 0x1280 | 126 | #define __LC_GPREGS_SAVE_AREA 0x1280 |
127 | #define __LC_PSW_SAVE_AREA 0x1300 | ||
128 | #define __LC_PREFIX_SAVE_AREA 0x1318 | ||
129 | #define __LC_FP_CREG_SAVE_AREA 0x131C | ||
130 | #define __LC_TODREG_SAVE_AREA 0x1324 | ||
120 | #define __LC_CPU_TIMER_SAVE_AREA 0x1328 | 131 | #define __LC_CPU_TIMER_SAVE_AREA 0x1328 |
132 | #define __LC_CLOCK_COMP_SAVE_AREA 0x1331 | ||
121 | #define __LC_AREGS_SAVE_AREA 0x1340 | 133 | #define __LC_AREGS_SAVE_AREA 0x1340 |
122 | #define __LC_CREGS_SAVE_AREA 0x1380 | 134 | #define __LC_CREGS_SAVE_AREA 0x1380 |
123 | #endif /* __s390x__ */ | 135 | #endif /* __s390x__ */ |
diff --git a/include/asm-s390/monwriter.h b/include/asm-s390/monwriter.h new file mode 100644 index 000000000000..f0cbf96c52e6 --- /dev/null +++ b/include/asm-s390/monwriter.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * include/asm-s390/monwriter.h | ||
3 | * | ||
4 | * Copyright (C) IBM Corp. 2006 | ||
5 | * Character device driver for writing z/VM APPLDATA monitor records | ||
6 | * Version 1.0 | ||
7 | * Author(s): Melissa Howland <melissah@us.ibm.com> | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_390_MONWRITER_H | ||
12 | #define _ASM_390_MONWRITER_H | ||
13 | |||
14 | /* mon_function values */ | ||
15 | #define MONWRITE_START_INTERVAL 0x00 /* start interval recording */ | ||
16 | #define MONWRITE_STOP_INTERVAL 0x01 /* stop interval or config recording */ | ||
17 | #define MONWRITE_GEN_EVENT 0x02 /* generate event record */ | ||
18 | #define MONWRITE_START_CONFIG 0x03 /* start configuration recording */ | ||
19 | |||
20 | /* the header the app uses in its write() data */ | ||
21 | struct monwrite_hdr { | ||
22 | unsigned char mon_function; | ||
23 | unsigned short applid; | ||
24 | unsigned char record_num; | ||
25 | unsigned short version; | ||
26 | unsigned short release; | ||
27 | unsigned short mod_level; | ||
28 | unsigned short datalen; | ||
29 | unsigned char hdrlen; | ||
30 | |||
31 | } __attribute__((packed)); | ||
32 | |||
33 | #endif /* _ASM_390_MONWRITER_H */ | ||
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h index a78e853e0dd5..803bc7064418 100644 --- a/include/asm-s390/pgalloc.h +++ b/include/asm-s390/pgalloc.h | |||
@@ -22,6 +22,16 @@ | |||
22 | extern void diag10(unsigned long addr); | 22 | extern void diag10(unsigned long addr); |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Page allocation orders. | ||
26 | */ | ||
27 | #ifndef __s390x__ | ||
28 | # define PGD_ALLOC_ORDER 1 | ||
29 | #else /* __s390x__ */ | ||
30 | # define PMD_ALLOC_ORDER 2 | ||
31 | # define PGD_ALLOC_ORDER 2 | ||
32 | #endif /* __s390x__ */ | ||
33 | |||
34 | /* | ||
25 | * Allocate and free page tables. The xxx_kernel() versions are | 35 | * Allocate and free page tables. The xxx_kernel() versions are |
26 | * used to allocate a kernel page table - this turns on ASN bits | 36 | * used to allocate a kernel page table - this turns on ASN bits |
27 | * if any. | 37 | * if any. |
@@ -29,30 +39,23 @@ extern void diag10(unsigned long addr); | |||
29 | 39 | ||
30 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 40 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
31 | { | 41 | { |
32 | pgd_t *pgd; | 42 | pgd_t *pgd = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ALLOC_ORDER); |
33 | int i; | 43 | int i; |
34 | 44 | ||
45 | if (!pgd) | ||
46 | return NULL; | ||
47 | for (i = 0; i < PTRS_PER_PGD; i++) | ||
35 | #ifndef __s390x__ | 48 | #ifndef __s390x__ |
36 | pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,1); | 49 | pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); |
37 | if (pgd != NULL) | 50 | #else |
38 | for (i = 0; i < USER_PTRS_PER_PGD; i++) | 51 | pgd_clear(pgd + i); |
39 | pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); | 52 | #endif |
40 | #else /* __s390x__ */ | ||
41 | pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2); | ||
42 | if (pgd != NULL) | ||
43 | for (i = 0; i < PTRS_PER_PGD; i++) | ||
44 | pgd_clear(pgd + i); | ||
45 | #endif /* __s390x__ */ | ||
46 | return pgd; | 53 | return pgd; |
47 | } | 54 | } |
48 | 55 | ||
49 | static inline void pgd_free(pgd_t *pgd) | 56 | static inline void pgd_free(pgd_t *pgd) |
50 | { | 57 | { |
51 | #ifndef __s390x__ | 58 | free_pages((unsigned long) pgd, PGD_ALLOC_ORDER); |
52 | free_pages((unsigned long) pgd, 1); | ||
53 | #else /* __s390x__ */ | ||
54 | free_pages((unsigned long) pgd, 2); | ||
55 | #endif /* __s390x__ */ | ||
56 | } | 59 | } |
57 | 60 | ||
58 | #ifndef __s390x__ | 61 | #ifndef __s390x__ |
@@ -68,20 +71,19 @@ static inline void pgd_free(pgd_t *pgd) | |||
68 | #else /* __s390x__ */ | 71 | #else /* __s390x__ */ |
69 | static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) | 72 | static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) |
70 | { | 73 | { |
71 | pmd_t *pmd; | 74 | pmd_t *pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ALLOC_ORDER); |
72 | int i; | 75 | int i; |
73 | 76 | ||
74 | pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2); | 77 | if (!pmd) |
75 | if (pmd != NULL) { | 78 | return NULL; |
76 | for (i=0; i < PTRS_PER_PMD; i++) | 79 | for (i=0; i < PTRS_PER_PMD; i++) |
77 | pmd_clear(pmd+i); | 80 | pmd_clear(pmd + i); |
78 | } | ||
79 | return pmd; | 81 | return pmd; |
80 | } | 82 | } |
81 | 83 | ||
82 | static inline void pmd_free (pmd_t *pmd) | 84 | static inline void pmd_free (pmd_t *pmd) |
83 | { | 85 | { |
84 | free_pages((unsigned long) pmd, 2); | 86 | free_pages((unsigned long) pmd, PMD_ALLOC_ORDER); |
85 | } | 87 | } |
86 | 88 | ||
87 | #define __pmd_free_tlb(tlb,pmd) \ | 89 | #define __pmd_free_tlb(tlb,pmd) \ |
@@ -123,15 +125,14 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) | |||
123 | static inline pte_t * | 125 | static inline pte_t * |
124 | pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) | 126 | pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) |
125 | { | 127 | { |
126 | pte_t *pte; | 128 | pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL|__GFP_REPEAT); |
127 | int i; | 129 | int i; |
128 | 130 | ||
129 | pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); | 131 | if (!pte) |
130 | if (pte != NULL) { | 132 | return NULL; |
131 | for (i=0; i < PTRS_PER_PTE; i++) { | 133 | for (i=0; i < PTRS_PER_PTE; i++) { |
132 | pte_clear(mm, vmaddr, pte+i); | 134 | pte_clear(mm, vmaddr, pte + i); |
133 | vmaddr += PAGE_SIZE; | 135 | vmaddr += PAGE_SIZE; |
134 | } | ||
135 | } | 136 | } |
136 | return pte; | 137 | return pte; |
137 | } | 138 | } |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 24312387fa24..1a07028d575e 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -89,19 +89,6 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
89 | # define PTRS_PER_PGD 2048 | 89 | # define PTRS_PER_PGD 2048 |
90 | #endif /* __s390x__ */ | 90 | #endif /* __s390x__ */ |
91 | 91 | ||
92 | /* | ||
93 | * pgd entries used up by user/kernel: | ||
94 | */ | ||
95 | #ifndef __s390x__ | ||
96 | # define USER_PTRS_PER_PGD 512 | ||
97 | # define USER_PGD_PTRS 512 | ||
98 | # define KERNEL_PGD_PTRS 512 | ||
99 | #else /* __s390x__ */ | ||
100 | # define USER_PTRS_PER_PGD 2048 | ||
101 | # define USER_PGD_PTRS 2048 | ||
102 | # define KERNEL_PGD_PTRS 2048 | ||
103 | #endif /* __s390x__ */ | ||
104 | |||
105 | #define FIRST_USER_ADDRESS 0 | 92 | #define FIRST_USER_ADDRESS 0 |
106 | 93 | ||
107 | #define pte_ERROR(e) \ | 94 | #define pte_ERROR(e) \ |
@@ -216,12 +203,14 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
216 | #define _PAGE_RO 0x200 /* HW read-only */ | 203 | #define _PAGE_RO 0x200 /* HW read-only */ |
217 | #define _PAGE_INVALID 0x400 /* HW invalid */ | 204 | #define _PAGE_INVALID 0x400 /* HW invalid */ |
218 | 205 | ||
219 | /* Mask and four different kinds of invalid pages. */ | 206 | /* Mask and six different types of pages. */ |
220 | #define _PAGE_INVALID_MASK 0x601 | 207 | #define _PAGE_TYPE_MASK 0x601 |
221 | #define _PAGE_INVALID_EMPTY 0x400 | 208 | #define _PAGE_TYPE_EMPTY 0x400 |
222 | #define _PAGE_INVALID_NONE 0x401 | 209 | #define _PAGE_TYPE_NONE 0x401 |
223 | #define _PAGE_INVALID_SWAP 0x600 | 210 | #define _PAGE_TYPE_SWAP 0x600 |
224 | #define _PAGE_INVALID_FILE 0x601 | 211 | #define _PAGE_TYPE_FILE 0x601 |
212 | #define _PAGE_TYPE_RO 0x200 | ||
213 | #define _PAGE_TYPE_RW 0x000 | ||
225 | 214 | ||
226 | #ifndef __s390x__ | 215 | #ifndef __s390x__ |
227 | 216 | ||
@@ -280,15 +269,14 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
280 | #endif /* __s390x__ */ | 269 | #endif /* __s390x__ */ |
281 | 270 | ||
282 | /* | 271 | /* |
283 | * No mapping available | 272 | * Page protection definitions. |
284 | */ | 273 | */ |
285 | #define PAGE_NONE_SHARED __pgprot(_PAGE_INVALID_NONE) | 274 | #define PAGE_NONE __pgprot(_PAGE_TYPE_NONE) |
286 | #define PAGE_NONE_PRIVATE __pgprot(_PAGE_INVALID_NONE) | 275 | #define PAGE_RO __pgprot(_PAGE_TYPE_RO) |
287 | #define PAGE_RO_SHARED __pgprot(_PAGE_RO) | 276 | #define PAGE_RW __pgprot(_PAGE_TYPE_RW) |
288 | #define PAGE_RO_PRIVATE __pgprot(_PAGE_RO) | 277 | |
289 | #define PAGE_COPY __pgprot(_PAGE_RO) | 278 | #define PAGE_KERNEL PAGE_RW |
290 | #define PAGE_SHARED __pgprot(0) | 279 | #define PAGE_COPY PAGE_RO |
291 | #define PAGE_KERNEL __pgprot(0) | ||
292 | 280 | ||
293 | /* | 281 | /* |
294 | * The S390 can't do page protection for execute, and considers that the | 282 | * The S390 can't do page protection for execute, and considers that the |
@@ -296,23 +284,23 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
296 | * the closest we can get.. | 284 | * the closest we can get.. |
297 | */ | 285 | */ |
298 | /*xwr*/ | 286 | /*xwr*/ |
299 | #define __P000 PAGE_NONE_PRIVATE | 287 | #define __P000 PAGE_NONE |
300 | #define __P001 PAGE_RO_PRIVATE | 288 | #define __P001 PAGE_RO |
301 | #define __P010 PAGE_COPY | 289 | #define __P010 PAGE_RO |
302 | #define __P011 PAGE_COPY | 290 | #define __P011 PAGE_RO |
303 | #define __P100 PAGE_RO_PRIVATE | 291 | #define __P100 PAGE_RO |
304 | #define __P101 PAGE_RO_PRIVATE | 292 | #define __P101 PAGE_RO |
305 | #define __P110 PAGE_COPY | 293 | #define __P110 PAGE_RO |
306 | #define __P111 PAGE_COPY | 294 | #define __P111 PAGE_RO |
307 | 295 | ||
308 | #define __S000 PAGE_NONE_SHARED | 296 | #define __S000 PAGE_NONE |
309 | #define __S001 PAGE_RO_SHARED | 297 | #define __S001 PAGE_RO |
310 | #define __S010 PAGE_SHARED | 298 | #define __S010 PAGE_RW |
311 | #define __S011 PAGE_SHARED | 299 | #define __S011 PAGE_RW |
312 | #define __S100 PAGE_RO_SHARED | 300 | #define __S100 PAGE_RO |
313 | #define __S101 PAGE_RO_SHARED | 301 | #define __S101 PAGE_RO |
314 | #define __S110 PAGE_SHARED | 302 | #define __S110 PAGE_RW |
315 | #define __S111 PAGE_SHARED | 303 | #define __S111 PAGE_RW |
316 | 304 | ||
317 | /* | 305 | /* |
318 | * Certain architectures need to do special things when PTEs | 306 | * Certain architectures need to do special things when PTEs |
@@ -377,18 +365,18 @@ static inline int pmd_bad(pmd_t pmd) | |||
377 | 365 | ||
378 | static inline int pte_none(pte_t pte) | 366 | static inline int pte_none(pte_t pte) |
379 | { | 367 | { |
380 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; | 368 | return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_EMPTY; |
381 | } | 369 | } |
382 | 370 | ||
383 | static inline int pte_present(pte_t pte) | 371 | static inline int pte_present(pte_t pte) |
384 | { | 372 | { |
385 | return !(pte_val(pte) & _PAGE_INVALID) || | 373 | return !(pte_val(pte) & _PAGE_INVALID) || |
386 | (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; | 374 | (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_NONE; |
387 | } | 375 | } |
388 | 376 | ||
389 | static inline int pte_file(pte_t pte) | 377 | static inline int pte_file(pte_t pte) |
390 | { | 378 | { |
391 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; | 379 | return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_FILE; |
392 | } | 380 | } |
393 | 381 | ||
394 | #define pte_same(a,b) (pte_val(a) == pte_val(b)) | 382 | #define pte_same(a,b) (pte_val(a) == pte_val(b)) |
@@ -461,7 +449,7 @@ static inline void pmd_clear(pmd_t * pmdp) | |||
461 | 449 | ||
462 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 450 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
463 | { | 451 | { |
464 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; | 452 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
465 | } | 453 | } |
466 | 454 | ||
467 | /* | 455 | /* |
@@ -477,7 +465,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
477 | 465 | ||
478 | static inline pte_t pte_wrprotect(pte_t pte) | 466 | static inline pte_t pte_wrprotect(pte_t pte) |
479 | { | 467 | { |
480 | /* Do not clobber _PAGE_INVALID_NONE pages! */ | 468 | /* Do not clobber _PAGE_TYPE_NONE pages! */ |
481 | if (!(pte_val(pte) & _PAGE_INVALID)) | 469 | if (!(pte_val(pte) & _PAGE_INVALID)) |
482 | pte_val(pte) |= _PAGE_RO; | 470 | pte_val(pte) |= _PAGE_RO; |
483 | return pte; | 471 | return pte; |
@@ -556,26 +544,30 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | |||
556 | return pte; | 544 | return pte; |
557 | } | 545 | } |
558 | 546 | ||
559 | static inline pte_t | 547 | static inline void __ptep_ipte(unsigned long address, pte_t *ptep) |
560 | ptep_clear_flush(struct vm_area_struct *vma, | ||
561 | unsigned long address, pte_t *ptep) | ||
562 | { | 548 | { |
563 | pte_t pte = *ptep; | 549 | if (!(pte_val(*ptep) & _PAGE_INVALID)) { |
564 | #ifndef __s390x__ | 550 | #ifndef __s390x__ |
565 | if (!(pte_val(pte) & _PAGE_INVALID)) { | ||
566 | /* S390 has 1mb segments, we are emulating 4MB segments */ | 551 | /* S390 has 1mb segments, we are emulating 4MB segments */ |
567 | pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); | 552 | pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); |
568 | __asm__ __volatile__ ("ipte %2,%3" | 553 | #else |
569 | : "=m" (*ptep) : "m" (*ptep), | 554 | /* ipte in zarch mode can do the math */ |
570 | "a" (pto), "a" (address) ); | 555 | pte_t *pto = ptep; |
556 | #endif | ||
557 | asm volatile ("ipte %2,%3" | ||
558 | : "=m" (*ptep) : "m" (*ptep), | ||
559 | "a" (pto), "a" (address) ); | ||
571 | } | 560 | } |
572 | #else /* __s390x__ */ | 561 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
573 | if (!(pte_val(pte) & _PAGE_INVALID)) | 562 | } |
574 | __asm__ __volatile__ ("ipte %2,%3" | 563 | |
575 | : "=m" (*ptep) : "m" (*ptep), | 564 | static inline pte_t |
576 | "a" (ptep), "a" (address) ); | 565 | ptep_clear_flush(struct vm_area_struct *vma, |
577 | #endif /* __s390x__ */ | 566 | unsigned long address, pte_t *ptep) |
578 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; | 567 | { |
568 | pte_t pte = *ptep; | ||
569 | |||
570 | __ptep_ipte(address, ptep); | ||
579 | return pte; | 571 | return pte; |
580 | } | 572 | } |
581 | 573 | ||
@@ -755,7 +747,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | |||
755 | { | 747 | { |
756 | pte_t pte; | 748 | pte_t pte; |
757 | offset &= __SWP_OFFSET_MASK; | 749 | offset &= __SWP_OFFSET_MASK; |
758 | pte_val(pte) = _PAGE_INVALID_SWAP | ((type & 0x1f) << 2) | | 750 | pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) | |
759 | ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); | 751 | ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); |
760 | return pte; | 752 | return pte; |
761 | } | 753 | } |
@@ -778,7 +770,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | |||
778 | 770 | ||
779 | #define pgoff_to_pte(__off) \ | 771 | #define pgoff_to_pte(__off) \ |
780 | ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ | 772 | ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ |
781 | | _PAGE_INVALID_FILE }) | 773 | | _PAGE_TYPE_FILE }) |
782 | 774 | ||
783 | #endif /* !__ASSEMBLY__ */ | 775 | #endif /* !__ASSEMBLY__ */ |
784 | 776 | ||
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 5b71d3731723..a3a4e5fd30d7 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -339,4 +339,21 @@ int unregister_idle_notifier(struct notifier_block *nb); | |||
339 | 339 | ||
340 | #endif | 340 | #endif |
341 | 341 | ||
342 | /* | ||
343 | * Helper macro for exception table entries | ||
344 | */ | ||
345 | #ifndef __s390x__ | ||
346 | #define EX_TABLE(_fault,_target) \ | ||
347 | ".section __ex_table,\"a\"\n" \ | ||
348 | " .align 4\n" \ | ||
349 | " .long " #_fault "," #_target "\n" \ | ||
350 | ".previous\n" | ||
351 | #else | ||
352 | #define EX_TABLE(_fault,_target) \ | ||
353 | ".section __ex_table,\"a\"\n" \ | ||
354 | " .align 8\n" \ | ||
355 | " .quad " #_fault "," #_target "\n" \ | ||
356 | ".previous\n" | ||
357 | #endif | ||
358 | |||
342 | #endif /* __ASM_S390_PROCESSOR_H */ | 359 | #endif /* __ASM_S390_PROCESSOR_H */ |
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h index 19e31979309a..f1959732b6fd 100644 --- a/include/asm-s390/setup.h +++ b/include/asm-s390/setup.h | |||
@@ -14,8 +14,6 @@ | |||
14 | 14 | ||
15 | #define PARMAREA 0x10400 | 15 | #define PARMAREA 0x10400 |
16 | #define COMMAND_LINE_SIZE 896 | 16 | #define COMMAND_LINE_SIZE 896 |
17 | #define RAMDISK_ORIGIN 0x800000 | ||
18 | #define RAMDISK_SIZE 0x800000 | ||
19 | #define MEMORY_CHUNKS 16 /* max 0x7fff */ | 17 | #define MEMORY_CHUNKS 16 /* max 0x7fff */ |
20 | #define IPL_PARMBLOCK_ORIGIN 0x2000 | 18 | #define IPL_PARMBLOCK_ORIGIN 0x2000 |
21 | 19 | ||
@@ -46,10 +44,12 @@ extern unsigned long machine_flags; | |||
46 | #define MACHINE_HAS_IEEE (machine_flags & 2) | 44 | #define MACHINE_HAS_IEEE (machine_flags & 2) |
47 | #define MACHINE_HAS_CSP (machine_flags & 8) | 45 | #define MACHINE_HAS_CSP (machine_flags & 8) |
48 | #define MACHINE_HAS_DIAG44 (1) | 46 | #define MACHINE_HAS_DIAG44 (1) |
47 | #define MACHINE_HAS_MVCOS (0) | ||
49 | #else /* __s390x__ */ | 48 | #else /* __s390x__ */ |
50 | #define MACHINE_HAS_IEEE (1) | 49 | #define MACHINE_HAS_IEEE (1) |
51 | #define MACHINE_HAS_CSP (1) | 50 | #define MACHINE_HAS_CSP (1) |
52 | #define MACHINE_HAS_DIAG44 (machine_flags & 32) | 51 | #define MACHINE_HAS_DIAG44 (machine_flags & 32) |
52 | #define MACHINE_HAS_MVCOS (machine_flags & 512) | ||
53 | #endif /* __s390x__ */ | 53 | #endif /* __s390x__ */ |
54 | 54 | ||
55 | 55 | ||
@@ -70,52 +70,76 @@ extern unsigned int console_irq; | |||
70 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) | 70 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) |
71 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) | 71 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) |
72 | 72 | ||
73 | struct ipl_list_header { | 73 | |
74 | u32 length; | 74 | struct ipl_list_hdr { |
75 | u8 reserved[3]; | 75 | u32 len; |
76 | u8 reserved1[3]; | ||
76 | u8 version; | 77 | u8 version; |
78 | u32 blk0_len; | ||
79 | u8 pbt; | ||
80 | u8 flags; | ||
81 | u16 reserved2; | ||
77 | } __attribute__((packed)); | 82 | } __attribute__((packed)); |
78 | 83 | ||
79 | struct ipl_block_fcp { | 84 | struct ipl_block_fcp { |
80 | u32 length; | 85 | u8 reserved1[313-1]; |
81 | u8 pbt; | 86 | u8 opt; |
82 | u8 reserved1[322-1]; | 87 | u8 reserved2[3]; |
88 | u16 reserved3; | ||
83 | u16 devno; | 89 | u16 devno; |
84 | u8 reserved2[4]; | 90 | u8 reserved4[4]; |
85 | u64 wwpn; | 91 | u64 wwpn; |
86 | u64 lun; | 92 | u64 lun; |
87 | u32 bootprog; | 93 | u32 bootprog; |
88 | u8 reserved3[12]; | 94 | u8 reserved5[12]; |
89 | u64 br_lba; | 95 | u64 br_lba; |
90 | u32 scp_data_len; | 96 | u32 scp_data_len; |
91 | u8 reserved4[260]; | 97 | u8 reserved6[260]; |
92 | u8 scp_data[]; | 98 | u8 scp_data[]; |
93 | } __attribute__((packed)); | 99 | } __attribute__((packed)); |
94 | 100 | ||
101 | struct ipl_block_ccw { | ||
102 | u8 load_param[8]; | ||
103 | u8 reserved1[84]; | ||
104 | u8 reserved2[2]; | ||
105 | u16 devno; | ||
106 | u8 vm_flags; | ||
107 | u8 reserved3[3]; | ||
108 | u32 vm_parm_len; | ||
109 | } __attribute__((packed)); | ||
110 | |||
95 | struct ipl_parameter_block { | 111 | struct ipl_parameter_block { |
112 | struct ipl_list_hdr hdr; | ||
96 | union { | 113 | union { |
97 | u32 length; | 114 | struct ipl_block_fcp fcp; |
98 | struct ipl_list_header header; | 115 | struct ipl_block_ccw ccw; |
99 | } hdr; | 116 | } ipl_info; |
100 | struct ipl_block_fcp fcp; | ||
101 | } __attribute__((packed)); | 117 | } __attribute__((packed)); |
102 | 118 | ||
103 | #define IPL_MAX_SUPPORTED_VERSION (0) | 119 | #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ |
120 | sizeof(struct ipl_block_fcp)) | ||
104 | 121 | ||
105 | #define IPL_TYPE_FCP (0) | 122 | #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ |
123 | sizeof(struct ipl_block_ccw)) | ||
124 | |||
125 | #define IPL_MAX_SUPPORTED_VERSION (0) | ||
106 | 126 | ||
107 | /* | 127 | /* |
108 | * IPL validity flags and parameters as detected in head.S | 128 | * IPL validity flags and parameters as detected in head.S |
109 | */ | 129 | */ |
110 | extern u32 ipl_parameter_flags; | 130 | extern u32 ipl_flags; |
111 | extern u16 ipl_devno; | 131 | extern u16 ipl_devno; |
112 | 132 | ||
113 | #define IPL_DEVNO_VALID (ipl_parameter_flags & 1) | 133 | void do_reipl(void); |
114 | #define IPL_PARMBLOCK_VALID (ipl_parameter_flags & 2) | 134 | |
135 | enum { | ||
136 | IPL_DEVNO_VALID = 1, | ||
137 | IPL_PARMBLOCK_VALID = 2, | ||
138 | }; | ||
115 | 139 | ||
116 | #define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ | 140 | #define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ |
117 | IPL_PARMBLOCK_ORIGIN) | 141 | IPL_PARMBLOCK_ORIGIN) |
118 | #define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length) | 142 | #define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len) |
119 | 143 | ||
120 | #else /* __ASSEMBLY__ */ | 144 | #else /* __ASSEMBLY__ */ |
121 | 145 | ||
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 657646054c5e..9fb02e9779c9 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
@@ -104,7 +104,7 @@ smp_call_function_on(void (*func) (void *info), void *info, | |||
104 | #define smp_cpu_not_running(cpu) 1 | 104 | #define smp_cpu_not_running(cpu) 1 |
105 | #define smp_get_cpu(cpu) ({ 0; }) | 105 | #define smp_get_cpu(cpu) ({ 0; }) |
106 | #define smp_put_cpu(cpu) ({ 0; }) | 106 | #define smp_put_cpu(cpu) ({ 0; }) |
107 | #define smp_setup_cpu_possible_map() | 107 | #define smp_setup_cpu_possible_map() do { } while (0) |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | #endif | 110 | #endif |
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h index 0b7c0ca4c3d7..e2047b0c9092 100644 --- a/include/asm-s390/uaccess.h +++ b/include/asm-s390/uaccess.h | |||
@@ -47,7 +47,7 @@ | |||
47 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ | 47 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ |
48 | asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ | 48 | asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ |
49 | }) | 49 | }) |
50 | #else | 50 | #else /* __s390x__ */ |
51 | #define set_fs(x) \ | 51 | #define set_fs(x) \ |
52 | ({ \ | 52 | ({ \ |
53 | unsigned long __pto; \ | 53 | unsigned long __pto; \ |
@@ -56,7 +56,7 @@ | |||
56 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ | 56 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ |
57 | asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \ | 57 | asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \ |
58 | }) | 58 | }) |
59 | #endif | 59 | #endif /* __s390x__ */ |
60 | 60 | ||
61 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) | 61 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) |
62 | 62 | ||
@@ -85,76 +85,51 @@ struct exception_table_entry | |||
85 | unsigned long insn, fixup; | 85 | unsigned long insn, fixup; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | #ifndef __s390x__ | 88 | struct uaccess_ops { |
89 | #define __uaccess_fixup \ | 89 | size_t (*copy_from_user)(size_t, const void __user *, void *); |
90 | ".section .fixup,\"ax\"\n" \ | 90 | size_t (*copy_from_user_small)(size_t, const void __user *, void *); |
91 | "2: lhi %0,%4\n" \ | 91 | size_t (*copy_to_user)(size_t, void __user *, const void *); |
92 | " bras 1,3f\n" \ | 92 | size_t (*copy_to_user_small)(size_t, void __user *, const void *); |
93 | " .long 1b\n" \ | 93 | size_t (*copy_in_user)(size_t, void __user *, const void __user *); |
94 | "3: l 1,0(1)\n" \ | 94 | size_t (*clear_user)(size_t, void __user *); |
95 | " br 1\n" \ | 95 | size_t (*strnlen_user)(size_t, const char __user *); |
96 | ".previous\n" \ | 96 | size_t (*strncpy_from_user)(size_t, const char __user *, char *); |
97 | ".section __ex_table,\"a\"\n" \ | 97 | int (*futex_atomic_op)(int op, int __user *, int oparg, int *old); |
98 | " .align 4\n" \ | 98 | int (*futex_atomic_cmpxchg)(int __user *, int old, int new); |
99 | " .long 0b,2b\n" \ | 99 | }; |
100 | ".previous" | 100 | |
101 | #define __uaccess_clobber "cc", "1" | 101 | extern struct uaccess_ops uaccess; |
102 | #else /* __s390x__ */ | 102 | extern struct uaccess_ops uaccess_std; |
103 | #define __uaccess_fixup \ | 103 | extern struct uaccess_ops uaccess_mvcos; |
104 | ".section .fixup,\"ax\"\n" \ | 104 | |
105 | "2: lghi %0,%4\n" \ | 105 | static inline int __put_user_fn(size_t size, void __user *ptr, void *x) |
106 | " jg 1b\n" \ | 106 | { |
107 | ".previous\n" \ | 107 | size = uaccess.copy_to_user_small(size, ptr, x); |
108 | ".section __ex_table,\"a\"\n" \ | 108 | return size ? -EFAULT : size; |
109 | " .align 8\n" \ | 109 | } |
110 | " .quad 0b,2b\n" \ | 110 | |
111 | ".previous" | 111 | static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) |
112 | #define __uaccess_clobber "cc" | 112 | { |
113 | #endif /* __s390x__ */ | 113 | size = uaccess.copy_from_user_small(size, ptr, x); |
114 | return size ? -EFAULT : size; | ||
115 | } | ||
114 | 116 | ||
115 | /* | 117 | /* |
116 | * These are the main single-value transfer routines. They automatically | 118 | * These are the main single-value transfer routines. They automatically |
117 | * use the right size if we just have the right pointer type. | 119 | * use the right size if we just have the right pointer type. |
118 | */ | 120 | */ |
119 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
120 | #define __put_user_asm(x, ptr, err) \ | ||
121 | ({ \ | ||
122 | err = 0; \ | ||
123 | asm volatile( \ | ||
124 | "0: mvcs 0(%1,%2),%3,%0\n" \ | ||
125 | "1:\n" \ | ||
126 | __uaccess_fixup \ | ||
127 | : "+&d" (err) \ | ||
128 | : "d" (sizeof(*(ptr))), "a" (ptr), "Q" (x), \ | ||
129 | "K" (-EFAULT) \ | ||
130 | : __uaccess_clobber ); \ | ||
131 | }) | ||
132 | #else | ||
133 | #define __put_user_asm(x, ptr, err) \ | ||
134 | ({ \ | ||
135 | err = 0; \ | ||
136 | asm volatile( \ | ||
137 | "0: mvcs 0(%1,%2),0(%3),%0\n" \ | ||
138 | "1:\n" \ | ||
139 | __uaccess_fixup \ | ||
140 | : "+&d" (err) \ | ||
141 | : "d" (sizeof(*(ptr))), "a" (ptr), "a" (&(x)), \ | ||
142 | "K" (-EFAULT), "m" (x) \ | ||
143 | : __uaccess_clobber ); \ | ||
144 | }) | ||
145 | #endif | ||
146 | |||
147 | #define __put_user(x, ptr) \ | 121 | #define __put_user(x, ptr) \ |
148 | ({ \ | 122 | ({ \ |
149 | __typeof__(*(ptr)) __x = (x); \ | 123 | __typeof__(*(ptr)) __x = (x); \ |
150 | int __pu_err; \ | 124 | int __pu_err = -EFAULT; \ |
151 | __chk_user_ptr(ptr); \ | 125 | __chk_user_ptr(ptr); \ |
152 | switch (sizeof (*(ptr))) { \ | 126 | switch (sizeof (*(ptr))) { \ |
153 | case 1: \ | 127 | case 1: \ |
154 | case 2: \ | 128 | case 2: \ |
155 | case 4: \ | 129 | case 4: \ |
156 | case 8: \ | 130 | case 8: \ |
157 | __put_user_asm(__x, ptr, __pu_err); \ | 131 | __pu_err = __put_user_fn(sizeof (*(ptr)), \ |
132 | ptr, &__x); \ | ||
158 | break; \ | 133 | break; \ |
159 | default: \ | 134 | default: \ |
160 | __put_user_bad(); \ | 135 | __put_user_bad(); \ |
@@ -172,60 +147,36 @@ struct exception_table_entry | |||
172 | 147 | ||
173 | extern int __put_user_bad(void) __attribute__((noreturn)); | 148 | extern int __put_user_bad(void) __attribute__((noreturn)); |
174 | 149 | ||
175 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
176 | #define __get_user_asm(x, ptr, err) \ | ||
177 | ({ \ | ||
178 | err = 0; \ | ||
179 | asm volatile ( \ | ||
180 | "0: mvcp %O1(%2,%R1),0(%3),%0\n" \ | ||
181 | "1:\n" \ | ||
182 | __uaccess_fixup \ | ||
183 | : "+&d" (err), "=Q" (x) \ | ||
184 | : "d" (sizeof(*(ptr))), "a" (ptr), \ | ||
185 | "K" (-EFAULT) \ | ||
186 | : __uaccess_clobber ); \ | ||
187 | }) | ||
188 | #else | ||
189 | #define __get_user_asm(x, ptr, err) \ | ||
190 | ({ \ | ||
191 | err = 0; \ | ||
192 | asm volatile ( \ | ||
193 | "0: mvcp 0(%2,%5),0(%3),%0\n" \ | ||
194 | "1:\n" \ | ||
195 | __uaccess_fixup \ | ||
196 | : "+&d" (err), "=m" (x) \ | ||
197 | : "d" (sizeof(*(ptr))), "a" (ptr), \ | ||
198 | "K" (-EFAULT), "a" (&(x)) \ | ||
199 | : __uaccess_clobber ); \ | ||
200 | }) | ||
201 | #endif | ||
202 | |||
203 | #define __get_user(x, ptr) \ | 150 | #define __get_user(x, ptr) \ |
204 | ({ \ | 151 | ({ \ |
205 | int __gu_err; \ | 152 | int __gu_err = -EFAULT; \ |
206 | __chk_user_ptr(ptr); \ | 153 | __chk_user_ptr(ptr); \ |
207 | switch (sizeof(*(ptr))) { \ | 154 | switch (sizeof(*(ptr))) { \ |
208 | case 1: { \ | 155 | case 1: { \ |
209 | unsigned char __x; \ | 156 | unsigned char __x; \ |
210 | __get_user_asm(__x, ptr, __gu_err); \ | 157 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
158 | ptr, &__x); \ | ||
211 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 159 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
212 | break; \ | 160 | break; \ |
213 | }; \ | 161 | }; \ |
214 | case 2: { \ | 162 | case 2: { \ |
215 | unsigned short __x; \ | 163 | unsigned short __x; \ |
216 | __get_user_asm(__x, ptr, __gu_err); \ | 164 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
165 | ptr, &__x); \ | ||
217 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 166 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
218 | break; \ | 167 | break; \ |
219 | }; \ | 168 | }; \ |
220 | case 4: { \ | 169 | case 4: { \ |
221 | unsigned int __x; \ | 170 | unsigned int __x; \ |
222 | __get_user_asm(__x, ptr, __gu_err); \ | 171 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
172 | ptr, &__x); \ | ||
223 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 173 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
224 | break; \ | 174 | break; \ |
225 | }; \ | 175 | }; \ |
226 | case 8: { \ | 176 | case 8: { \ |
227 | unsigned long long __x; \ | 177 | unsigned long long __x; \ |
228 | __get_user_asm(__x, ptr, __gu_err); \ | 178 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
179 | ptr, &__x); \ | ||
229 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 180 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
230 | break; \ | 181 | break; \ |
231 | }; \ | 182 | }; \ |
@@ -247,8 +198,6 @@ extern int __get_user_bad(void) __attribute__((noreturn)); | |||
247 | #define __put_user_unaligned __put_user | 198 | #define __put_user_unaligned __put_user |
248 | #define __get_user_unaligned __get_user | 199 | #define __get_user_unaligned __get_user |
249 | 200 | ||
250 | extern long __copy_to_user_asm(const void *from, long n, void __user *to); | ||
251 | |||
252 | /** | 201 | /** |
253 | * __copy_to_user: - Copy a block of data into user space, with less checking. | 202 | * __copy_to_user: - Copy a block of data into user space, with less checking. |
254 | * @to: Destination address, in user space. | 203 | * @to: Destination address, in user space. |
@@ -266,7 +215,10 @@ extern long __copy_to_user_asm(const void *from, long n, void __user *to); | |||
266 | static inline unsigned long | 215 | static inline unsigned long |
267 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 216 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
268 | { | 217 | { |
269 | return __copy_to_user_asm(from, n, to); | 218 | if (__builtin_constant_p(n) && (n <= 256)) |
219 | return uaccess.copy_to_user_small(n, to, from); | ||
220 | else | ||
221 | return uaccess.copy_to_user(n, to, from); | ||
270 | } | 222 | } |
271 | 223 | ||
272 | #define __copy_to_user_inatomic __copy_to_user | 224 | #define __copy_to_user_inatomic __copy_to_user |
@@ -294,8 +246,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n) | |||
294 | return n; | 246 | return n; |
295 | } | 247 | } |
296 | 248 | ||
297 | extern long __copy_from_user_asm(void *to, long n, const void __user *from); | ||
298 | |||
299 | /** | 249 | /** |
300 | * __copy_from_user: - Copy a block of data from user space, with less checking. | 250 | * __copy_from_user: - Copy a block of data from user space, with less checking. |
301 | * @to: Destination address, in kernel space. | 251 | * @to: Destination address, in kernel space. |
@@ -316,7 +266,10 @@ extern long __copy_from_user_asm(void *to, long n, const void __user *from); | |||
316 | static inline unsigned long | 266 | static inline unsigned long |
317 | __copy_from_user(void *to, const void __user *from, unsigned long n) | 267 | __copy_from_user(void *to, const void __user *from, unsigned long n) |
318 | { | 268 | { |
319 | return __copy_from_user_asm(to, n, from); | 269 | if (__builtin_constant_p(n) && (n <= 256)) |
270 | return uaccess.copy_from_user_small(n, from, to); | ||
271 | else | ||
272 | return uaccess.copy_from_user(n, from, to); | ||
320 | } | 273 | } |
321 | 274 | ||
322 | /** | 275 | /** |
@@ -346,13 +299,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
346 | return n; | 299 | return n; |
347 | } | 300 | } |
348 | 301 | ||
349 | extern unsigned long __copy_in_user_asm(const void __user *from, long n, | ||
350 | void __user *to); | ||
351 | |||
352 | static inline unsigned long | 302 | static inline unsigned long |
353 | __copy_in_user(void __user *to, const void __user *from, unsigned long n) | 303 | __copy_in_user(void __user *to, const void __user *from, unsigned long n) |
354 | { | 304 | { |
355 | return __copy_in_user_asm(from, n, to); | 305 | return uaccess.copy_in_user(n, to, from); |
356 | } | 306 | } |
357 | 307 | ||
358 | static inline unsigned long | 308 | static inline unsigned long |
@@ -360,34 +310,28 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n) | |||
360 | { | 310 | { |
361 | might_sleep(); | 311 | might_sleep(); |
362 | if (__access_ok(from,n) && __access_ok(to,n)) | 312 | if (__access_ok(from,n) && __access_ok(to,n)) |
363 | n = __copy_in_user_asm(from, n, to); | 313 | n = __copy_in_user(to, from, n); |
364 | return n; | 314 | return n; |
365 | } | 315 | } |
366 | 316 | ||
367 | /* | 317 | /* |
368 | * Copy a null terminated string from userspace. | 318 | * Copy a null terminated string from userspace. |
369 | */ | 319 | */ |
370 | extern long __strncpy_from_user_asm(long count, char *dst, | ||
371 | const char __user *src); | ||
372 | |||
373 | static inline long | 320 | static inline long |
374 | strncpy_from_user(char *dst, const char __user *src, long count) | 321 | strncpy_from_user(char *dst, const char __user *src, long count) |
375 | { | 322 | { |
376 | long res = -EFAULT; | 323 | long res = -EFAULT; |
377 | might_sleep(); | 324 | might_sleep(); |
378 | if (access_ok(VERIFY_READ, src, 1)) | 325 | if (access_ok(VERIFY_READ, src, 1)) |
379 | res = __strncpy_from_user_asm(count, dst, src); | 326 | res = uaccess.strncpy_from_user(count, src, dst); |
380 | return res; | 327 | return res; |
381 | } | 328 | } |
382 | 329 | ||
383 | |||
384 | extern long __strnlen_user_asm(long count, const char __user *src); | ||
385 | |||
386 | static inline unsigned long | 330 | static inline unsigned long |
387 | strnlen_user(const char __user * src, unsigned long n) | 331 | strnlen_user(const char __user * src, unsigned long n) |
388 | { | 332 | { |
389 | might_sleep(); | 333 | might_sleep(); |
390 | return __strnlen_user_asm(n, src); | 334 | return uaccess.strnlen_user(n, src); |
391 | } | 335 | } |
392 | 336 | ||
393 | /** | 337 | /** |
@@ -410,12 +354,10 @@ strnlen_user(const char __user * src, unsigned long n) | |||
410 | * Zero Userspace | 354 | * Zero Userspace |
411 | */ | 355 | */ |
412 | 356 | ||
413 | extern long __clear_user_asm(void __user *to, long n); | ||
414 | |||
415 | static inline unsigned long | 357 | static inline unsigned long |
416 | __clear_user(void __user *to, unsigned long n) | 358 | __clear_user(void __user *to, unsigned long n) |
417 | { | 359 | { |
418 | return __clear_user_asm(to, n); | 360 | return uaccess.clear_user(n, to); |
419 | } | 361 | } |
420 | 362 | ||
421 | static inline unsigned long | 363 | static inline unsigned long |
@@ -423,7 +365,7 @@ clear_user(void __user *to, unsigned long n) | |||
423 | { | 365 | { |
424 | might_sleep(); | 366 | might_sleep(); |
425 | if (access_ok(VERIFY_WRITE, to, n)) | 367 | if (access_ok(VERIFY_WRITE, to, n)) |
426 | n = __clear_user_asm(to, n); | 368 | n = uaccess.clear_user(n, to); |
427 | return n; | 369 | return n; |
428 | } | 370 | } |
429 | 371 | ||
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index aa7a243862e1..02b942d85c37 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -25,17 +25,12 @@ | |||
25 | #define __NR_unlink 10 | 25 | #define __NR_unlink 10 |
26 | #define __NR_execve 11 | 26 | #define __NR_execve 11 |
27 | #define __NR_chdir 12 | 27 | #define __NR_chdir 12 |
28 | #define __NR_time 13 | ||
29 | #define __NR_mknod 14 | 28 | #define __NR_mknod 14 |
30 | #define __NR_chmod 15 | 29 | #define __NR_chmod 15 |
31 | #define __NR_lchown 16 | ||
32 | #define __NR_lseek 19 | 30 | #define __NR_lseek 19 |
33 | #define __NR_getpid 20 | 31 | #define __NR_getpid 20 |
34 | #define __NR_mount 21 | 32 | #define __NR_mount 21 |
35 | #define __NR_umount 22 | 33 | #define __NR_umount 22 |
36 | #define __NR_setuid 23 | ||
37 | #define __NR_getuid 24 | ||
38 | #define __NR_stime 25 | ||
39 | #define __NR_ptrace 26 | 34 | #define __NR_ptrace 26 |
40 | #define __NR_alarm 27 | 35 | #define __NR_alarm 27 |
41 | #define __NR_pause 29 | 36 | #define __NR_pause 29 |
@@ -51,11 +46,7 @@ | |||
51 | #define __NR_pipe 42 | 46 | #define __NR_pipe 42 |
52 | #define __NR_times 43 | 47 | #define __NR_times 43 |
53 | #define __NR_brk 45 | 48 | #define __NR_brk 45 |
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | 49 | #define __NR_signal 48 |
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | 50 | #define __NR_acct 51 |
60 | #define __NR_umount2 52 | 51 | #define __NR_umount2 52 |
61 | #define __NR_ioctl 54 | 52 | #define __NR_ioctl 54 |
@@ -69,18 +60,13 @@ | |||
69 | #define __NR_getpgrp 65 | 60 | #define __NR_getpgrp 65 |
70 | #define __NR_setsid 66 | 61 | #define __NR_setsid 66 |
71 | #define __NR_sigaction 67 | 62 | #define __NR_sigaction 67 |
72 | #define __NR_setreuid 70 | ||
73 | #define __NR_setregid 71 | ||
74 | #define __NR_sigsuspend 72 | 63 | #define __NR_sigsuspend 72 |
75 | #define __NR_sigpending 73 | 64 | #define __NR_sigpending 73 |
76 | #define __NR_sethostname 74 | 65 | #define __NR_sethostname 74 |
77 | #define __NR_setrlimit 75 | 66 | #define __NR_setrlimit 75 |
78 | #define __NR_getrlimit 76 | ||
79 | #define __NR_getrusage 77 | 67 | #define __NR_getrusage 77 |
80 | #define __NR_gettimeofday 78 | 68 | #define __NR_gettimeofday 78 |
81 | #define __NR_settimeofday 79 | 69 | #define __NR_settimeofday 79 |
82 | #define __NR_getgroups 80 | ||
83 | #define __NR_setgroups 81 | ||
84 | #define __NR_symlink 83 | 70 | #define __NR_symlink 83 |
85 | #define __NR_readlink 85 | 71 | #define __NR_readlink 85 |
86 | #define __NR_uselib 86 | 72 | #define __NR_uselib 86 |
@@ -92,12 +78,10 @@ | |||
92 | #define __NR_truncate 92 | 78 | #define __NR_truncate 92 |
93 | #define __NR_ftruncate 93 | 79 | #define __NR_ftruncate 93 |
94 | #define __NR_fchmod 94 | 80 | #define __NR_fchmod 94 |
95 | #define __NR_fchown 95 | ||
96 | #define __NR_getpriority 96 | 81 | #define __NR_getpriority 96 |
97 | #define __NR_setpriority 97 | 82 | #define __NR_setpriority 97 |
98 | #define __NR_statfs 99 | 83 | #define __NR_statfs 99 |
99 | #define __NR_fstatfs 100 | 84 | #define __NR_fstatfs 100 |
100 | #define __NR_ioperm 101 | ||
101 | #define __NR_socketcall 102 | 85 | #define __NR_socketcall 102 |
102 | #define __NR_syslog 103 | 86 | #define __NR_syslog 103 |
103 | #define __NR_setitimer 104 | 87 | #define __NR_setitimer 104 |
@@ -131,11 +115,7 @@ | |||
131 | #define __NR_sysfs 135 | 115 | #define __NR_sysfs 135 |
132 | #define __NR_personality 136 | 116 | #define __NR_personality 136 |
133 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | 117 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ |
134 | #define __NR_setfsuid 138 | ||
135 | #define __NR_setfsgid 139 | ||
136 | #define __NR__llseek 140 | ||
137 | #define __NR_getdents 141 | 118 | #define __NR_getdents 141 |
138 | #define __NR__newselect 142 | ||
139 | #define __NR_flock 143 | 119 | #define __NR_flock 143 |
140 | #define __NR_msync 144 | 120 | #define __NR_msync 144 |
141 | #define __NR_readv 145 | 121 | #define __NR_readv 145 |
@@ -157,13 +137,9 @@ | |||
157 | #define __NR_sched_rr_get_interval 161 | 137 | #define __NR_sched_rr_get_interval 161 |
158 | #define __NR_nanosleep 162 | 138 | #define __NR_nanosleep 162 |
159 | #define __NR_mremap 163 | 139 | #define __NR_mremap 163 |
160 | #define __NR_setresuid 164 | ||
161 | #define __NR_getresuid 165 | ||
162 | #define __NR_query_module 167 | 140 | #define __NR_query_module 167 |
163 | #define __NR_poll 168 | 141 | #define __NR_poll 168 |
164 | #define __NR_nfsservctl 169 | 142 | #define __NR_nfsservctl 169 |
165 | #define __NR_setresgid 170 | ||
166 | #define __NR_getresgid 171 | ||
167 | #define __NR_prctl 172 | 143 | #define __NR_prctl 172 |
168 | #define __NR_rt_sigreturn 173 | 144 | #define __NR_rt_sigreturn 173 |
169 | #define __NR_rt_sigaction 174 | 145 | #define __NR_rt_sigaction 174 |
@@ -174,7 +150,6 @@ | |||
174 | #define __NR_rt_sigsuspend 179 | 150 | #define __NR_rt_sigsuspend 179 |
175 | #define __NR_pread64 180 | 151 | #define __NR_pread64 180 |
176 | #define __NR_pwrite64 181 | 152 | #define __NR_pwrite64 181 |
177 | #define __NR_chown 182 | ||
178 | #define __NR_getcwd 183 | 153 | #define __NR_getcwd 183 |
179 | #define __NR_capget 184 | 154 | #define __NR_capget 184 |
180 | #define __NR_capset 185 | 155 | #define __NR_capset 185 |
@@ -183,39 +158,11 @@ | |||
183 | #define __NR_getpmsg 188 | 158 | #define __NR_getpmsg 188 |
184 | #define __NR_putpmsg 189 | 159 | #define __NR_putpmsg 189 |
185 | #define __NR_vfork 190 | 160 | #define __NR_vfork 190 |
186 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
187 | #define __NR_mmap2 192 | ||
188 | #define __NR_truncate64 193 | ||
189 | #define __NR_ftruncate64 194 | ||
190 | #define __NR_stat64 195 | ||
191 | #define __NR_lstat64 196 | ||
192 | #define __NR_fstat64 197 | ||
193 | #define __NR_lchown32 198 | ||
194 | #define __NR_getuid32 199 | ||
195 | #define __NR_getgid32 200 | ||
196 | #define __NR_geteuid32 201 | ||
197 | #define __NR_getegid32 202 | ||
198 | #define __NR_setreuid32 203 | ||
199 | #define __NR_setregid32 204 | ||
200 | #define __NR_getgroups32 205 | ||
201 | #define __NR_setgroups32 206 | ||
202 | #define __NR_fchown32 207 | ||
203 | #define __NR_setresuid32 208 | ||
204 | #define __NR_getresuid32 209 | ||
205 | #define __NR_setresgid32 210 | ||
206 | #define __NR_getresgid32 211 | ||
207 | #define __NR_chown32 212 | ||
208 | #define __NR_setuid32 213 | ||
209 | #define __NR_setgid32 214 | ||
210 | #define __NR_setfsuid32 215 | ||
211 | #define __NR_setfsgid32 216 | ||
212 | #define __NR_pivot_root 217 | 161 | #define __NR_pivot_root 217 |
213 | #define __NR_mincore 218 | 162 | #define __NR_mincore 218 |
214 | #define __NR_madvise 219 | 163 | #define __NR_madvise 219 |
215 | #define __NR_getdents64 220 | 164 | #define __NR_getdents64 220 |
216 | #define __NR_fcntl64 221 | ||
217 | #define __NR_readahead 222 | 165 | #define __NR_readahead 222 |
218 | #define __NR_sendfile64 223 | ||
219 | #define __NR_setxattr 224 | 166 | #define __NR_setxattr 224 |
220 | #define __NR_lsetxattr 225 | 167 | #define __NR_lsetxattr 225 |
221 | #define __NR_fsetxattr 226 | 168 | #define __NR_fsetxattr 226 |
@@ -256,7 +203,6 @@ | |||
256 | #define __NR_clock_getres (__NR_timer_create+7) | 203 | #define __NR_clock_getres (__NR_timer_create+7) |
257 | #define __NR_clock_nanosleep (__NR_timer_create+8) | 204 | #define __NR_clock_nanosleep (__NR_timer_create+8) |
258 | /* Number 263 is reserved for vserver */ | 205 | /* Number 263 is reserved for vserver */ |
259 | #define __NR_fadvise64_64 264 | ||
260 | #define __NR_statfs64 265 | 206 | #define __NR_statfs64 265 |
261 | #define __NR_fstatfs64 266 | 207 | #define __NR_fstatfs64 266 |
262 | #define __NR_remap_file_pages 267 | 208 | #define __NR_remap_file_pages 267 |
@@ -285,7 +231,6 @@ | |||
285 | #define __NR_mknodat 290 | 231 | #define __NR_mknodat 290 |
286 | #define __NR_fchownat 291 | 232 | #define __NR_fchownat 291 |
287 | #define __NR_futimesat 292 | 233 | #define __NR_futimesat 292 |
288 | #define __NR_fstatat64 293 | ||
289 | #define __NR_unlinkat 294 | 234 | #define __NR_unlinkat 294 |
290 | #define __NR_renameat 295 | 235 | #define __NR_renameat 295 |
291 | #define __NR_linkat 296 | 236 | #define __NR_linkat 296 |
@@ -310,62 +255,65 @@ | |||
310 | * have a different name although they do the same (e.g. __NR_chown32 | 255 | * have a different name although they do the same (e.g. __NR_chown32 |
311 | * is __NR_chown on 64 bit). | 256 | * is __NR_chown on 64 bit). |
312 | */ | 257 | */ |
313 | #ifdef __s390x__ | 258 | #ifndef __s390x__ |
314 | #undef __NR_time | 259 | |
315 | #undef __NR_lchown | 260 | #define __NR_time 13 |
316 | #undef __NR_setuid | 261 | #define __NR_lchown 16 |
317 | #undef __NR_getuid | 262 | #define __NR_setuid 23 |
318 | #undef __NR_stime | 263 | #define __NR_getuid 24 |
319 | #undef __NR_setgid | 264 | #define __NR_stime 25 |
320 | #undef __NR_getgid | 265 | #define __NR_setgid 46 |
321 | #undef __NR_geteuid | 266 | #define __NR_getgid 47 |
322 | #undef __NR_getegid | 267 | #define __NR_geteuid 49 |
323 | #undef __NR_setreuid | 268 | #define __NR_getegid 50 |
324 | #undef __NR_setregid | 269 | #define __NR_setreuid 70 |
325 | #undef __NR_getrlimit | 270 | #define __NR_setregid 71 |
326 | #undef __NR_getgroups | 271 | #define __NR_getrlimit 76 |
327 | #undef __NR_setgroups | 272 | #define __NR_getgroups 80 |
328 | #undef __NR_fchown | 273 | #define __NR_setgroups 81 |
329 | #undef __NR_ioperm | 274 | #define __NR_fchown 95 |
330 | #undef __NR_setfsuid | 275 | #define __NR_ioperm 101 |
331 | #undef __NR_setfsgid | 276 | #define __NR_setfsuid 138 |
332 | #undef __NR__llseek | 277 | #define __NR_setfsgid 139 |
333 | #undef __NR__newselect | 278 | #define __NR__llseek 140 |
334 | #undef __NR_setresuid | 279 | #define __NR__newselect 142 |
335 | #undef __NR_getresuid | 280 | #define __NR_setresuid 164 |
336 | #undef __NR_setresgid | 281 | #define __NR_getresuid 165 |
337 | #undef __NR_getresgid | 282 | #define __NR_setresgid 170 |
338 | #undef __NR_chown | 283 | #define __NR_getresgid 171 |
339 | #undef __NR_ugetrlimit | 284 | #define __NR_chown 182 |
340 | #undef __NR_mmap2 | 285 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ |
341 | #undef __NR_truncate64 | 286 | #define __NR_mmap2 192 |
342 | #undef __NR_ftruncate64 | 287 | #define __NR_truncate64 193 |
343 | #undef __NR_stat64 | 288 | #define __NR_ftruncate64 194 |
344 | #undef __NR_lstat64 | 289 | #define __NR_stat64 195 |
345 | #undef __NR_fstat64 | 290 | #define __NR_lstat64 196 |
346 | #undef __NR_lchown32 | 291 | #define __NR_fstat64 197 |
347 | #undef __NR_getuid32 | 292 | #define __NR_lchown32 198 |
348 | #undef __NR_getgid32 | 293 | #define __NR_getuid32 199 |
349 | #undef __NR_geteuid32 | 294 | #define __NR_getgid32 200 |
350 | #undef __NR_getegid32 | 295 | #define __NR_geteuid32 201 |
351 | #undef __NR_setreuid32 | 296 | #define __NR_getegid32 202 |
352 | #undef __NR_setregid32 | 297 | #define __NR_setreuid32 203 |
353 | #undef __NR_getgroups32 | 298 | #define __NR_setregid32 204 |
354 | #undef __NR_setgroups32 | 299 | #define __NR_getgroups32 205 |
355 | #undef __NR_fchown32 | 300 | #define __NR_setgroups32 206 |
356 | #undef __NR_setresuid32 | 301 | #define __NR_fchown32 207 |
357 | #undef __NR_getresuid32 | 302 | #define __NR_setresuid32 208 |
358 | #undef __NR_setresgid32 | 303 | #define __NR_getresuid32 209 |
359 | #undef __NR_getresgid32 | 304 | #define __NR_setresgid32 210 |
360 | #undef __NR_chown32 | 305 | #define __NR_getresgid32 211 |
361 | #undef __NR_setuid32 | 306 | #define __NR_chown32 212 |
362 | #undef __NR_setgid32 | 307 | #define __NR_setuid32 213 |
363 | #undef __NR_setfsuid32 | 308 | #define __NR_setgid32 214 |
364 | #undef __NR_setfsgid32 | 309 | #define __NR_setfsuid32 215 |
365 | #undef __NR_fcntl64 | 310 | #define __NR_setfsgid32 216 |
366 | #undef __NR_sendfile64 | 311 | #define __NR_fcntl64 221 |
367 | #undef __NR_fadvise64_64 | 312 | #define __NR_sendfile64 223 |
368 | #undef __NR_fstatat64 | 313 | #define __NR_fadvise64_64 264 |
314 | #define __NR_fstatat64 293 | ||
315 | |||
316 | #else | ||
369 | 317 | ||
370 | #define __NR_select 142 | 318 | #define __NR_select 142 |
371 | #define __NR_getrlimit 191 /* SuS compliant getrlimit */ | 319 | #define __NR_getrlimit 191 /* SuS compliant getrlimit */ |
diff --git a/include/asm-s390/z90crypt.h b/include/asm-s390/z90crypt.h deleted file mode 100644 index 31a2439b07bd..000000000000 --- a/include/asm-s390/z90crypt.h +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-s390/z90crypt.h | ||
3 | * | ||
4 | * z90crypt 1.3.3 (user-visible header) | ||
5 | * | ||
6 | * Copyright (C) 2001, 2005 IBM Corporation | ||
7 | * Author(s): Robert Burroughs | ||
8 | * Eric Rossman (edrossma@us.ibm.com) | ||
9 | * | ||
10 | * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ASM_S390_Z90CRYPT_H | ||
28 | #define __ASM_S390_Z90CRYPT_H | ||
29 | #include <linux/ioctl.h> | ||
30 | |||
31 | #define z90crypt_VERSION 1 | ||
32 | #define z90crypt_RELEASE 3 // 2 = PCIXCC, 3 = rewrite for coding standards | ||
33 | #define z90crypt_VARIANT 3 // 3 = CEX2A support | ||
34 | |||
35 | /** | ||
36 | * struct ica_rsa_modexpo | ||
37 | * | ||
38 | * Requirements: | ||
39 | * - outputdatalength is at least as large as inputdatalength. | ||
40 | * - All key parts are right justified in their fields, padded on | ||
41 | * the left with zeroes. | ||
42 | * - length(b_key) = inputdatalength | ||
43 | * - length(n_modulus) = inputdatalength | ||
44 | */ | ||
45 | struct ica_rsa_modexpo { | ||
46 | char __user * inputdata; | ||
47 | unsigned int inputdatalength; | ||
48 | char __user * outputdata; | ||
49 | unsigned int outputdatalength; | ||
50 | char __user * b_key; | ||
51 | char __user * n_modulus; | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * struct ica_rsa_modexpo_crt | ||
56 | * | ||
57 | * Requirements: | ||
58 | * - inputdatalength is even. | ||
59 | * - outputdatalength is at least as large as inputdatalength. | ||
60 | * - All key parts are right justified in their fields, padded on | ||
61 | * the left with zeroes. | ||
62 | * - length(bp_key) = inputdatalength/2 + 8 | ||
63 | * - length(bq_key) = inputdatalength/2 | ||
64 | * - length(np_key) = inputdatalength/2 + 8 | ||
65 | * - length(nq_key) = inputdatalength/2 | ||
66 | * - length(u_mult_inv) = inputdatalength/2 + 8 | ||
67 | */ | ||
68 | struct ica_rsa_modexpo_crt { | ||
69 | char __user * inputdata; | ||
70 | unsigned int inputdatalength; | ||
71 | char __user * outputdata; | ||
72 | unsigned int outputdatalength; | ||
73 | char __user * bp_key; | ||
74 | char __user * bq_key; | ||
75 | char __user * np_prime; | ||
76 | char __user * nq_prime; | ||
77 | char __user * u_mult_inv; | ||
78 | }; | ||
79 | |||
80 | #define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks | ||
81 | |||
82 | /** | ||
83 | * Interface notes: | ||
84 | * | ||
85 | * The ioctl()s which are implemented (along with relevant details) | ||
86 | * are: | ||
87 | * | ||
88 | * ICARSAMODEXPO | ||
89 | * Perform an RSA operation using a Modulus-Exponent pair | ||
90 | * This takes an ica_rsa_modexpo struct as its arg. | ||
91 | * | ||
92 | * NOTE: please refer to the comments preceding this structure | ||
93 | * for the implementation details for the contents of the | ||
94 | * block | ||
95 | * | ||
96 | * ICARSACRT | ||
97 | * Perform an RSA operation using a Chinese-Remainder Theorem key | ||
98 | * This takes an ica_rsa_modexpo_crt struct as its arg. | ||
99 | * | ||
100 | * NOTE: please refer to the comments preceding this structure | ||
101 | * for the implementation details for the contents of the | ||
102 | * block | ||
103 | * | ||
104 | * Z90STAT_TOTALCOUNT | ||
105 | * Return an integer count of all device types together. | ||
106 | * | ||
107 | * Z90STAT_PCICACOUNT | ||
108 | * Return an integer count of all PCICAs. | ||
109 | * | ||
110 | * Z90STAT_PCICCCOUNT | ||
111 | * Return an integer count of all PCICCs. | ||
112 | * | ||
113 | * Z90STAT_PCIXCCMCL2COUNT | ||
114 | * Return an integer count of all MCL2 PCIXCCs. | ||
115 | * | ||
116 | * Z90STAT_PCIXCCMCL3COUNT | ||
117 | * Return an integer count of all MCL3 PCIXCCs. | ||
118 | * | ||
119 | * Z90STAT_CEX2CCOUNT | ||
120 | * Return an integer count of all CEX2Cs. | ||
121 | * | ||
122 | * Z90STAT_CEX2ACOUNT | ||
123 | * Return an integer count of all CEX2As. | ||
124 | * | ||
125 | * Z90STAT_REQUESTQ_COUNT | ||
126 | * Return an integer count of the number of entries waiting to be | ||
127 | * sent to a device. | ||
128 | * | ||
129 | * Z90STAT_PENDINGQ_COUNT | ||
130 | * Return an integer count of the number of entries sent to a | ||
131 | * device awaiting the reply. | ||
132 | * | ||
133 | * Z90STAT_TOTALOPEN_COUNT | ||
134 | * Return an integer count of the number of open file handles. | ||
135 | * | ||
136 | * Z90STAT_DOMAIN_INDEX | ||
137 | * Return the integer value of the Cryptographic Domain. | ||
138 | * | ||
139 | * Z90STAT_STATUS_MASK | ||
140 | * Return an 64 element array of unsigned chars for the status of | ||
141 | * all devices. | ||
142 | * 0x01: PCICA | ||
143 | * 0x02: PCICC | ||
144 | * 0x03: PCIXCC_MCL2 | ||
145 | * 0x04: PCIXCC_MCL3 | ||
146 | * 0x05: CEX2C | ||
147 | * 0x06: CEX2A | ||
148 | * 0x0d: device is disabled via the proc filesystem | ||
149 | * | ||
150 | * Z90STAT_QDEPTH_MASK | ||
151 | * Return an 64 element array of unsigned chars for the queue | ||
152 | * depth of all devices. | ||
153 | * | ||
154 | * Z90STAT_PERDEV_REQCNT | ||
155 | * Return an 64 element array of unsigned integers for the number | ||
156 | * of successfully completed requests per device since the device | ||
157 | * was detected and made available. | ||
158 | * | ||
159 | * ICAZ90STATUS (deprecated) | ||
160 | * Return some device driver status in a ica_z90_status struct | ||
161 | * This takes an ica_z90_status struct as its arg. | ||
162 | * | ||
163 | * NOTE: this ioctl() is deprecated, and has been replaced with | ||
164 | * single ioctl()s for each type of status being requested | ||
165 | * | ||
166 | * Z90STAT_PCIXCCCOUNT (deprecated) | ||
167 | * Return an integer count of all PCIXCCs (MCL2 + MCL3). | ||
168 | * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from | ||
169 | * MCL2 PCIXCCs. | ||
170 | * | ||
171 | * Z90QUIESCE (not recommended) | ||
172 | * Quiesce the driver. This is intended to stop all new | ||
173 | * requests from being processed. Its use is NOT recommended, | ||
174 | * except in circumstances where there is no other way to stop | ||
175 | * callers from accessing the driver. Its original use was to | ||
176 | * allow the driver to be "drained" of work in preparation for | ||
177 | * a system shutdown. | ||
178 | * | ||
179 | * NOTE: once issued, this ban on new work cannot be undone | ||
180 | * except by unloading and reloading the driver. | ||
181 | */ | ||
182 | |||
183 | /** | ||
184 | * Supported ioctl calls | ||
185 | */ | ||
186 | #define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x05, 0) | ||
187 | #define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x06, 0) | ||
188 | |||
189 | /* DEPRECATED status calls (bound for removal at some point) */ | ||
190 | #define ICAZ90STATUS _IOR(Z90_IOCTL_MAGIC, 0x10, struct ica_z90_status) | ||
191 | #define Z90STAT_PCIXCCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x43, int) | ||
192 | |||
193 | /* unrelated to ICA callers */ | ||
194 | #define Z90QUIESCE _IO(Z90_IOCTL_MAGIC, 0x11) | ||
195 | |||
196 | /* New status calls */ | ||
197 | #define Z90STAT_TOTALCOUNT _IOR(Z90_IOCTL_MAGIC, 0x40, int) | ||
198 | #define Z90STAT_PCICACOUNT _IOR(Z90_IOCTL_MAGIC, 0x41, int) | ||
199 | #define Z90STAT_PCICCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x42, int) | ||
200 | #define Z90STAT_PCIXCCMCL2COUNT _IOR(Z90_IOCTL_MAGIC, 0x4b, int) | ||
201 | #define Z90STAT_PCIXCCMCL3COUNT _IOR(Z90_IOCTL_MAGIC, 0x4c, int) | ||
202 | #define Z90STAT_CEX2CCOUNT _IOR(Z90_IOCTL_MAGIC, 0x4d, int) | ||
203 | #define Z90STAT_CEX2ACOUNT _IOR(Z90_IOCTL_MAGIC, 0x4e, int) | ||
204 | #define Z90STAT_REQUESTQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x44, int) | ||
205 | #define Z90STAT_PENDINGQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x45, int) | ||
206 | #define Z90STAT_TOTALOPEN_COUNT _IOR(Z90_IOCTL_MAGIC, 0x46, int) | ||
207 | #define Z90STAT_DOMAIN_INDEX _IOR(Z90_IOCTL_MAGIC, 0x47, int) | ||
208 | #define Z90STAT_STATUS_MASK _IOR(Z90_IOCTL_MAGIC, 0x48, char[64]) | ||
209 | #define Z90STAT_QDEPTH_MASK _IOR(Z90_IOCTL_MAGIC, 0x49, char[64]) | ||
210 | #define Z90STAT_PERDEV_REQCNT _IOR(Z90_IOCTL_MAGIC, 0x4a, int[64]) | ||
211 | |||
212 | #endif /* __ASM_S390_Z90CRYPT_H */ | ||
diff --git a/include/asm-s390/zcrypt.h b/include/asm-s390/zcrypt.h new file mode 100644 index 000000000000..7244c68464f2 --- /dev/null +++ b/include/asm-s390/zcrypt.h | |||
@@ -0,0 +1,285 @@ | |||
1 | /* | ||
2 | * include/asm-s390/zcrypt.h | ||
3 | * | ||
4 | * zcrypt 2.1.0 (user-visible header) | ||
5 | * | ||
6 | * Copyright (C) 2001, 2006 IBM Corporation | ||
7 | * Author(s): Robert Burroughs | ||
8 | * Eric Rossman (edrossma@us.ibm.com) | ||
9 | * | ||
10 | * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ASM_S390_ZCRYPT_H | ||
28 | #define __ASM_S390_ZCRYPT_H | ||
29 | |||
30 | #define ZCRYPT_VERSION 2 | ||
31 | #define ZCRYPT_RELEASE 1 | ||
32 | #define ZCRYPT_VARIANT 0 | ||
33 | |||
34 | #include <linux/ioctl.h> | ||
35 | #include <linux/compiler.h> | ||
36 | |||
37 | /** | ||
38 | * struct ica_rsa_modexpo | ||
39 | * | ||
40 | * Requirements: | ||
41 | * - outputdatalength is at least as large as inputdatalength. | ||
42 | * - All key parts are right justified in their fields, padded on | ||
43 | * the left with zeroes. | ||
44 | * - length(b_key) = inputdatalength | ||
45 | * - length(n_modulus) = inputdatalength | ||
46 | */ | ||
47 | struct ica_rsa_modexpo { | ||
48 | char __user * inputdata; | ||
49 | unsigned int inputdatalength; | ||
50 | char __user * outputdata; | ||
51 | unsigned int outputdatalength; | ||
52 | char __user * b_key; | ||
53 | char __user * n_modulus; | ||
54 | }; | ||
55 | |||
56 | /** | ||
57 | * struct ica_rsa_modexpo_crt | ||
58 | * | ||
59 | * Requirements: | ||
60 | * - inputdatalength is even. | ||
61 | * - outputdatalength is at least as large as inputdatalength. | ||
62 | * - All key parts are right justified in their fields, padded on | ||
63 | * the left with zeroes. | ||
64 | * - length(bp_key) = inputdatalength/2 + 8 | ||
65 | * - length(bq_key) = inputdatalength/2 | ||
66 | * - length(np_key) = inputdatalength/2 + 8 | ||
67 | * - length(nq_key) = inputdatalength/2 | ||
68 | * - length(u_mult_inv) = inputdatalength/2 + 8 | ||
69 | */ | ||
70 | struct ica_rsa_modexpo_crt { | ||
71 | char __user * inputdata; | ||
72 | unsigned int inputdatalength; | ||
73 | char __user * outputdata; | ||
74 | unsigned int outputdatalength; | ||
75 | char __user * bp_key; | ||
76 | char __user * bq_key; | ||
77 | char __user * np_prime; | ||
78 | char __user * nq_prime; | ||
79 | char __user * u_mult_inv; | ||
80 | }; | ||
81 | |||
82 | /** | ||
83 | * CPRBX | ||
84 | * Note that all shorts and ints are big-endian. | ||
85 | * All pointer fields are 16 bytes long, and mean nothing. | ||
86 | * | ||
87 | * A request CPRB is followed by a request_parameter_block. | ||
88 | * | ||
89 | * The request (or reply) parameter block is organized thus: | ||
90 | * function code | ||
91 | * VUD block | ||
92 | * key block | ||
93 | */ | ||
94 | struct ica_CPRBX { | ||
95 | unsigned short cprb_len; /* CPRB length 220 */ | ||
96 | unsigned char cprb_ver_id; /* CPRB version id. 0x02 */ | ||
97 | unsigned char pad_000[3]; /* Alignment pad bytes */ | ||
98 | unsigned char func_id[2]; /* function id 0x5432 */ | ||
99 | unsigned char cprb_flags[4]; /* Flags */ | ||
100 | unsigned int req_parml; /* request parameter buffer len */ | ||
101 | unsigned int req_datal; /* request data buffer */ | ||
102 | unsigned int rpl_msgbl; /* reply message block length */ | ||
103 | unsigned int rpld_parml; /* replied parameter block len */ | ||
104 | unsigned int rpl_datal; /* reply data block len */ | ||
105 | unsigned int rpld_datal; /* replied data block len */ | ||
106 | unsigned int req_extbl; /* request extension block len */ | ||
107 | unsigned char pad_001[4]; /* reserved */ | ||
108 | unsigned int rpld_extbl; /* replied extension block len */ | ||
109 | unsigned char padx000[16 - sizeof (char *)]; | ||
110 | unsigned char * req_parmb; /* request parm block 'address' */ | ||
111 | unsigned char padx001[16 - sizeof (char *)]; | ||
112 | unsigned char * req_datab; /* request data block 'address' */ | ||
113 | unsigned char padx002[16 - sizeof (char *)]; | ||
114 | unsigned char * rpl_parmb; /* reply parm block 'address' */ | ||
115 | unsigned char padx003[16 - sizeof (char *)]; | ||
116 | unsigned char * rpl_datab; /* reply data block 'address' */ | ||
117 | unsigned char padx004[16 - sizeof (char *)]; | ||
118 | unsigned char * req_extb; /* request extension block 'addr'*/ | ||
119 | unsigned char padx005[16 - sizeof (char *)]; | ||
120 | unsigned char * rpl_extb; /* reply extension block 'addres'*/ | ||
121 | unsigned short ccp_rtcode; /* server return code */ | ||
122 | unsigned short ccp_rscode; /* server reason code */ | ||
123 | unsigned int mac_data_len; /* Mac Data Length */ | ||
124 | unsigned char logon_id[8]; /* Logon Identifier */ | ||
125 | unsigned char mac_value[8]; /* Mac Value */ | ||
126 | unsigned char mac_content_flgs;/* Mac content flag byte */ | ||
127 | unsigned char pad_002; /* Alignment */ | ||
128 | unsigned short domain; /* Domain */ | ||
129 | unsigned char usage_domain[4];/* Usage domain */ | ||
130 | unsigned char cntrl_domain[4];/* Control domain */ | ||
131 | unsigned char S390enf_mask[4];/* S/390 enforcement mask */ | ||
132 | unsigned char pad_004[36]; /* reserved */ | ||
133 | }; | ||
134 | |||
135 | /** | ||
136 | * xcRB | ||
137 | */ | ||
138 | struct ica_xcRB { | ||
139 | unsigned short agent_ID; | ||
140 | unsigned int user_defined; | ||
141 | unsigned short request_ID; | ||
142 | unsigned int request_control_blk_length; | ||
143 | unsigned char padding1[16 - sizeof (char *)]; | ||
144 | char __user * request_control_blk_addr; | ||
145 | unsigned int request_data_length; | ||
146 | char padding2[16 - sizeof (char *)]; | ||
147 | char __user * request_data_address; | ||
148 | unsigned int reply_control_blk_length; | ||
149 | char padding3[16 - sizeof (char *)]; | ||
150 | char __user * reply_control_blk_addr; | ||
151 | unsigned int reply_data_length; | ||
152 | char padding4[16 - sizeof (char *)]; | ||
153 | char __user * reply_data_addr; | ||
154 | unsigned short priority_window; | ||
155 | unsigned int status; | ||
156 | } __attribute__((packed)); | ||
157 | #define AUTOSELECT ((unsigned int)0xFFFFFFFF) | ||
158 | |||
159 | #define ZCRYPT_IOCTL_MAGIC 'z' | ||
160 | |||
161 | /** | ||
162 | * Interface notes: | ||
163 | * | ||
164 | * The ioctl()s which are implemented (along with relevant details) | ||
165 | * are: | ||
166 | * | ||
167 | * ICARSAMODEXPO | ||
168 | * Perform an RSA operation using a Modulus-Exponent pair | ||
169 | * This takes an ica_rsa_modexpo struct as its arg. | ||
170 | * | ||
171 | * NOTE: please refer to the comments preceding this structure | ||
172 | * for the implementation details for the contents of the | ||
173 | * block | ||
174 | * | ||
175 | * ICARSACRT | ||
176 | * Perform an RSA operation using a Chinese-Remainder Theorem key | ||
177 | * This takes an ica_rsa_modexpo_crt struct as its arg. | ||
178 | * | ||
179 | * NOTE: please refer to the comments preceding this structure | ||
180 | * for the implementation details for the contents of the | ||
181 | * block | ||
182 | * | ||
183 | * Z90STAT_TOTALCOUNT | ||
184 | * Return an integer count of all device types together. | ||
185 | * | ||
186 | * Z90STAT_PCICACOUNT | ||
187 | * Return an integer count of all PCICAs. | ||
188 | * | ||
189 | * Z90STAT_PCICCCOUNT | ||
190 | * Return an integer count of all PCICCs. | ||
191 | * | ||
192 | * Z90STAT_PCIXCCMCL2COUNT | ||
193 | * Return an integer count of all MCL2 PCIXCCs. | ||
194 | * | ||
195 | * Z90STAT_PCIXCCMCL3COUNT | ||
196 | * Return an integer count of all MCL3 PCIXCCs. | ||
197 | * | ||
198 | * Z90STAT_CEX2CCOUNT | ||
199 | * Return an integer count of all CEX2Cs. | ||
200 | * | ||
201 | * Z90STAT_CEX2ACOUNT | ||
202 | * Return an integer count of all CEX2As. | ||
203 | * | ||
204 | * Z90STAT_REQUESTQ_COUNT | ||
205 | * Return an integer count of the number of entries waiting to be | ||
206 | * sent to a device. | ||
207 | * | ||
208 | * Z90STAT_PENDINGQ_COUNT | ||
209 | * Return an integer count of the number of entries sent to a | ||
210 | * device awaiting the reply. | ||
211 | * | ||
212 | * Z90STAT_TOTALOPEN_COUNT | ||
213 | * Return an integer count of the number of open file handles. | ||
214 | * | ||
215 | * Z90STAT_DOMAIN_INDEX | ||
216 | * Return the integer value of the Cryptographic Domain. | ||
217 | * | ||
218 | * Z90STAT_STATUS_MASK | ||
219 | * Return an 64 element array of unsigned chars for the status of | ||
220 | * all devices. | ||
221 | * 0x01: PCICA | ||
222 | * 0x02: PCICC | ||
223 | * 0x03: PCIXCC_MCL2 | ||
224 | * 0x04: PCIXCC_MCL3 | ||
225 | * 0x05: CEX2C | ||
226 | * 0x06: CEX2A | ||
227 | * 0x0d: device is disabled via the proc filesystem | ||
228 | * | ||
229 | * Z90STAT_QDEPTH_MASK | ||
230 | * Return an 64 element array of unsigned chars for the queue | ||
231 | * depth of all devices. | ||
232 | * | ||
233 | * Z90STAT_PERDEV_REQCNT | ||
234 | * Return an 64 element array of unsigned integers for the number | ||
235 | * of successfully completed requests per device since the device | ||
236 | * was detected and made available. | ||
237 | * | ||
238 | * ICAZ90STATUS (deprecated) | ||
239 | * Return some device driver status in a ica_z90_status struct | ||
240 | * This takes an ica_z90_status struct as its arg. | ||
241 | * | ||
242 | * NOTE: this ioctl() is deprecated, and has been replaced with | ||
243 | * single ioctl()s for each type of status being requested | ||
244 | * | ||
245 | * Z90STAT_PCIXCCCOUNT (deprecated) | ||
246 | * Return an integer count of all PCIXCCs (MCL2 + MCL3). | ||
247 | * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from | ||
248 | * MCL2 PCIXCCs. | ||
249 | * | ||
250 | * Z90QUIESCE (not recommended) | ||
251 | * Quiesce the driver. This is intended to stop all new | ||
252 | * requests from being processed. Its use is NOT recommended, | ||
253 | * except in circumstances where there is no other way to stop | ||
254 | * callers from accessing the driver. Its original use was to | ||
255 | * allow the driver to be "drained" of work in preparation for | ||
256 | * a system shutdown. | ||
257 | * | ||
258 | * NOTE: once issued, this ban on new work cannot be undone | ||
259 | * except by unloading and reloading the driver. | ||
260 | */ | ||
261 | |||
262 | /** | ||
263 | * Supported ioctl calls | ||
264 | */ | ||
265 | #define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0) | ||
266 | #define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0) | ||
267 | #define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0) | ||
268 | |||
269 | /* New status calls */ | ||
270 | #define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int) | ||
271 | #define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int) | ||
272 | #define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int) | ||
273 | #define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int) | ||
274 | #define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int) | ||
275 | #define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int) | ||
276 | #define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int) | ||
277 | #define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int) | ||
278 | #define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int) | ||
279 | #define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int) | ||
280 | #define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int) | ||
281 | #define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64]) | ||
282 | #define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64]) | ||
283 | #define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64]) | ||
284 | |||
285 | #endif /* __ASM_S390_ZCRYPT_H */ | ||