diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-27 13:18:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-27 13:18:00 -0400 |
commit | 95948c31bec26e631ecf138cb04dcd547519c7af (patch) | |
tree | 10a56e8c9635131bcbef28721443b63b39642840 /arch/s390 | |
parent | 45acab01ca6389371ec39e16844768a60f5f1380 (diff) | |
parent | 69dbb2f79a5626741a24770719406a4edb2cb84f (diff) |
Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
[S390] mm: add ZONE_DMA to 31-bit config again
[S390] mm: add page fault retry handling
[S390] mm: handle kernel caused page fault oom situations
[S390] delay: implement ndelay
[S390] topology,sched: fix cpu_coregroup_mask/cpu_book_mask definitions
[S390] hwsampler: allow cpu hotplug
[S390] uaccess: turn __access_ok() into a define
[S390] irq: merge irq.c and s390_ext.c
[S390] irq: fix service signal external interrupt handling
[S390] pfault: always enable service signal interrupt
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/Kconfig | 2 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_mem.c | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/delay.h | 8 | ||||
-rw-r--r-- | arch/s390/include/asm/irq.h | 8 | ||||
-rw-r--r-- | arch/s390/include/asm/s390_ext.h | 17 | ||||
-rw-r--r-- | arch/s390/include/asm/topology.h | 4 | ||||
-rw-r--r-- | arch/s390/include/asm/uaccess.h | 11 | ||||
-rw-r--r-- | arch/s390/kernel/Makefile | 8 | ||||
-rw-r--r-- | arch/s390/kernel/dis.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/irq.c | 137 | ||||
-rw-r--r-- | arch/s390/kernel/s390_ext.c | 108 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 1 | ||||
-rw-r--r-- | arch/s390/kernel/time.c | 1 | ||||
-rw-r--r-- | arch/s390/kernel/topology.c | 1 | ||||
-rw-r--r-- | arch/s390/kernel/traps.c | 1 | ||||
-rw-r--r-- | arch/s390/kernel/vtime.c | 2 | ||||
-rw-r--r-- | arch/s390/lib/delay.c | 15 | ||||
-rw-r--r-- | arch/s390/mm/fault.c | 62 | ||||
-rw-r--r-- | arch/s390/mm/init.c | 2 | ||||
-rw-r--r-- | arch/s390/oprofile/hwsampler.c | 4 |
20 files changed, 213 insertions, 183 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ff2d2371b2e9..9fab2aa9c2c8 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -2,7 +2,7 @@ config MMU | |||
2 | def_bool y | 2 | def_bool y |
3 | 3 | ||
4 | config ZONE_DMA | 4 | config ZONE_DMA |
5 | def_bool y if 64BIT | 5 | def_bool y |
6 | 6 | ||
7 | config LOCKDEP_SUPPORT | 7 | config LOCKDEP_SUPPORT |
8 | def_bool y | 8 | def_bool y |
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c index e43fe7537031..f7d3dc555bdb 100644 --- a/arch/s390/appldata/appldata_mem.c +++ b/arch/s390/appldata/appldata_mem.c | |||
@@ -92,9 +92,7 @@ static void appldata_get_mem_data(void *data) | |||
92 | mem_data->pswpin = ev[PSWPIN]; | 92 | mem_data->pswpin = ev[PSWPIN]; |
93 | mem_data->pswpout = ev[PSWPOUT]; | 93 | mem_data->pswpout = ev[PSWPOUT]; |
94 | mem_data->pgalloc = ev[PGALLOC_NORMAL]; | 94 | mem_data->pgalloc = ev[PGALLOC_NORMAL]; |
95 | #ifdef CONFIG_ZONE_DMA | ||
96 | mem_data->pgalloc += ev[PGALLOC_DMA]; | 95 | mem_data->pgalloc += ev[PGALLOC_DMA]; |
97 | #endif | ||
98 | mem_data->pgfault = ev[PGFAULT]; | 96 | mem_data->pgfault = ev[PGFAULT]; |
99 | mem_data->pgmajfault = ev[PGMAJFAULT]; | 97 | mem_data->pgmajfault = ev[PGMAJFAULT]; |
100 | 98 | ||
diff --git a/arch/s390/include/asm/delay.h b/arch/s390/include/asm/delay.h index 8a096b83f51f..0e3b35f96be1 100644 --- a/arch/s390/include/asm/delay.h +++ b/arch/s390/include/asm/delay.h | |||
@@ -14,10 +14,12 @@ | |||
14 | #ifndef _S390_DELAY_H | 14 | #ifndef _S390_DELAY_H |
15 | #define _S390_DELAY_H | 15 | #define _S390_DELAY_H |
16 | 16 | ||
17 | extern void __udelay(unsigned long long usecs); | 17 | void __ndelay(unsigned long long nsecs); |
18 | extern void udelay_simple(unsigned long long usecs); | 18 | void __udelay(unsigned long long usecs); |
19 | extern void __delay(unsigned long loops); | 19 | void udelay_simple(unsigned long long usecs); |
20 | void __delay(unsigned long loops); | ||
20 | 21 | ||
22 | #define ndelay(n) __ndelay((unsigned long long) (n)) | ||
21 | #define udelay(n) __udelay((unsigned long long) (n)) | 23 | #define udelay(n) __udelay((unsigned long long) (n)) |
22 | #define mdelay(n) __udelay((unsigned long long) (n) * 1000) | 24 | #define mdelay(n) __udelay((unsigned long long) (n) * 1000) |
23 | 25 | ||
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h index 1544b90bd6d6..ba7b01c726a3 100644 --- a/arch/s390/include/asm/irq.h +++ b/arch/s390/include/asm/irq.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ASM_IRQ_H | 2 | #define _ASM_IRQ_H |
3 | 3 | ||
4 | #include <linux/hardirq.h> | 4 | #include <linux/hardirq.h> |
5 | #include <linux/types.h> | ||
5 | 6 | ||
6 | enum interruption_class { | 7 | enum interruption_class { |
7 | EXTERNAL_INTERRUPT, | 8 | EXTERNAL_INTERRUPT, |
@@ -31,4 +32,11 @@ enum interruption_class { | |||
31 | NR_IRQS, | 32 | NR_IRQS, |
32 | }; | 33 | }; |
33 | 34 | ||
35 | typedef void (*ext_int_handler_t)(unsigned int, unsigned int, unsigned long); | ||
36 | |||
37 | int register_external_interrupt(u16 code, ext_int_handler_t handler); | ||
38 | int unregister_external_interrupt(u16 code, ext_int_handler_t handler); | ||
39 | void service_subclass_irq_register(void); | ||
40 | void service_subclass_irq_unregister(void); | ||
41 | |||
34 | #endif /* _ASM_IRQ_H */ | 42 | #endif /* _ASM_IRQ_H */ |
diff --git a/arch/s390/include/asm/s390_ext.h b/arch/s390/include/asm/s390_ext.h deleted file mode 100644 index 080876d5f196..000000000000 --- a/arch/s390/include/asm/s390_ext.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright IBM Corp. 1999,2010 | ||
3 | * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>, | ||
4 | * Martin Schwidefsky <schwidefsky@de.ibm.com>, | ||
5 | */ | ||
6 | |||
7 | #ifndef _S390_EXTINT_H | ||
8 | #define _S390_EXTINT_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | |||
12 | typedef void (*ext_int_handler_t)(unsigned int, unsigned int, unsigned long); | ||
13 | |||
14 | int register_external_interrupt(__u16 code, ext_int_handler_t handler); | ||
15 | int unregister_external_interrupt(__u16 code, ext_int_handler_t handler); | ||
16 | |||
17 | #endif /* _S390_EXTINT_H */ | ||
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h index c5338834ddbd..005d77d8ae2a 100644 --- a/arch/s390/include/asm/topology.h +++ b/arch/s390/include/asm/topology.h | |||
@@ -7,7 +7,7 @@ | |||
7 | extern unsigned char cpu_core_id[NR_CPUS]; | 7 | extern unsigned char cpu_core_id[NR_CPUS]; |
8 | extern cpumask_t cpu_core_map[NR_CPUS]; | 8 | extern cpumask_t cpu_core_map[NR_CPUS]; |
9 | 9 | ||
10 | static inline const struct cpumask *cpu_coregroup_mask(unsigned int cpu) | 10 | static inline const struct cpumask *cpu_coregroup_mask(int cpu) |
11 | { | 11 | { |
12 | return &cpu_core_map[cpu]; | 12 | return &cpu_core_map[cpu]; |
13 | } | 13 | } |
@@ -21,7 +21,7 @@ static inline const struct cpumask *cpu_coregroup_mask(unsigned int cpu) | |||
21 | extern unsigned char cpu_book_id[NR_CPUS]; | 21 | extern unsigned char cpu_book_id[NR_CPUS]; |
22 | extern cpumask_t cpu_book_map[NR_CPUS]; | 22 | extern cpumask_t cpu_book_map[NR_CPUS]; |
23 | 23 | ||
24 | static inline const struct cpumask *cpu_book_mask(unsigned int cpu) | 24 | static inline const struct cpumask *cpu_book_mask(int cpu) |
25 | { | 25 | { |
26 | return &cpu_book_map[cpu]; | 26 | return &cpu_book_map[cpu]; |
27 | } | 27 | } |
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 2d9ea11f919a..2b23885e81e9 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h | |||
@@ -49,12 +49,13 @@ | |||
49 | 49 | ||
50 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) | 50 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) |
51 | 51 | ||
52 | #define __access_ok(addr, size) \ | ||
53 | ({ \ | ||
54 | __chk_user_ptr(addr); \ | ||
55 | 1; \ | ||
56 | }) | ||
52 | 57 | ||
53 | static inline int __access_ok(const void __user *addr, unsigned long size) | 58 | #define access_ok(type, addr, size) __access_ok(addr, size) |
54 | { | ||
55 | return 1; | ||
56 | } | ||
57 | #define access_ok(type,addr,size) __access_ok(addr,size) | ||
58 | 59 | ||
59 | /* | 60 | /* |
60 | * The exception table consists of pairs of addresses: the first is the | 61 | * The exception table consists of pairs of addresses: the first is the |
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 5ff15dacb571..df3732249baa 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -20,10 +20,10 @@ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' | |||
20 | 20 | ||
21 | CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w | 21 | CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w |
22 | 22 | ||
23 | obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o \ | 23 | obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o \ |
24 | processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ | 24 | processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o \ |
25 | s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o \ | 25 | debug.o irq.o ipl.o dis.o diag.o mem_detect.o sclp.o vdso.o \ |
26 | vdso.o vtime.o sysinfo.o nmi.o sclp.o jump_label.o | 26 | sysinfo.o jump_label.o |
27 | 27 | ||
28 | obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) | 28 | obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) |
29 | obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) | 29 | obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) |
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c index 3d4a78fc1adc..1ca3d1d6a86c 100644 --- a/arch/s390/kernel/dis.c +++ b/arch/s390/kernel/dis.c | |||
@@ -30,9 +30,9 @@ | |||
30 | #include <asm/atomic.h> | 30 | #include <asm/atomic.h> |
31 | #include <asm/mathemu.h> | 31 | #include <asm/mathemu.h> |
32 | #include <asm/cpcmd.h> | 32 | #include <asm/cpcmd.h> |
33 | #include <asm/s390_ext.h> | ||
34 | #include <asm/lowcore.h> | 33 | #include <asm/lowcore.h> |
35 | #include <asm/debug.h> | 34 | #include <asm/debug.h> |
35 | #include <asm/irq.h> | ||
36 | 36 | ||
37 | #ifndef CONFIG_64BIT | 37 | #ifndef CONFIG_64BIT |
38 | #define ONELONG "%08lx: " | 38 | #define ONELONG "%08lx: " |
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index e204f9597aaf..e3264f6a9720 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c | |||
@@ -1,19 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2004,2010 | 2 | * Copyright IBM Corp. 2004,2011 |
3 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | 3 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>, |
4 | * Thomas Spatzier (tspat@de.ibm.com) | 4 | * Holger Smolinski <Holger.Smolinski@de.ibm.com>, |
5 | * Thomas Spatzier <tspat@de.ibm.com>, | ||
5 | * | 6 | * |
6 | * This file contains interrupt related functions. | 7 | * This file contains interrupt related functions. |
7 | */ | 8 | */ |
8 | 9 | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/kernel_stat.h> | 10 | #include <linux/kernel_stat.h> |
12 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
13 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
14 | #include <linux/cpu.h> | ||
15 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
16 | #include <linux/profile.h> | 14 | #include <linux/profile.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/ftrace.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/cpu.h> | ||
21 | #include <asm/irq_regs.h> | ||
22 | #include <asm/cputime.h> | ||
23 | #include <asm/lowcore.h> | ||
24 | #include <asm/irq.h> | ||
25 | #include "entry.h" | ||
17 | 26 | ||
18 | struct irq_class { | 27 | struct irq_class { |
19 | char *name; | 28 | char *name; |
@@ -82,8 +91,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
82 | * For compatibilty only. S/390 specific setup of interrupts et al. is done | 91 | * For compatibilty only. S/390 specific setup of interrupts et al. is done |
83 | * much later in init_channel_subsystem(). | 92 | * much later in init_channel_subsystem(). |
84 | */ | 93 | */ |
85 | void __init | 94 | void __init init_IRQ(void) |
86 | init_IRQ(void) | ||
87 | { | 95 | { |
88 | /* nothing... */ | 96 | /* nothing... */ |
89 | } | 97 | } |
@@ -134,3 +142,116 @@ void init_irq_proc(void) | |||
134 | create_prof_cpu_mask(root_irq_dir); | 142 | create_prof_cpu_mask(root_irq_dir); |
135 | } | 143 | } |
136 | #endif | 144 | #endif |
145 | |||
146 | /* | ||
147 | * ext_int_hash[index] is the start of the list for all external interrupts | ||
148 | * that hash to this index. With the current set of external interrupts | ||
149 | * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000 | ||
150 | * iucv and 0x2603 pfault) this is always the first element. | ||
151 | */ | ||
152 | |||
153 | struct ext_int_info { | ||
154 | struct ext_int_info *next; | ||
155 | ext_int_handler_t handler; | ||
156 | u16 code; | ||
157 | }; | ||
158 | |||
159 | static struct ext_int_info *ext_int_hash[256]; | ||
160 | |||
161 | static inline int ext_hash(u16 code) | ||
162 | { | ||
163 | return (code + (code >> 9)) & 0xff; | ||
164 | } | ||
165 | |||
166 | int register_external_interrupt(u16 code, ext_int_handler_t handler) | ||
167 | { | ||
168 | struct ext_int_info *p; | ||
169 | int index; | ||
170 | |||
171 | p = kmalloc(sizeof(*p), GFP_ATOMIC); | ||
172 | if (!p) | ||
173 | return -ENOMEM; | ||
174 | p->code = code; | ||
175 | p->handler = handler; | ||
176 | index = ext_hash(code); | ||
177 | p->next = ext_int_hash[index]; | ||
178 | ext_int_hash[index] = p; | ||
179 | return 0; | ||
180 | } | ||
181 | EXPORT_SYMBOL(register_external_interrupt); | ||
182 | |||
183 | int unregister_external_interrupt(u16 code, ext_int_handler_t handler) | ||
184 | { | ||
185 | struct ext_int_info *p, *q; | ||
186 | int index; | ||
187 | |||
188 | index = ext_hash(code); | ||
189 | q = NULL; | ||
190 | p = ext_int_hash[index]; | ||
191 | while (p) { | ||
192 | if (p->code == code && p->handler == handler) | ||
193 | break; | ||
194 | q = p; | ||
195 | p = p->next; | ||
196 | } | ||
197 | if (!p) | ||
198 | return -ENOENT; | ||
199 | if (q) | ||
200 | q->next = p->next; | ||
201 | else | ||
202 | ext_int_hash[index] = p->next; | ||
203 | kfree(p); | ||
204 | return 0; | ||
205 | } | ||
206 | EXPORT_SYMBOL(unregister_external_interrupt); | ||
207 | |||
208 | void __irq_entry do_extint(struct pt_regs *regs, unsigned int ext_int_code, | ||
209 | unsigned int param32, unsigned long param64) | ||
210 | { | ||
211 | struct pt_regs *old_regs; | ||
212 | unsigned short code; | ||
213 | struct ext_int_info *p; | ||
214 | int index; | ||
215 | |||
216 | code = (unsigned short) ext_int_code; | ||
217 | old_regs = set_irq_regs(regs); | ||
218 | s390_idle_check(regs, S390_lowcore.int_clock, | ||
219 | S390_lowcore.async_enter_timer); | ||
220 | irq_enter(); | ||
221 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) | ||
222 | /* Serve timer interrupts first. */ | ||
223 | clock_comparator_work(); | ||
224 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; | ||
225 | if (code != 0x1004) | ||
226 | __get_cpu_var(s390_idle).nohz_delay = 1; | ||
227 | index = ext_hash(code); | ||
228 | for (p = ext_int_hash[index]; p; p = p->next) { | ||
229 | if (likely(p->code == code)) | ||
230 | p->handler(ext_int_code, param32, param64); | ||
231 | } | ||
232 | irq_exit(); | ||
233 | set_irq_regs(old_regs); | ||
234 | } | ||
235 | |||
236 | static DEFINE_SPINLOCK(sc_irq_lock); | ||
237 | static int sc_irq_refcount; | ||
238 | |||
239 | void service_subclass_irq_register(void) | ||
240 | { | ||
241 | spin_lock(&sc_irq_lock); | ||
242 | if (!sc_irq_refcount) | ||
243 | ctl_set_bit(0, 9); | ||
244 | sc_irq_refcount++; | ||
245 | spin_unlock(&sc_irq_lock); | ||
246 | } | ||
247 | EXPORT_SYMBOL(service_subclass_irq_register); | ||
248 | |||
249 | void service_subclass_irq_unregister(void) | ||
250 | { | ||
251 | spin_lock(&sc_irq_lock); | ||
252 | sc_irq_refcount--; | ||
253 | if (!sc_irq_refcount) | ||
254 | ctl_clear_bit(0, 9); | ||
255 | spin_unlock(&sc_irq_lock); | ||
256 | } | ||
257 | EXPORT_SYMBOL(service_subclass_irq_unregister); | ||
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c deleted file mode 100644 index 185029919c4d..000000000000 --- a/arch/s390/kernel/s390_ext.c +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright IBM Corp. 1999,2010 | ||
3 | * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>, | ||
4 | * Martin Schwidefsky <schwidefsky@de.ibm.com>, | ||
5 | */ | ||
6 | |||
7 | #include <linux/kernel_stat.h> | ||
8 | #include <linux/interrupt.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/ftrace.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <asm/s390_ext.h> | ||
15 | #include <asm/irq_regs.h> | ||
16 | #include <asm/cputime.h> | ||
17 | #include <asm/lowcore.h> | ||
18 | #include <asm/irq.h> | ||
19 | #include "entry.h" | ||
20 | |||
21 | struct ext_int_info { | ||
22 | struct ext_int_info *next; | ||
23 | ext_int_handler_t handler; | ||
24 | __u16 code; | ||
25 | }; | ||
26 | |||
27 | /* | ||
28 | * ext_int_hash[index] is the start of the list for all external interrupts | ||
29 | * that hash to this index. With the current set of external interrupts | ||
30 | * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000 | ||
31 | * iucv and 0x2603 pfault) this is always the first element. | ||
32 | */ | ||
33 | static struct ext_int_info *ext_int_hash[256]; | ||
34 | |||
35 | static inline int ext_hash(__u16 code) | ||
36 | { | ||
37 | return (code + (code >> 9)) & 0xff; | ||
38 | } | ||
39 | |||
40 | int register_external_interrupt(__u16 code, ext_int_handler_t handler) | ||
41 | { | ||
42 | struct ext_int_info *p; | ||
43 | int index; | ||
44 | |||
45 | p = kmalloc(sizeof(*p), GFP_ATOMIC); | ||
46 | if (!p) | ||
47 | return -ENOMEM; | ||
48 | p->code = code; | ||
49 | p->handler = handler; | ||
50 | index = ext_hash(code); | ||
51 | p->next = ext_int_hash[index]; | ||
52 | ext_int_hash[index] = p; | ||
53 | return 0; | ||
54 | } | ||
55 | EXPORT_SYMBOL(register_external_interrupt); | ||
56 | |||
57 | int unregister_external_interrupt(__u16 code, ext_int_handler_t handler) | ||
58 | { | ||
59 | struct ext_int_info *p, *q; | ||
60 | int index; | ||
61 | |||
62 | index = ext_hash(code); | ||
63 | q = NULL; | ||
64 | p = ext_int_hash[index]; | ||
65 | while (p) { | ||
66 | if (p->code == code && p->handler == handler) | ||
67 | break; | ||
68 | q = p; | ||
69 | p = p->next; | ||
70 | } | ||
71 | if (!p) | ||
72 | return -ENOENT; | ||
73 | if (q) | ||
74 | q->next = p->next; | ||
75 | else | ||
76 | ext_int_hash[index] = p->next; | ||
77 | kfree(p); | ||
78 | return 0; | ||
79 | } | ||
80 | EXPORT_SYMBOL(unregister_external_interrupt); | ||
81 | |||
82 | void __irq_entry do_extint(struct pt_regs *regs, unsigned int ext_int_code, | ||
83 | unsigned int param32, unsigned long param64) | ||
84 | { | ||
85 | struct pt_regs *old_regs; | ||
86 | unsigned short code; | ||
87 | struct ext_int_info *p; | ||
88 | int index; | ||
89 | |||
90 | code = (unsigned short) ext_int_code; | ||
91 | old_regs = set_irq_regs(regs); | ||
92 | s390_idle_check(regs, S390_lowcore.int_clock, | ||
93 | S390_lowcore.async_enter_timer); | ||
94 | irq_enter(); | ||
95 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) | ||
96 | /* Serve timer interrupts first. */ | ||
97 | clock_comparator_work(); | ||
98 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; | ||
99 | if (code != 0x1004) | ||
100 | __get_cpu_var(s390_idle).nohz_delay = 1; | ||
101 | index = ext_hash(code); | ||
102 | for (p = ext_int_hash[index]; p; p = p->next) { | ||
103 | if (likely(p->code == code)) | ||
104 | p->handler(ext_int_code, param32, param64); | ||
105 | } | ||
106 | irq_exit(); | ||
107 | set_irq_regs(old_regs); | ||
108 | } | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index f8e85ecbc459..52420d2785b3 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <asm/sigp.h> | 44 | #include <asm/sigp.h> |
45 | #include <asm/pgalloc.h> | 45 | #include <asm/pgalloc.h> |
46 | #include <asm/irq.h> | 46 | #include <asm/irq.h> |
47 | #include <asm/s390_ext.h> | ||
48 | #include <asm/cpcmd.h> | 47 | #include <asm/cpcmd.h> |
49 | #include <asm/tlbflush.h> | 48 | #include <asm/tlbflush.h> |
50 | #include <asm/timer.h> | 49 | #include <asm/timer.h> |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index a59557f1fb5f..dff933065ab6 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/kprobes.h> | 41 | #include <linux/kprobes.h> |
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #include <asm/delay.h> | 43 | #include <asm/delay.h> |
44 | #include <asm/s390_ext.h> | ||
45 | #include <asm/div64.h> | 44 | #include <asm/div64.h> |
46 | #include <asm/vdso.h> | 45 | #include <asm/vdso.h> |
47 | #include <asm/irq.h> | 46 | #include <asm/irq.h> |
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 2eafb8c7a746..0cd340b72632 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/cpuset.h> | 18 | #include <linux/cpuset.h> |
19 | #include <asm/delay.h> | 19 | #include <asm/delay.h> |
20 | #include <asm/s390_ext.h> | ||
21 | 20 | ||
22 | #define PTF_HORIZONTAL (0UL) | 21 | #define PTF_HORIZONTAL (0UL) |
23 | #define PTF_VERTICAL (1UL) | 22 | #define PTF_VERTICAL (1UL) |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index b5a4a739b477..a65d2e82f61d 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <asm/atomic.h> | 39 | #include <asm/atomic.h> |
40 | #include <asm/mathemu.h> | 40 | #include <asm/mathemu.h> |
41 | #include <asm/cpcmd.h> | 41 | #include <asm/cpcmd.h> |
42 | #include <asm/s390_ext.h> | ||
43 | #include <asm/lowcore.h> | 42 | #include <asm/lowcore.h> |
44 | #include <asm/debug.h> | 43 | #include <asm/debug.h> |
45 | #include "entry.h" | 44 | #include "entry.h" |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 5e8ead4b4aba..2d6228f60cd6 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -22,10 +22,10 @@ | |||
22 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
23 | #include <linux/kprobes.h> | 23 | #include <linux/kprobes.h> |
24 | 24 | ||
25 | #include <asm/s390_ext.h> | ||
26 | #include <asm/timer.h> | 25 | #include <asm/timer.h> |
27 | #include <asm/irq_regs.h> | 26 | #include <asm/irq_regs.h> |
28 | #include <asm/cputime.h> | 27 | #include <asm/cputime.h> |
28 | #include <asm/irq.h> | ||
29 | 29 | ||
30 | static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); | 30 | static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); |
31 | 31 | ||
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c index 0f53110e1d09..a65229d91c92 100644 --- a/arch/s390/lib/delay.c +++ b/arch/s390/lib/delay.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/irqflags.h> | 13 | #include <linux/irqflags.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <asm/div64.h> | ||
15 | 16 | ||
16 | void __delay(unsigned long loops) | 17 | void __delay(unsigned long loops) |
17 | { | 18 | { |
@@ -116,3 +117,17 @@ void udelay_simple(unsigned long long usecs) | |||
116 | while (get_clock() < end) | 117 | while (get_clock() < end) |
117 | cpu_relax(); | 118 | cpu_relax(); |
118 | } | 119 | } |
120 | |||
121 | void __ndelay(unsigned long long nsecs) | ||
122 | { | ||
123 | u64 end; | ||
124 | |||
125 | nsecs <<= 9; | ||
126 | do_div(nsecs, 125); | ||
127 | end = get_clock() + nsecs; | ||
128 | if (nsecs & ~0xfffUL) | ||
129 | __udelay(nsecs >> 12); | ||
130 | while (get_clock() < end) | ||
131 | barrier(); | ||
132 | } | ||
133 | EXPORT_SYMBOL(__ndelay); | ||
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index a0f9e730f26a..fe103e891e7a 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <asm/asm-offsets.h> | 34 | #include <asm/asm-offsets.h> |
35 | #include <asm/system.h> | 35 | #include <asm/system.h> |
36 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
37 | #include <asm/s390_ext.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/mmu_context.h> | 38 | #include <asm/mmu_context.h> |
39 | #include <asm/compat.h> | 39 | #include <asm/compat.h> |
40 | #include "../kernel/entry.h" | 40 | #include "../kernel/entry.h" |
@@ -245,9 +245,12 @@ static noinline void do_fault_error(struct pt_regs *regs, long int_code, | |||
245 | do_no_context(regs, int_code, trans_exc_code); | 245 | do_no_context(regs, int_code, trans_exc_code); |
246 | break; | 246 | break; |
247 | default: /* fault & VM_FAULT_ERROR */ | 247 | default: /* fault & VM_FAULT_ERROR */ |
248 | if (fault & VM_FAULT_OOM) | 248 | if (fault & VM_FAULT_OOM) { |
249 | pagefault_out_of_memory(); | 249 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) |
250 | else if (fault & VM_FAULT_SIGBUS) { | 250 | do_no_context(regs, int_code, trans_exc_code); |
251 | else | ||
252 | pagefault_out_of_memory(); | ||
253 | } else if (fault & VM_FAULT_SIGBUS) { | ||
251 | /* Kernel mode? Handle exceptions or die */ | 254 | /* Kernel mode? Handle exceptions or die */ |
252 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) | 255 | if (!(regs->psw.mask & PSW_MASK_PSTATE)) |
253 | do_no_context(regs, int_code, trans_exc_code); | 256 | do_no_context(regs, int_code, trans_exc_code); |
@@ -277,7 +280,8 @@ static inline int do_exception(struct pt_regs *regs, int access, | |||
277 | struct mm_struct *mm; | 280 | struct mm_struct *mm; |
278 | struct vm_area_struct *vma; | 281 | struct vm_area_struct *vma; |
279 | unsigned long address; | 282 | unsigned long address; |
280 | int fault, write; | 283 | unsigned int flags; |
284 | int fault; | ||
281 | 285 | ||
282 | if (notify_page_fault(regs)) | 286 | if (notify_page_fault(regs)) |
283 | return 0; | 287 | return 0; |
@@ -296,6 +300,10 @@ static inline int do_exception(struct pt_regs *regs, int access, | |||
296 | 300 | ||
297 | address = trans_exc_code & __FAIL_ADDR_MASK; | 301 | address = trans_exc_code & __FAIL_ADDR_MASK; |
298 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); | 302 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); |
303 | flags = FAULT_FLAG_ALLOW_RETRY; | ||
304 | if (access == VM_WRITE || (trans_exc_code & store_indication) == 0x400) | ||
305 | flags |= FAULT_FLAG_WRITE; | ||
306 | retry: | ||
299 | down_read(&mm->mmap_sem); | 307 | down_read(&mm->mmap_sem); |
300 | 308 | ||
301 | fault = VM_FAULT_BADMAP; | 309 | fault = VM_FAULT_BADMAP; |
@@ -325,21 +333,31 @@ static inline int do_exception(struct pt_regs *regs, int access, | |||
325 | * make sure we exit gracefully rather than endlessly redo | 333 | * make sure we exit gracefully rather than endlessly redo |
326 | * the fault. | 334 | * the fault. |
327 | */ | 335 | */ |
328 | write = (access == VM_WRITE || | 336 | fault = handle_mm_fault(mm, vma, address, flags); |
329 | (trans_exc_code & store_indication) == 0x400) ? | ||
330 | FAULT_FLAG_WRITE : 0; | ||
331 | fault = handle_mm_fault(mm, vma, address, write); | ||
332 | if (unlikely(fault & VM_FAULT_ERROR)) | 337 | if (unlikely(fault & VM_FAULT_ERROR)) |
333 | goto out_up; | 338 | goto out_up; |
334 | 339 | ||
335 | if (fault & VM_FAULT_MAJOR) { | 340 | /* |
336 | tsk->maj_flt++; | 341 | * Major/minor page fault accounting is only done on the |
337 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, | 342 | * initial attempt. If we go through a retry, it is extremely |
338 | regs, address); | 343 | * likely that the page will be found in page cache at that point. |
339 | } else { | 344 | */ |
340 | tsk->min_flt++; | 345 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
341 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, | 346 | if (fault & VM_FAULT_MAJOR) { |
342 | regs, address); | 347 | tsk->maj_flt++; |
348 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, | ||
349 | regs, address); | ||
350 | } else { | ||
351 | tsk->min_flt++; | ||
352 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, | ||
353 | regs, address); | ||
354 | } | ||
355 | if (fault & VM_FAULT_RETRY) { | ||
356 | /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk | ||
357 | * of starvation. */ | ||
358 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | ||
359 | goto retry; | ||
360 | } | ||
343 | } | 361 | } |
344 | /* | 362 | /* |
345 | * The instruction that caused the program check will | 363 | * The instruction that caused the program check will |
@@ -429,10 +447,9 @@ int __handle_fault(unsigned long uaddr, unsigned long pgm_int_code, int write) | |||
429 | access = write ? VM_WRITE : VM_READ; | 447 | access = write ? VM_WRITE : VM_READ; |
430 | fault = do_exception(®s, access, uaddr | 2); | 448 | fault = do_exception(®s, access, uaddr | 2); |
431 | if (unlikely(fault)) { | 449 | if (unlikely(fault)) { |
432 | if (fault & VM_FAULT_OOM) { | 450 | if (fault & VM_FAULT_OOM) |
433 | pagefault_out_of_memory(); | 451 | return -EFAULT; |
434 | fault = 0; | 452 | else if (fault & VM_FAULT_SIGBUS) |
435 | } else if (fault & VM_FAULT_SIGBUS) | ||
436 | do_sigbus(®s, pgm_int_code, uaddr); | 453 | do_sigbus(®s, pgm_int_code, uaddr); |
437 | } | 454 | } |
438 | return fault ? -EFAULT : 0; | 455 | return fault ? -EFAULT : 0; |
@@ -485,7 +502,6 @@ int pfault_init(void) | |||
485 | "2:\n" | 502 | "2:\n" |
486 | EX_TABLE(0b,1b) | 503 | EX_TABLE(0b,1b) |
487 | : "=d" (rc) : "a" (&refbk), "m" (refbk) : "cc"); | 504 | : "=d" (rc) : "a" (&refbk), "m" (refbk) : "cc"); |
488 | __ctl_set_bit(0, 9); | ||
489 | return rc; | 505 | return rc; |
490 | } | 506 | } |
491 | 507 | ||
@@ -500,7 +516,6 @@ void pfault_fini(void) | |||
500 | 516 | ||
501 | if (!MACHINE_IS_VM || pfault_disable) | 517 | if (!MACHINE_IS_VM || pfault_disable) |
502 | return; | 518 | return; |
503 | __ctl_clear_bit(0,9); | ||
504 | asm volatile( | 519 | asm volatile( |
505 | " diag %0,0,0x258\n" | 520 | " diag %0,0,0x258\n" |
506 | "0:\n" | 521 | "0:\n" |
@@ -615,6 +630,7 @@ static int __init pfault_irq_init(void) | |||
615 | rc = pfault_init() == 0 ? 0 : -EOPNOTSUPP; | 630 | rc = pfault_init() == 0 ? 0 : -EOPNOTSUPP; |
616 | if (rc) | 631 | if (rc) |
617 | goto out_pfault; | 632 | goto out_pfault; |
633 | service_subclass_irq_register(); | ||
618 | hotcpu_notifier(pfault_cpu_notify, 0); | 634 | hotcpu_notifier(pfault_cpu_notify, 0); |
619 | return 0; | 635 | return 0; |
620 | 636 | ||
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index dfefc2171691..59b663109d90 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -119,9 +119,7 @@ void __init paging_init(void) | |||
119 | sparse_memory_present_with_active_regions(MAX_NUMNODES); | 119 | sparse_memory_present_with_active_regions(MAX_NUMNODES); |
120 | sparse_init(); | 120 | sparse_init(); |
121 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 121 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
122 | #ifdef CONFIG_ZONE_DMA | ||
123 | max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS); | 122 | max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS); |
124 | #endif | ||
125 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | 123 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
126 | free_area_init_nodes(max_zone_pfns); | 124 | free_area_init_nodes(max_zone_pfns); |
127 | fault_init(); | 125 | fault_init(); |
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c index 053caa0fd276..4552ce40c81a 100644 --- a/arch/s390/oprofile/hwsampler.c +++ b/arch/s390/oprofile/hwsampler.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/oprofile.h> | 19 | #include <linux/oprofile.h> |
20 | 20 | ||
21 | #include <asm/lowcore.h> | 21 | #include <asm/lowcore.h> |
22 | #include <asm/s390_ext.h> | 22 | #include <asm/irq.h> |
23 | 23 | ||
24 | #include "hwsampler.h" | 24 | #include "hwsampler.h" |
25 | 25 | ||
@@ -580,7 +580,7 @@ static int hws_cpu_callback(struct notifier_block *nfb, | |||
580 | { | 580 | { |
581 | /* We do not have sampler space available for all possible CPUs. | 581 | /* We do not have sampler space available for all possible CPUs. |
582 | All CPUs should be online when hw sampling is activated. */ | 582 | All CPUs should be online when hw sampling is activated. */ |
583 | return NOTIFY_BAD; | 583 | return (hws_state <= HWS_DEALLOCATED) ? NOTIFY_OK : NOTIFY_BAD; |
584 | } | 584 | } |
585 | 585 | ||
586 | static struct notifier_block hws_cpu_notifier = { | 586 | static struct notifier_block hws_cpu_notifier = { |