aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm')
-rw-r--r--arch/s390/include/asm/appldata.h2
-rw-r--r--arch/s390/include/asm/chsc.h28
-rw-r--r--arch/s390/include/asm/cio.h28
-rw-r--r--arch/s390/include/asm/cmpxchg.h61
-rw-r--r--arch/s390/include/asm/cpu_mf.h4
-rw-r--r--arch/s390/include/asm/cputime.h3
-rw-r--r--arch/s390/include/asm/css_chars.h39
-rw-r--r--arch/s390/include/asm/eadm.h124
-rw-r--r--arch/s390/include/asm/elf.h3
-rw-r--r--arch/s390/include/asm/etr.h8
-rw-r--r--arch/s390/include/asm/irq.h2
-rw-r--r--arch/s390/include/asm/isc.h1
-rw-r--r--arch/s390/include/asm/lowcore.h6
-rw-r--r--arch/s390/include/asm/mmu_context.h2
-rw-r--r--arch/s390/include/asm/percpu.h50
-rw-r--r--arch/s390/include/asm/processor.h59
-rw-r--r--arch/s390/include/asm/ptrace.h12
-rw-r--r--arch/s390/include/asm/runtime_instr.h98
-rw-r--r--arch/s390/include/asm/scsw.h38
-rw-r--r--arch/s390/include/asm/setup.h5
-rw-r--r--arch/s390/include/asm/smp.h4
-rw-r--r--arch/s390/include/asm/string.h8
-rw-r--r--arch/s390/include/asm/switch_to.h6
-rw-r--r--arch/s390/include/asm/sysinfo.h39
-rw-r--r--arch/s390/include/asm/topology.h20
-rw-r--r--arch/s390/include/asm/uaccess.h15
-rw-r--r--arch/s390/include/asm/unistd.h4
27 files changed, 550 insertions, 119 deletions
diff --git a/arch/s390/include/asm/appldata.h b/arch/s390/include/asm/appldata.h
index f328294faea..32a70598715 100644
--- a/arch/s390/include/asm/appldata.h
+++ b/arch/s390/include/asm/appldata.h
@@ -70,7 +70,7 @@ static inline int appldata_asm(struct appldata_product_id *id,
70 int ry; 70 int ry;
71 71
72 if (!MACHINE_IS_VM) 72 if (!MACHINE_IS_VM)
73 return -ENOSYS; 73 return -EOPNOTSUPP;
74 parm_list.diag = 0xdc; 74 parm_list.diag = 0xdc;
75 parm_list.function = fn; 75 parm_list.function = fn;
76 parm_list.parlist_length = sizeof(parm_list); 76 parm_list.parlist_length = sizeof(parm_list);
diff --git a/arch/s390/include/asm/chsc.h b/arch/s390/include/asm/chsc.h
index bf115b49f44..aea451fd182 100644
--- a/arch/s390/include/asm/chsc.h
+++ b/arch/s390/include/asm/chsc.h
@@ -125,32 +125,4 @@ struct chsc_cpd_info {
125#define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info) 125#define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info)
126#define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal) 126#define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal)
127 127
128#ifdef __KERNEL__
129
130struct css_general_char {
131 u64 : 12;
132 u32 dynio : 1; /* bit 12 */
133 u32 : 28;
134 u32 aif : 1; /* bit 41 */
135 u32 : 3;
136 u32 mcss : 1; /* bit 45 */
137 u32 fcs : 1; /* bit 46 */
138 u32 : 1;
139 u32 ext_mb : 1; /* bit 48 */
140 u32 : 7;
141 u32 aif_tdd : 1; /* bit 56 */
142 u32 : 1;
143 u32 qebsm : 1; /* bit 58 */
144 u32 : 8;
145 u32 aif_osa : 1; /* bit 67 */
146 u32 : 14;
147 u32 cib : 1; /* bit 82 */
148 u32 : 5;
149 u32 fcx : 1; /* bit 88 */
150 u32 : 7;
151}__attribute__((packed));
152
153extern struct css_general_char css_general_characteristics;
154
155#endif /* __KERNEL__ */
156#endif 128#endif
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h
index 77043aa44d6..55bde603521 100644
--- a/arch/s390/include/asm/cio.h
+++ b/arch/s390/include/asm/cio.h
@@ -80,6 +80,18 @@ struct erw {
80} __attribute__ ((packed)); 80} __attribute__ ((packed));
81 81
82/** 82/**
83 * struct erw_eadm - EADM Subchannel extended report word
84 * @b: aob error
85 * @r: arsb error
86 */
87struct erw_eadm {
88 __u32 : 16;
89 __u32 b : 1;
90 __u32 r : 1;
91 __u32 : 14;
92} __packed;
93
94/**
83 * struct sublog - subchannel logout area 95 * struct sublog - subchannel logout area
84 * @res0: reserved 96 * @res0: reserved
85 * @esf: extended status flags 97 * @esf: extended status flags
@@ -170,9 +182,22 @@ struct esw3 {
170} __attribute__ ((packed)); 182} __attribute__ ((packed));
171 183
172/** 184/**
185 * struct esw_eadm - EADM Subchannel Extended Status Word (ESW)
186 * @sublog: subchannel logout
187 * @erw: extended report word
188 */
189struct esw_eadm {
190 __u32 sublog;
191 struct erw_eadm erw;
192 __u32 : 32;
193 __u32 : 32;
194 __u32 : 32;
195} __packed;
196
197/**
173 * struct irb - interruption response block 198 * struct irb - interruption response block
174 * @scsw: subchannel status word 199 * @scsw: subchannel status word
175 * @esw: extened status word, 4 formats 200 * @esw: extened status word
176 * @ecw: extended control word 201 * @ecw: extended control word
177 * 202 *
178 * The irb that is handed to the device driver when an interrupt occurs. For 203 * The irb that is handed to the device driver when an interrupt occurs. For
@@ -191,6 +216,7 @@ struct irb {
191 struct esw1 esw1; 216 struct esw1 esw1;
192 struct esw2 esw2; 217 struct esw2 esw2;
193 struct esw3 esw3; 218 struct esw3 esw3;
219 struct esw_eadm eadm;
194 } esw; 220 } esw;
195 __u8 ecw[32]; 221 __u8 ecw[32];
196} __attribute__ ((packed,aligned(4))); 222} __attribute__ ((packed,aligned(4)));
diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxchg.h
index 8d798e962b6..0f636cbdf34 100644
--- a/arch/s390/include/asm/cmpxchg.h
+++ b/arch/s390/include/asm/cmpxchg.h
@@ -7,7 +7,9 @@
7#ifndef __ASM_CMPXCHG_H 7#ifndef __ASM_CMPXCHG_H
8#define __ASM_CMPXCHG_H 8#define __ASM_CMPXCHG_H
9 9
10#include <linux/mmdebug.h>
10#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/bug.h>
11 13
12extern void __xchg_called_with_bad_pointer(void); 14extern void __xchg_called_with_bad_pointer(void);
13 15
@@ -203,6 +205,65 @@ static inline unsigned long long __cmpxchg64(void *ptr,
203}) 205})
204#endif /* CONFIG_64BIT */ 206#endif /* CONFIG_64BIT */
205 207
208#define __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, insn) \
209({ \
210 register __typeof__(*(p1)) __old1 asm("2") = (o1); \
211 register __typeof__(*(p2)) __old2 asm("3") = (o2); \
212 register __typeof__(*(p1)) __new1 asm("4") = (n1); \
213 register __typeof__(*(p2)) __new2 asm("5") = (n2); \
214 int cc; \
215 asm volatile( \
216 insn " %[old],%[new],%[ptr]\n" \
217 " ipm %[cc]\n" \
218 " srl %[cc],28" \
219 : [cc] "=d" (cc), [old] "+d" (__old1), "+d" (__old2) \
220 : [new] "d" (__new1), "d" (__new2), \
221 [ptr] "Q" (*(p1)), "Q" (*(p2)) \
222 : "memory", "cc"); \
223 !cc; \
224})
225
226#define __cmpxchg_double_4(p1, p2, o1, o2, n1, n2) \
227 __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, "cds")
228
229#define __cmpxchg_double_8(p1, p2, o1, o2, n1, n2) \
230 __cmpxchg_double_op(p1, p2, o1, o2, n1, n2, "cdsg")
231
232extern void __cmpxchg_double_called_with_bad_pointer(void);
233
234#define __cmpxchg_double(p1, p2, o1, o2, n1, n2) \
235({ \
236 int __ret; \
237 switch (sizeof(*(p1))) { \
238 case 4: \
239 __ret = __cmpxchg_double_4(p1, p2, o1, o2, n1, n2); \
240 break; \
241 case 8: \
242 __ret = __cmpxchg_double_8(p1, p2, o1, o2, n1, n2); \
243 break; \
244 default: \
245 __cmpxchg_double_called_with_bad_pointer(); \
246 } \
247 __ret; \
248})
249
250#define cmpxchg_double(p1, p2, o1, o2, n1, n2) \
251({ \
252 __typeof__(p1) __p1 = (p1); \
253 __typeof__(p2) __p2 = (p2); \
254 int __ret; \
255 BUILD_BUG_ON(sizeof(*(p1)) != sizeof(long)); \
256 BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long)); \
257 VM_BUG_ON((unsigned long)((__p1) + 1) != (unsigned long)(__p2));\
258 if (sizeof(long) == 4) \
259 __ret = __cmpxchg_double_4(__p1, __p2, o1, o2, n1, n2); \
260 else \
261 __ret = __cmpxchg_double_8(__p1, __p2, o1, o2, n1, n2); \
262 __ret; \
263})
264
265#define system_has_cmpxchg_double() 1
266
206#include <asm-generic/cmpxchg-local.h> 267#include <asm-generic/cmpxchg-local.h>
207 268
208static inline unsigned long __cmpxchg_local(void *ptr, 269static inline unsigned long __cmpxchg_local(void *ptr,
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h
index a3afecdae14..35f0020b7ba 100644
--- a/arch/s390/include/asm/cpu_mf.h
+++ b/arch/s390/include/asm/cpu_mf.h
@@ -21,11 +21,15 @@
21#define CPU_MF_INT_SF_LSDA (1 << 22) /* loss of sample data alert */ 21#define CPU_MF_INT_SF_LSDA (1 << 22) /* loss of sample data alert */
22#define CPU_MF_INT_CF_CACA (1 << 7) /* counter auth. change alert */ 22#define CPU_MF_INT_CF_CACA (1 << 7) /* counter auth. change alert */
23#define CPU_MF_INT_CF_LCDA (1 << 6) /* loss of counter data alert */ 23#define CPU_MF_INT_CF_LCDA (1 << 6) /* loss of counter data alert */
24#define CPU_MF_INT_RI_HALTED (1 << 5) /* run-time instr. halted */
25#define CPU_MF_INT_RI_BUF_FULL (1 << 4) /* run-time instr. program
26 buffer full */
24 27
25#define CPU_MF_INT_CF_MASK (CPU_MF_INT_CF_CACA|CPU_MF_INT_CF_LCDA) 28#define CPU_MF_INT_CF_MASK (CPU_MF_INT_CF_CACA|CPU_MF_INT_CF_LCDA)
26#define CPU_MF_INT_SF_MASK (CPU_MF_INT_SF_IAE|CPU_MF_INT_SF_ISE| \ 29#define CPU_MF_INT_SF_MASK (CPU_MF_INT_SF_IAE|CPU_MF_INT_SF_ISE| \
27 CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \ 30 CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \
28 CPU_MF_INT_SF_LSDA) 31 CPU_MF_INT_SF_LSDA)
32#define CPU_MF_INT_RI_MASK (CPU_MF_INT_RI_HALTED|CPU_MF_INT_RI_BUF_FULL)
29 33
30/* CPU measurement facility support */ 34/* CPU measurement facility support */
31static inline int cpum_cf_avail(void) 35static inline int cpum_cf_avail(void)
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 8709bdef233..023d5ae2448 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -12,6 +12,9 @@
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <asm/div64.h> 13#include <asm/div64.h>
14 14
15
16#define __ARCH_HAS_VTIME_ACCOUNT
17
15/* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ 18/* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */
16 19
17typedef unsigned long long __nocast cputime_t; 20typedef unsigned long long __nocast cputime_t;
diff --git a/arch/s390/include/asm/css_chars.h b/arch/s390/include/asm/css_chars.h
new file mode 100644
index 00000000000..a06ebc2623f
--- /dev/null
+++ b/arch/s390/include/asm/css_chars.h
@@ -0,0 +1,39 @@
1#ifndef _ASM_CSS_CHARS_H
2#define _ASM_CSS_CHARS_H
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8struct css_general_char {
9 u64 : 12;
10 u32 dynio : 1; /* bit 12 */
11 u32 : 4;
12 u32 eadm : 1; /* bit 17 */
13 u32 : 23;
14 u32 aif : 1; /* bit 41 */
15 u32 : 3;
16 u32 mcss : 1; /* bit 45 */
17 u32 fcs : 1; /* bit 46 */
18 u32 : 1;
19 u32 ext_mb : 1; /* bit 48 */
20 u32 : 7;
21 u32 aif_tdd : 1; /* bit 56 */
22 u32 : 1;
23 u32 qebsm : 1; /* bit 58 */
24 u32 : 8;
25 u32 aif_osa : 1; /* bit 67 */
26 u32 : 12;
27 u32 eadm_rf : 1; /* bit 80 */
28 u32 : 1;
29 u32 cib : 1; /* bit 82 */
30 u32 : 5;
31 u32 fcx : 1; /* bit 88 */
32 u32 : 19;
33 u32 alt_ssi : 1; /* bit 108 */
34} __packed;
35
36extern struct css_general_char css_general_characteristics;
37
38#endif /* __KERNEL__ */
39#endif
diff --git a/arch/s390/include/asm/eadm.h b/arch/s390/include/asm/eadm.h
new file mode 100644
index 00000000000..8d4847191ec
--- /dev/null
+++ b/arch/s390/include/asm/eadm.h
@@ -0,0 +1,124 @@
1#ifndef _ASM_S390_EADM_H
2#define _ASM_S390_EADM_H
3
4#include <linux/types.h>
5#include <linux/device.h>
6
7struct arqb {
8 u64 data;
9 u16 fmt:4;
10 u16:12;
11 u16 cmd_code;
12 u16:16;
13 u16 msb_count;
14 u32 reserved[12];
15} __packed;
16
17#define ARQB_CMD_MOVE 1
18
19struct arsb {
20 u16 fmt:4;
21 u32:28;
22 u8 ef;
23 u8:8;
24 u8 ecbi;
25 u8:8;
26 u8 fvf;
27 u16:16;
28 u8 eqc;
29 u32:32;
30 u64 fail_msb;
31 u64 fail_aidaw;
32 u64 fail_ms;
33 u64 fail_scm;
34 u32 reserved[4];
35} __packed;
36
37struct msb {
38 u8 fmt:4;
39 u8 oc:4;
40 u8 flags;
41 u16:12;
42 u16 bs:4;
43 u32 blk_count;
44 u64 data_addr;
45 u64 scm_addr;
46 u64:64;
47} __packed;
48
49struct aidaw {
50 u8 flags;
51 u32 :24;
52 u32 :32;
53 u64 data_addr;
54} __packed;
55
56#define MSB_OC_CLEAR 0
57#define MSB_OC_READ 1
58#define MSB_OC_WRITE 2
59#define MSB_OC_RELEASE 3
60
61#define MSB_FLAG_BNM 0x80
62#define MSB_FLAG_IDA 0x40
63
64#define MSB_BS_4K 0
65#define MSB_BS_1M 1
66
67#define AOB_NR_MSB 124
68
69struct aob {
70 struct arqb request;
71 struct arsb response;
72 struct msb msb[AOB_NR_MSB];
73} __packed __aligned(PAGE_SIZE);
74
75struct aob_rq_header {
76 struct scm_device *scmdev;
77 char data[0];
78};
79
80struct scm_device {
81 u64 address;
82 u64 size;
83 unsigned int nr_max_block;
84 struct device dev;
85 struct {
86 unsigned int persistence:4;
87 unsigned int oper_state:4;
88 unsigned int data_state:4;
89 unsigned int rank:4;
90 unsigned int release:1;
91 unsigned int res_id:8;
92 } __packed attrs;
93};
94
95#define OP_STATE_GOOD 1
96#define OP_STATE_TEMP_ERR 2
97#define OP_STATE_PERM_ERR 3
98
99struct scm_driver {
100 struct device_driver drv;
101 int (*probe) (struct scm_device *scmdev);
102 int (*remove) (struct scm_device *scmdev);
103 void (*notify) (struct scm_device *scmdev);
104 void (*handler) (struct scm_device *scmdev, void *data, int error);
105};
106
107int scm_driver_register(struct scm_driver *scmdrv);
108void scm_driver_unregister(struct scm_driver *scmdrv);
109
110int scm_start_aob(struct aob *aob);
111void scm_irq_handler(struct aob *aob, int error);
112
113struct eadm_ops {
114 int (*eadm_start) (struct aob *aob);
115 struct module *owner;
116};
117
118int scm_get_ref(void);
119void scm_put_ref(void);
120
121void register_eadm_ops(struct eadm_ops *ops);
122void unregister_eadm_ops(struct eadm_ops *ops);
123
124#endif /* _ASM_S390_EADM_H */
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 9b94a160fe7..178ff966a8b 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -101,6 +101,7 @@
101#define HWCAP_S390_HPAGE 128 101#define HWCAP_S390_HPAGE 128
102#define HWCAP_S390_ETF3EH 256 102#define HWCAP_S390_ETF3EH 256
103#define HWCAP_S390_HIGH_GPRS 512 103#define HWCAP_S390_HIGH_GPRS 512
104#define HWCAP_S390_TE 1024
104 105
105/* 106/*
106 * These are used to set parameters in the core dumps. 107 * These are used to set parameters in the core dumps.
@@ -212,4 +213,6 @@ int arch_setup_additional_pages(struct linux_binprm *, int);
212extern unsigned long arch_randomize_brk(struct mm_struct *mm); 213extern unsigned long arch_randomize_brk(struct mm_struct *mm);
213#define arch_randomize_brk arch_randomize_brk 214#define arch_randomize_brk arch_randomize_brk
214 215
216void *fill_cpu_elf_notes(void *ptr, struct save_area *sa);
217
215#endif 218#endif
diff --git a/arch/s390/include/asm/etr.h b/arch/s390/include/asm/etr.h
index a24b03b9fb6..629b79a9316 100644
--- a/arch/s390/include/asm/etr.h
+++ b/arch/s390/include/asm/etr.h
@@ -140,7 +140,7 @@ struct etr_ptff_qto {
140/* Inline assembly helper functions */ 140/* Inline assembly helper functions */
141static inline int etr_setr(struct etr_eacr *ctrl) 141static inline int etr_setr(struct etr_eacr *ctrl)
142{ 142{
143 int rc = -ENOSYS; 143 int rc = -EOPNOTSUPP;
144 144
145 asm volatile( 145 asm volatile(
146 " .insn s,0xb2160000,%1\n" 146 " .insn s,0xb2160000,%1\n"
@@ -154,7 +154,7 @@ static inline int etr_setr(struct etr_eacr *ctrl)
154/* Stores a format 1 aib with 64 bytes */ 154/* Stores a format 1 aib with 64 bytes */
155static inline int etr_stetr(struct etr_aib *aib) 155static inline int etr_stetr(struct etr_aib *aib)
156{ 156{
157 int rc = -ENOSYS; 157 int rc = -EOPNOTSUPP;
158 158
159 asm volatile( 159 asm volatile(
160 " .insn s,0xb2170000,%1\n" 160 " .insn s,0xb2170000,%1\n"
@@ -169,7 +169,7 @@ static inline int etr_stetr(struct etr_aib *aib)
169static inline int etr_steai(struct etr_aib *aib, unsigned int func) 169static inline int etr_steai(struct etr_aib *aib, unsigned int func)
170{ 170{
171 register unsigned int reg0 asm("0") = func; 171 register unsigned int reg0 asm("0") = func;
172 int rc = -ENOSYS; 172 int rc = -EOPNOTSUPP;
173 173
174 asm volatile( 174 asm volatile(
175 " .insn s,0xb2b30000,%1\n" 175 " .insn s,0xb2b30000,%1\n"
@@ -190,7 +190,7 @@ static inline int etr_ptff(void *ptff_block, unsigned int func)
190{ 190{
191 register unsigned int reg0 asm("0") = func; 191 register unsigned int reg0 asm("0") = func;
192 register unsigned long reg1 asm("1") = (unsigned long) ptff_block; 192 register unsigned long reg1 asm("1") = (unsigned long) ptff_block;
193 int rc = -ENOSYS; 193 int rc = -EOPNOTSUPP;
194 194
195 asm volatile( 195 asm volatile(
196 " .word 0x0104\n" 196 " .word 0x0104\n"
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h
index 2b9d41899d2..6703dd986fd 100644
--- a/arch/s390/include/asm/irq.h
+++ b/arch/s390/include/asm/irq.h
@@ -19,6 +19,7 @@ enum interruption_class {
19 EXTINT_IUC, 19 EXTINT_IUC,
20 EXTINT_CMS, 20 EXTINT_CMS,
21 EXTINT_CMC, 21 EXTINT_CMC,
22 EXTINT_CMR,
22 IOINT_CIO, 23 IOINT_CIO,
23 IOINT_QAI, 24 IOINT_QAI,
24 IOINT_DAS, 25 IOINT_DAS,
@@ -30,6 +31,7 @@ enum interruption_class {
30 IOINT_CLW, 31 IOINT_CLW,
31 IOINT_CTC, 32 IOINT_CTC,
32 IOINT_APB, 33 IOINT_APB,
34 IOINT_ADM,
33 IOINT_CSC, 35 IOINT_CSC,
34 NMI_NMI, 36 NMI_NMI,
35 NR_IRQS, 37 NR_IRQS,
diff --git a/arch/s390/include/asm/isc.h b/arch/s390/include/asm/isc.h
index 1420a111594..5ae606456b0 100644
--- a/arch/s390/include/asm/isc.h
+++ b/arch/s390/include/asm/isc.h
@@ -14,6 +14,7 @@
14/* Regular I/O interrupts. */ 14/* Regular I/O interrupts. */
15#define IO_SCH_ISC 3 /* regular I/O subchannels */ 15#define IO_SCH_ISC 3 /* regular I/O subchannels */
16#define CONSOLE_ISC 1 /* console I/O subchannel */ 16#define CONSOLE_ISC 1 /* console I/O subchannel */
17#define EADM_SCH_ISC 4 /* EADM subchannels */
17#define CHSC_SCH_ISC 7 /* CHSC subchannels */ 18#define CHSC_SCH_ISC 7 /* CHSC subchannels */
18/* Adapter interrupts. */ 19/* Adapter interrupts. */
19#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */ 20#define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index aab5555bbbd..bbf8141408c 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -329,9 +329,13 @@ struct _lowcore {
329 __u8 pad_0x1338[0x1340-0x1338]; /* 0x1338 */ 329 __u8 pad_0x1338[0x1340-0x1338]; /* 0x1338 */
330 __u32 access_regs_save_area[16]; /* 0x1340 */ 330 __u32 access_regs_save_area[16]; /* 0x1340 */
331 __u64 cregs_save_area[16]; /* 0x1380 */ 331 __u64 cregs_save_area[16]; /* 0x1380 */
332 __u8 pad_0x1400[0x1800-0x1400]; /* 0x1400 */
333
334 /* Transaction abort diagnostic block */
335 __u8 pgm_tdb[256]; /* 0x1800 */
332 336
333 /* align to the top of the prefix area */ 337 /* align to the top of the prefix area */
334 __u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */ 338 __u8 pad_0x1900[0x2000-0x1900]; /* 0x1900 */
335} __packed; 339} __packed;
336 340
337#endif /* CONFIG_32BIT */ 341#endif /* CONFIG_32BIT */
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index b749c573365..084e7755ed9 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -57,7 +57,7 @@ static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
57 pgd_t *pgd = mm->pgd; 57 pgd_t *pgd = mm->pgd;
58 58
59 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); 59 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd);
60 if (addressing_mode != HOME_SPACE_MODE) { 60 if (s390_user_mode != HOME_SPACE_MODE) {
61 /* Load primary space page table origin. */ 61 /* Load primary space page table origin. */
62 asm volatile(LCTL_OPCODE" 1,1,%0\n" 62 asm volatile(LCTL_OPCODE" 1,1,%0\n"
63 : : "m" (S390_lowcore.user_asce) ); 63 : : "m" (S390_lowcore.user_asce) );
diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h
index 6537e72e085..86fe0ee2cee 100644
--- a/arch/s390/include/asm/percpu.h
+++ b/arch/s390/include/asm/percpu.h
@@ -20,7 +20,7 @@
20#endif 20#endif
21 21
22#define arch_this_cpu_to_op(pcp, val, op) \ 22#define arch_this_cpu_to_op(pcp, val, op) \
23do { \ 23({ \
24 typedef typeof(pcp) pcp_op_T__; \ 24 typedef typeof(pcp) pcp_op_T__; \
25 pcp_op_T__ old__, new__, prev__; \ 25 pcp_op_T__ old__, new__, prev__; \
26 pcp_op_T__ *ptr__; \ 26 pcp_op_T__ *ptr__; \
@@ -39,13 +39,19 @@ do { \
39 } \ 39 } \
40 } while (prev__ != old__); \ 40 } while (prev__ != old__); \
41 preempt_enable(); \ 41 preempt_enable(); \
42} while (0) 42 new__; \
43})
43 44
44#define this_cpu_add_1(pcp, val) arch_this_cpu_to_op(pcp, val, +) 45#define this_cpu_add_1(pcp, val) arch_this_cpu_to_op(pcp, val, +)
45#define this_cpu_add_2(pcp, val) arch_this_cpu_to_op(pcp, val, +) 46#define this_cpu_add_2(pcp, val) arch_this_cpu_to_op(pcp, val, +)
46#define this_cpu_add_4(pcp, val) arch_this_cpu_to_op(pcp, val, +) 47#define this_cpu_add_4(pcp, val) arch_this_cpu_to_op(pcp, val, +)
47#define this_cpu_add_8(pcp, val) arch_this_cpu_to_op(pcp, val, +) 48#define this_cpu_add_8(pcp, val) arch_this_cpu_to_op(pcp, val, +)
48 49
50#define this_cpu_add_return_1(pcp, val) arch_this_cpu_to_op(pcp, val, +)
51#define this_cpu_add_return_2(pcp, val) arch_this_cpu_to_op(pcp, val, +)
52#define this_cpu_add_return_4(pcp, val) arch_this_cpu_to_op(pcp, val, +)
53#define this_cpu_add_return_8(pcp, val) arch_this_cpu_to_op(pcp, val, +)
54
49#define this_cpu_and_1(pcp, val) arch_this_cpu_to_op(pcp, val, &) 55#define this_cpu_and_1(pcp, val) arch_this_cpu_to_op(pcp, val, &)
50#define this_cpu_and_2(pcp, val) arch_this_cpu_to_op(pcp, val, &) 56#define this_cpu_and_2(pcp, val) arch_this_cpu_to_op(pcp, val, &)
51#define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, &) 57#define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, &)
@@ -61,7 +67,7 @@ do { \
61#define this_cpu_xor_4(pcp, val) arch_this_cpu_to_op(pcp, val, ^) 67#define this_cpu_xor_4(pcp, val) arch_this_cpu_to_op(pcp, val, ^)
62#define this_cpu_xor_8(pcp, val) arch_this_cpu_to_op(pcp, val, ^) 68#define this_cpu_xor_8(pcp, val) arch_this_cpu_to_op(pcp, val, ^)
63 69
64#define arch_this_cpu_cmpxchg(pcp, oval, nval) \ 70#define arch_this_cpu_cmpxchg(pcp, oval, nval) \
65({ \ 71({ \
66 typedef typeof(pcp) pcp_op_T__; \ 72 typedef typeof(pcp) pcp_op_T__; \
67 pcp_op_T__ ret__; \ 73 pcp_op_T__ ret__; \
@@ -84,6 +90,44 @@ do { \
84#define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval) 90#define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval)
85#define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval) 91#define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval)
86 92
93#define arch_this_cpu_xchg(pcp, nval) \
94({ \
95 typeof(pcp) *ptr__; \
96 typeof(pcp) ret__; \
97 preempt_disable(); \
98 ptr__ = __this_cpu_ptr(&(pcp)); \
99 ret__ = xchg(ptr__, nval); \
100 preempt_enable(); \
101 ret__; \
102})
103
104#define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg(pcp, nval)
105#define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg(pcp, nval)
106#define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval)
107#ifdef CONFIG_64BIT
108#define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval)
109#endif
110
111#define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \
112({ \
113 typeof(pcp1) o1__ = (o1), n1__ = (n1); \
114 typeof(pcp2) o2__ = (o2), n2__ = (n2); \
115 typeof(pcp1) *p1__; \
116 typeof(pcp2) *p2__; \
117 int ret__; \
118 preempt_disable(); \
119 p1__ = __this_cpu_ptr(&(pcp1)); \
120 p2__ = __this_cpu_ptr(&(pcp2)); \
121 ret__ = __cmpxchg_double(p1__, p2__, o1__, o2__, n1__, n2__); \
122 preempt_enable(); \
123 ret__; \
124})
125
126#define this_cpu_cmpxchg_double_4 arch_this_cpu_cmpxchg_double
127#ifdef CONFIG_64BIT
128#define this_cpu_cmpxchg_double_8 arch_this_cpu_cmpxchg_double
129#endif
130
87#include <asm-generic/percpu.h> 131#include <asm-generic/percpu.h>
88 132
89#endif /* __ARCH_S390_PERCPU__ */ 133#endif /* __ARCH_S390_PERCPU__ */
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 11e4e323693..f3e0aabfc6b 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -11,12 +11,15 @@
11#ifndef __ASM_S390_PROCESSOR_H 11#ifndef __ASM_S390_PROCESSOR_H
12#define __ASM_S390_PROCESSOR_H 12#define __ASM_S390_PROCESSOR_H
13 13
14#ifndef __ASSEMBLY__
15
14#include <linux/linkage.h> 16#include <linux/linkage.h>
15#include <linux/irqflags.h> 17#include <linux/irqflags.h>
16#include <asm/cpu.h> 18#include <asm/cpu.h>
17#include <asm/page.h> 19#include <asm/page.h>
18#include <asm/ptrace.h> 20#include <asm/ptrace.h>
19#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/runtime_instr.h>
20 23
21/* 24/*
22 * Default implementation of macro that returns current 25 * Default implementation of macro that returns current
@@ -75,11 +78,20 @@ struct thread_struct {
75 unsigned long gmap_addr; /* address of last gmap fault. */ 78 unsigned long gmap_addr; /* address of last gmap fault. */
76 struct per_regs per_user; /* User specified PER registers */ 79 struct per_regs per_user; /* User specified PER registers */
77 struct per_event per_event; /* Cause of the last PER trap */ 80 struct per_event per_event; /* Cause of the last PER trap */
81 unsigned long per_flags; /* Flags to control debug behavior */
78 /* pfault_wait is used to block the process on a pfault event */ 82 /* pfault_wait is used to block the process on a pfault event */
79 unsigned long pfault_wait; 83 unsigned long pfault_wait;
80 struct list_head list; 84 struct list_head list;
85 /* cpu runtime instrumentation */
86 struct runtime_instr_cb *ri_cb;
87 int ri_signum;
88#ifdef CONFIG_64BIT
89 unsigned char trap_tdb[256]; /* Transaction abort diagnose block */
90#endif
81}; 91};
82 92
93#define PER_FLAG_NO_TE 1UL /* Flag to disable transactions. */
94
83typedef struct thread_struct thread_struct; 95typedef struct thread_struct thread_struct;
84 96
85/* 97/*
@@ -130,6 +142,12 @@ struct task_struct;
130struct mm_struct; 142struct mm_struct;
131struct seq_file; 143struct seq_file;
132 144
145#ifdef CONFIG_64BIT
146extern void show_cacheinfo(struct seq_file *m);
147#else
148static inline void show_cacheinfo(struct seq_file *m) { }
149#endif
150
133/* Free all resources held by a thread. */ 151/* Free all resources held by a thread. */
134extern void release_thread(struct task_struct *); 152extern void release_thread(struct task_struct *);
135extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 153extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
@@ -140,6 +158,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
140extern unsigned long thread_saved_pc(struct task_struct *t); 158extern unsigned long thread_saved_pc(struct task_struct *t);
141 159
142extern void show_code(struct pt_regs *regs); 160extern void show_code(struct pt_regs *regs);
161extern void print_fn_code(unsigned char *code, unsigned long len);
143 162
144unsigned long get_wchan(struct task_struct *p); 163unsigned long get_wchan(struct task_struct *p);
145#define task_pt_regs(tsk) ((struct pt_regs *) \ 164#define task_pt_regs(tsk) ((struct pt_regs *) \
@@ -331,23 +350,6 @@ extern void (*s390_base_ext_handler_fn)(void);
331 350
332#define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL 351#define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL
333 352
334/*
335 * Helper macro for exception table entries
336 */
337#ifndef CONFIG_64BIT
338#define EX_TABLE(_fault,_target) \
339 ".section __ex_table,\"a\"\n" \
340 " .align 4\n" \
341 " .long " #_fault "," #_target "\n" \
342 ".previous\n"
343#else
344#define EX_TABLE(_fault,_target) \
345 ".section __ex_table,\"a\"\n" \
346 " .align 8\n" \
347 " .quad " #_fault "," #_target "\n" \
348 ".previous\n"
349#endif
350
351extern int memcpy_real(void *, void *, size_t); 353extern int memcpy_real(void *, void *, size_t);
352extern void memcpy_absolute(void *, void *, size_t); 354extern void memcpy_absolute(void *, void *, size_t);
353 355
@@ -358,4 +360,25 @@ extern void memcpy_absolute(void *, void *, size_t);
358 memcpy_absolute(&(dest), &__tmp, sizeof(__tmp)); \ 360 memcpy_absolute(&(dest), &__tmp, sizeof(__tmp)); \
359} 361}
360 362
361#endif /* __ASM_S390_PROCESSOR_H */ 363/*
364 * Helper macro for exception table entries
365 */
366#define EX_TABLE(_fault, _target) \
367 ".section __ex_table,\"a\"\n" \
368 ".align 4\n" \
369 ".long (" #_fault ") - .\n" \
370 ".long (" #_target ") - .\n" \
371 ".previous\n"
372
373#else /* __ASSEMBLY__ */
374
375#define EX_TABLE(_fault, _target) \
376 .section __ex_table,"a" ; \
377 .align 4 ; \
378 .long (_fault) - . ; \
379 .long (_target) - . ; \
380 .previous
381
382#endif /* __ASSEMBLY__ */
383
384#endif /* __ASM_S390_PROCESSOR_H */
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index d5f08ea566e..ce20a53afe9 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -235,6 +235,7 @@ typedef struct
235#define PSW_MASK_ASC 0x0000C000UL 235#define PSW_MASK_ASC 0x0000C000UL
236#define PSW_MASK_CC 0x00003000UL 236#define PSW_MASK_CC 0x00003000UL
237#define PSW_MASK_PM 0x00000F00UL 237#define PSW_MASK_PM 0x00000F00UL
238#define PSW_MASK_RI 0x00000000UL
238#define PSW_MASK_EA 0x00000000UL 239#define PSW_MASK_EA 0x00000000UL
239#define PSW_MASK_BA 0x00000000UL 240#define PSW_MASK_BA 0x00000000UL
240 241
@@ -264,10 +265,11 @@ typedef struct
264#define PSW_MASK_ASC 0x0000C00000000000UL 265#define PSW_MASK_ASC 0x0000C00000000000UL
265#define PSW_MASK_CC 0x0000300000000000UL 266#define PSW_MASK_CC 0x0000300000000000UL
266#define PSW_MASK_PM 0x00000F0000000000UL 267#define PSW_MASK_PM 0x00000F0000000000UL
268#define PSW_MASK_RI 0x0000008000000000UL
267#define PSW_MASK_EA 0x0000000100000000UL 269#define PSW_MASK_EA 0x0000000100000000UL
268#define PSW_MASK_BA 0x0000000080000000UL 270#define PSW_MASK_BA 0x0000000080000000UL
269 271
270#define PSW_MASK_USER 0x00003F0180000000UL 272#define PSW_MASK_USER 0x00003F8180000000UL
271 273
272#define PSW_ADDR_AMODE 0x0000000000000000UL 274#define PSW_ADDR_AMODE 0x0000000000000000UL
273#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL 275#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
@@ -359,17 +361,19 @@ struct per_struct_kernel {
359 unsigned char access_id; /* PER trap access identification */ 361 unsigned char access_id; /* PER trap access identification */
360}; 362};
361 363
362#define PER_EVENT_MASK 0xE9000000UL 364#define PER_EVENT_MASK 0xEB000000UL
363 365
364#define PER_EVENT_BRANCH 0x80000000UL 366#define PER_EVENT_BRANCH 0x80000000UL
365#define PER_EVENT_IFETCH 0x40000000UL 367#define PER_EVENT_IFETCH 0x40000000UL
366#define PER_EVENT_STORE 0x20000000UL 368#define PER_EVENT_STORE 0x20000000UL
367#define PER_EVENT_STORE_REAL 0x08000000UL 369#define PER_EVENT_STORE_REAL 0x08000000UL
370#define PER_EVENT_TRANSACTION_END 0x02000000UL
368#define PER_EVENT_NULLIFICATION 0x01000000UL 371#define PER_EVENT_NULLIFICATION 0x01000000UL
369 372
370#define PER_CONTROL_MASK 0x00a00000UL 373#define PER_CONTROL_MASK 0x00e00000UL
371 374
372#define PER_CONTROL_BRANCH_ADDRESS 0x00800000UL 375#define PER_CONTROL_BRANCH_ADDRESS 0x00800000UL
376#define PER_CONTROL_SUSPENSION 0x00400000UL
373#define PER_CONTROL_ALTERATION 0x00200000UL 377#define PER_CONTROL_ALTERATION 0x00200000UL
374 378
375#endif 379#endif
@@ -483,6 +487,8 @@ typedef struct
483#define PTRACE_GET_LAST_BREAK 0x5006 487#define PTRACE_GET_LAST_BREAK 0x5006
484#define PTRACE_PEEK_SYSTEM_CALL 0x5007 488#define PTRACE_PEEK_SYSTEM_CALL 0x5007
485#define PTRACE_POKE_SYSTEM_CALL 0x5008 489#define PTRACE_POKE_SYSTEM_CALL 0x5008
490#define PTRACE_ENABLE_TE 0x5009
491#define PTRACE_DISABLE_TE 0x5010
486 492
487/* 493/*
488 * PT_PROT definition is loosely based on hppa bsd definition in 494 * PT_PROT definition is loosely based on hppa bsd definition in
diff --git a/arch/s390/include/asm/runtime_instr.h b/arch/s390/include/asm/runtime_instr.h
new file mode 100644
index 00000000000..830da737ff8
--- /dev/null
+++ b/arch/s390/include/asm/runtime_instr.h
@@ -0,0 +1,98 @@
1#ifndef _RUNTIME_INSTR_H
2#define _RUNTIME_INSTR_H
3
4#define S390_RUNTIME_INSTR_START 0x1
5#define S390_RUNTIME_INSTR_STOP 0x2
6
7struct runtime_instr_cb {
8 __u64 buf_current;
9 __u64 buf_origin;
10 __u64 buf_limit;
11
12 __u32 valid : 1;
13 __u32 pstate : 1;
14 __u32 pstate_set_buf : 1;
15 __u32 home_space : 1;
16 __u32 altered : 1;
17 __u32 : 3;
18 __u32 pstate_sample : 1;
19 __u32 sstate_sample : 1;
20 __u32 pstate_collect : 1;
21 __u32 sstate_collect : 1;
22 __u32 : 1;
23 __u32 halted_int : 1;
24 __u32 int_requested : 1;
25 __u32 buffer_full_int : 1;
26 __u32 key : 4;
27 __u32 : 9;
28 __u32 rgs : 3;
29
30 __u32 mode : 4;
31 __u32 next : 1;
32 __u32 mae : 1;
33 __u32 : 2;
34 __u32 call_type_br : 1;
35 __u32 return_type_br : 1;
36 __u32 other_type_br : 1;
37 __u32 bc_other_type : 1;
38 __u32 emit : 1;
39 __u32 tx_abort : 1;
40 __u32 : 2;
41 __u32 bp_xn : 1;
42 __u32 bp_xt : 1;
43 __u32 bp_ti : 1;
44 __u32 bp_ni : 1;
45 __u32 suppr_y : 1;
46 __u32 suppr_z : 1;
47
48 __u32 dc_miss_extra : 1;
49 __u32 lat_lev_ignore : 1;
50 __u32 ic_lat_lev : 4;
51 __u32 dc_lat_lev : 4;
52
53 __u64 reserved1;
54 __u64 scaling_factor;
55 __u64 rsic;
56 __u64 reserved2;
57} __packed __aligned(8);
58
59extern struct runtime_instr_cb runtime_instr_empty_cb;
60
61static inline void load_runtime_instr_cb(struct runtime_instr_cb *cb)
62{
63 asm volatile(".insn rsy,0xeb0000000060,0,0,%0" /* LRIC */
64 : : "Q" (*cb));
65}
66
67static inline void store_runtime_instr_cb(struct runtime_instr_cb *cb)
68{
69 asm volatile(".insn rsy,0xeb0000000061,0,0,%0" /* STRIC */
70 : "=Q" (*cb) : : "cc");
71}
72
73static inline void save_ri_cb(struct runtime_instr_cb *cb_prev)
74{
75#ifdef CONFIG_64BIT
76 if (cb_prev)
77 store_runtime_instr_cb(cb_prev);
78#endif
79}
80
81static inline void restore_ri_cb(struct runtime_instr_cb *cb_next,
82 struct runtime_instr_cb *cb_prev)
83{
84#ifdef CONFIG_64BIT
85 if (cb_next)
86 load_runtime_instr_cb(cb_next);
87 else if (cb_prev)
88 load_runtime_instr_cb(&runtime_instr_empty_cb);
89#endif
90}
91
92#ifdef CONFIG_64BIT
93extern void exit_thread_runtime_instr(void);
94#else
95static inline void exit_thread_runtime_instr(void) { }
96#endif
97
98#endif /* _RUNTIME_INSTR_H */
diff --git a/arch/s390/include/asm/scsw.h b/arch/s390/include/asm/scsw.h
index 4071d00978c..4af99cdaddf 100644
--- a/arch/s390/include/asm/scsw.h
+++ b/arch/s390/include/asm/scsw.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Helper functions for scsw access. 2 * Helper functions for scsw access.
3 * 3 *
4 * Copyright IBM Corp. 2008, 2009 4 * Copyright IBM Corp. 2008, 2012
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> 5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */ 6 */
7 7
@@ -9,7 +9,7 @@
9#define _ASM_S390_SCSW_H_ 9#define _ASM_S390_SCSW_H_
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/chsc.h> 12#include <asm/css_chars.h>
13#include <asm/cio.h> 13#include <asm/cio.h>
14 14
15/** 15/**
@@ -100,14 +100,46 @@ struct tm_scsw {
100} __attribute__ ((packed)); 100} __attribute__ ((packed));
101 101
102/** 102/**
103 * struct eadm_scsw - subchannel status word for eadm subchannels
104 * @key: subchannel key
105 * @eswf: esw format
106 * @cc: deferred condition code
107 * @ectl: extended control
108 * @fctl: function control
109 * @actl: activity control
110 * @stctl: status control
111 * @aob: AOB address
112 * @dstat: device status
113 * @cstat: subchannel status
114 */
115struct eadm_scsw {
116 u32 key:4;
117 u32:1;
118 u32 eswf:1;
119 u32 cc:2;
120 u32:6;
121 u32 ectl:1;
122 u32:2;
123 u32 fctl:3;
124 u32 actl:7;
125 u32 stctl:5;
126 u32 aob;
127 u32 dstat:8;
128 u32 cstat:8;
129 u32:16;
130} __packed;
131
132/**
103 * union scsw - subchannel status word 133 * union scsw - subchannel status word
104 * @cmd: command-mode SCSW 134 * @cmd: command-mode SCSW
105 * @tm: transport-mode SCSW 135 * @tm: transport-mode SCSW
136 * @eadm: eadm SCSW
106 */ 137 */
107union scsw { 138union scsw {
108 struct cmd_scsw cmd; 139 struct cmd_scsw cmd;
109 struct tm_scsw tm; 140 struct tm_scsw tm;
110} __attribute__ ((packed)); 141 struct eadm_scsw eadm;
142} __packed;
111 143
112#define SCSW_FCTL_CLEAR_FUNC 0x1 144#define SCSW_FCTL_CLEAR_FUNC 0x1
113#define SCSW_FCTL_HALT_FUNC 0x2 145#define SCSW_FCTL_HALT_FUNC 0x2
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index e6859d16ee2..87b47ca954f 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -60,7 +60,7 @@ void create_mem_hole(struct mem_chunk memory_chunk[], unsigned long addr,
60#define SECONDARY_SPACE_MODE 2 60#define SECONDARY_SPACE_MODE 2
61#define HOME_SPACE_MODE 3 61#define HOME_SPACE_MODE 3
62 62
63extern unsigned int addressing_mode; 63extern unsigned int s390_user_mode;
64 64
65/* 65/*
66 * Machine features detected in head.S 66 * Machine features detected in head.S
@@ -80,6 +80,7 @@ extern unsigned int addressing_mode;
80#define MACHINE_FLAG_LPAR (1UL << 12) 80#define MACHINE_FLAG_LPAR (1UL << 12)
81#define MACHINE_FLAG_SPP (1UL << 13) 81#define MACHINE_FLAG_SPP (1UL << 13)
82#define MACHINE_FLAG_TOPOLOGY (1UL << 14) 82#define MACHINE_FLAG_TOPOLOGY (1UL << 14)
83#define MACHINE_FLAG_TE (1UL << 15)
83 84
84#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 85#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
85#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 86#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
@@ -98,6 +99,7 @@ extern unsigned int addressing_mode;
98#define MACHINE_HAS_PFMF (0) 99#define MACHINE_HAS_PFMF (0)
99#define MACHINE_HAS_SPP (0) 100#define MACHINE_HAS_SPP (0)
100#define MACHINE_HAS_TOPOLOGY (0) 101#define MACHINE_HAS_TOPOLOGY (0)
102#define MACHINE_HAS_TE (0)
101#else /* CONFIG_64BIT */ 103#else /* CONFIG_64BIT */
102#define MACHINE_HAS_IEEE (1) 104#define MACHINE_HAS_IEEE (1)
103#define MACHINE_HAS_CSP (1) 105#define MACHINE_HAS_CSP (1)
@@ -109,6 +111,7 @@ extern unsigned int addressing_mode;
109#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) 111#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
110#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
111#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
114#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE)
112#endif /* CONFIG_64BIT */ 115#endif /* CONFIG_64BIT */
113 116
114#define ZFCPDUMP_HSA_SIZE (32UL<<20) 117#define ZFCPDUMP_HSA_SIZE (32UL<<20)
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index ce26ac3cb16..b64f15c3b4c 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -30,6 +30,8 @@ extern int smp_vcpu_scheduled(int cpu);
30extern void smp_yield_cpu(int cpu); 30extern void smp_yield_cpu(int cpu);
31extern void smp_yield(void); 31extern void smp_yield(void);
32extern void smp_stop_cpu(void); 32extern void smp_stop_cpu(void);
33extern void smp_cpu_set_polarization(int cpu, int val);
34extern int smp_cpu_get_polarization(int cpu);
33 35
34#else /* CONFIG_SMP */ 36#else /* CONFIG_SMP */
35 37
@@ -43,7 +45,7 @@ static inline void smp_call_online_cpu(void (*func)(void *), void *data)
43 func(data); 45 func(data);
44} 46}
45 47
46static inline int smp_find_processor_id(int address) { return 0; } 48static inline int smp_find_processor_id(u16 address) { return 0; }
47static inline int smp_store_status(int cpu) { return 0; } 49static inline int smp_store_status(int cpu) { return 0; }
48static inline int smp_vcpu_scheduled(int cpu) { return 1; } 50static inline int smp_vcpu_scheduled(int cpu) { return 1; }
49static inline void smp_yield_cpu(int cpu) { } 51static inline void smp_yield_cpu(int cpu) { }
diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h
index 1bd1352fa3b..7e2dcd7c57e 100644
--- a/arch/s390/include/asm/string.h
+++ b/arch/s390/include/asm/string.h
@@ -96,7 +96,6 @@ static inline char *strcat(char *dst, const char *src)
96 96
97static inline char *strcpy(char *dst, const char *src) 97static inline char *strcpy(char *dst, const char *src)
98{ 98{
99#if __GNUC__ < 4
100 register int r0 asm("0") = 0; 99 register int r0 asm("0") = 0;
101 char *ret = dst; 100 char *ret = dst;
102 101
@@ -106,14 +105,10 @@ static inline char *strcpy(char *dst, const char *src)
106 : "+&a" (dst), "+&a" (src) : "d" (r0) 105 : "+&a" (dst), "+&a" (src) : "d" (r0)
107 : "cc", "memory"); 106 : "cc", "memory");
108 return ret; 107 return ret;
109#else
110 return __builtin_strcpy(dst, src);
111#endif
112} 108}
113 109
114static inline size_t strlen(const char *s) 110static inline size_t strlen(const char *s)
115{ 111{
116#if __GNUC__ < 4
117 register unsigned long r0 asm("0") = 0; 112 register unsigned long r0 asm("0") = 0;
118 const char *tmp = s; 113 const char *tmp = s;
119 114
@@ -122,9 +117,6 @@ static inline size_t strlen(const char *s)
122 " jo 0b" 117 " jo 0b"
123 : "+d" (r0), "+a" (tmp) : : "cc"); 118 : "+d" (r0), "+a" (tmp) : : "cc");
124 return r0 - (unsigned long) s; 119 return r0 - (unsigned long) s;
125#else
126 return __builtin_strlen(s);
127#endif
128} 120}
129 121
130static inline size_t strnlen(const char * s, size_t n) 122static inline size_t strnlen(const char * s, size_t n)
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h
index f223068b782..f3a9e0f9270 100644
--- a/arch/s390/include/asm/switch_to.h
+++ b/arch/s390/include/asm/switch_to.h
@@ -80,21 +80,19 @@ static inline void restore_access_regs(unsigned int *acrs)
80 if (prev->mm) { \ 80 if (prev->mm) { \
81 save_fp_regs(&prev->thread.fp_regs); \ 81 save_fp_regs(&prev->thread.fp_regs); \
82 save_access_regs(&prev->thread.acrs[0]); \ 82 save_access_regs(&prev->thread.acrs[0]); \
83 save_ri_cb(prev->thread.ri_cb); \
83 } \ 84 } \
84 if (next->mm) { \ 85 if (next->mm) { \
85 restore_fp_regs(&next->thread.fp_regs); \ 86 restore_fp_regs(&next->thread.fp_regs); \
86 restore_access_regs(&next->thread.acrs[0]); \ 87 restore_access_regs(&next->thread.acrs[0]); \
88 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \
87 update_per_regs(next); \ 89 update_per_regs(next); \
88 } \ 90 } \
89 prev = __switch_to(prev,next); \ 91 prev = __switch_to(prev,next); \
90} while (0) 92} while (0)
91 93
92extern void account_vtime(struct task_struct *, struct task_struct *);
93extern void account_tick_vtime(struct task_struct *);
94
95#define finish_arch_switch(prev) do { \ 94#define finish_arch_switch(prev) do { \
96 set_fs(current->thread.mm_segment); \ 95 set_fs(current->thread.mm_segment); \
97 account_vtime(prev, current); \
98} while (0) 96} while (0)
99 97
100#endif /* __ASM_SWITCH_TO_H */ 98#endif /* __ASM_SWITCH_TO_H */
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index 282ee36f616..f92428e459f 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -17,7 +17,10 @@
17#include <asm/bitsperlong.h> 17#include <asm/bitsperlong.h>
18 18
19struct sysinfo_1_1_1 { 19struct sysinfo_1_1_1 {
20 unsigned short :16; 20 unsigned char p:1;
21 unsigned char :6;
22 unsigned char t:1;
23 unsigned char :8;
21 unsigned char ccr; 24 unsigned char ccr;
22 unsigned char cai; 25 unsigned char cai;
23 char reserved_0[28]; 26 char reserved_0[28];
@@ -30,9 +33,14 @@ struct sysinfo_1_1_1 {
30 char model[16]; 33 char model[16];
31 char model_perm_cap[16]; 34 char model_perm_cap[16];
32 char model_temp_cap[16]; 35 char model_temp_cap[16];
33 char model_cap_rating[4]; 36 unsigned int model_cap_rating;
34 char model_perm_cap_rating[4]; 37 unsigned int model_perm_cap_rating;
35 char model_temp_cap_rating[4]; 38 unsigned int model_temp_cap_rating;
39 unsigned char typepct[5];
40 unsigned char reserved_2[3];
41 unsigned int ncr;
42 unsigned int npr;
43 unsigned int ntr;
36}; 44};
37 45
38struct sysinfo_1_2_1 { 46struct sysinfo_1_2_1 {
@@ -47,8 +55,9 @@ struct sysinfo_1_2_2 {
47 char format; 55 char format;
48 char reserved_0[1]; 56 char reserved_0[1];
49 unsigned short acc_offset; 57 unsigned short acc_offset;
50 char reserved_1[24]; 58 char reserved_1[20];
51 unsigned int secondary_capability; 59 unsigned int nominal_cap;
60 unsigned int secondary_cap;
52 unsigned int capability; 61 unsigned int capability;
53 unsigned short cpus_total; 62 unsigned short cpus_total;
54 unsigned short cpus_configured; 63 unsigned short cpus_configured;
@@ -109,6 +118,8 @@ struct sysinfo_3_2_2 {
109 char reserved_544[3552]; 118 char reserved_544[3552];
110}; 119};
111 120
121extern int topology_max_mnest;
122
112#define TOPOLOGY_CPU_BITS 64 123#define TOPOLOGY_CPU_BITS 64
113#define TOPOLOGY_NR_MAG 6 124#define TOPOLOGY_NR_MAG 6
114 125
@@ -142,21 +153,7 @@ struct sysinfo_15_1_x {
142 union topology_entry tle[0]; 153 union topology_entry tle[0];
143}; 154};
144 155
145static inline int stsi(void *sysinfo, int fc, int sel1, int sel2) 156int stsi(void *sysinfo, int fc, int sel1, int sel2);
146{
147 register int r0 asm("0") = (fc << 28) | sel1;
148 register int r1 asm("1") = sel2;
149
150 asm volatile(
151 " stsi 0(%2)\n"
152 "0: jz 2f\n"
153 "1: lhi %0,%3\n"
154 "2:\n"
155 EX_TABLE(0b, 1b)
156 : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS)
157 : "cc", "memory");
158 return r0;
159}
160 157
161/* 158/*
162 * Service level reporting interface. 159 * Service level reporting interface.
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 0837de80c35..9ca30538376 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -2,8 +2,8 @@
2#define _ASM_S390_TOPOLOGY_H 2#define _ASM_S390_TOPOLOGY_H
3 3
4#include <linux/cpumask.h> 4#include <linux/cpumask.h>
5#include <asm/sysinfo.h>
6 5
6struct sysinfo_15_1_x;
7struct cpu; 7struct cpu;
8 8
9#ifdef CONFIG_SCHED_BOOK 9#ifdef CONFIG_SCHED_BOOK
@@ -51,24 +51,6 @@ static inline void topology_expect_change(void) { }
51#define POLARIZATION_VM (2) 51#define POLARIZATION_VM (2)
52#define POLARIZATION_VH (3) 52#define POLARIZATION_VH (3)
53 53
54extern int cpu_polarization[];
55
56static inline void cpu_set_polarization(int cpu, int val)
57{
58#ifdef CONFIG_SCHED_BOOK
59 cpu_polarization[cpu] = val;
60#endif
61}
62
63static inline int cpu_read_polarization(int cpu)
64{
65#ifdef CONFIG_SCHED_BOOK
66 return cpu_polarization[cpu];
67#else
68 return POLARIZATION_HRZ;
69#endif
70}
71
72#ifdef CONFIG_SCHED_BOOK 54#ifdef CONFIG_SCHED_BOOK
73void s390_init_cpu_topology(void); 55void s390_init_cpu_topology(void);
74#else 56#else
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index a8ab18b18b5..34268df959a 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -76,9 +76,22 @@ static inline int __range_ok(unsigned long addr, unsigned long size)
76 76
77struct exception_table_entry 77struct exception_table_entry
78{ 78{
79 unsigned long insn, fixup; 79 int insn, fixup;
80}; 80};
81 81
82static inline unsigned long extable_insn(const struct exception_table_entry *x)
83{
84 return (unsigned long)&x->insn + x->insn;
85}
86
87static inline unsigned long extable_fixup(const struct exception_table_entry *x)
88{
89 return (unsigned long)&x->fixup + x->fixup;
90}
91
92#define ARCH_HAS_SORT_EXTABLE
93#define ARCH_HAS_SEARCH_EXTABLE
94
82struct uaccess_ops { 95struct uaccess_ops {
83 size_t (*copy_from_user)(size_t, const void __user *, void *); 96 size_t (*copy_from_user)(size_t, const void __user *, void *);
84 size_t (*copy_from_user_small)(size_t, const void __user *, void *); 97 size_t (*copy_from_user_small)(size_t, const void __user *, void *);
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 6756e78f480..4e64b5cd155 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -277,7 +277,9 @@
277#define __NR_setns 339 277#define __NR_setns 339
278#define __NR_process_vm_readv 340 278#define __NR_process_vm_readv 340
279#define __NR_process_vm_writev 341 279#define __NR_process_vm_writev 341
280#define NR_syscalls 342 280#define __NR_s390_runtime_instr 342
281#define __NR_kcmp 343
282#define NR_syscalls 344
281 283
282/* 284/*
283 * There are some system calls that are not present on 64 bit, some 285 * There are some system calls that are not present on 64 bit, some