aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2011-05-26 03:48:24 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2011-05-26 03:48:24 -0400
commitd7b250e2a2d7f3cd23cf8d8d6689285e6f51a98d (patch)
tree5bfb94fff047818db31613762a8986784241ca8c /arch/s390
parentdf7997ab1ca82ae3c37a2f5eb98613fc24527f95 (diff)
[S390] irq: merge irq.c and s390_ext.c
Merge irq.c and s390_ext.c into irq.c. That way all external interrupt related functions are together. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/irq.h8
-rw-r--r--arch/s390/include/asm/s390_ext.h19
-rw-r--r--arch/s390/kernel/Makefile8
-rw-r--r--arch/s390/kernel/dis.c2
-rw-r--r--arch/s390/kernel/irq.c137
-rw-r--r--arch/s390/kernel/s390_ext.c131
-rw-r--r--arch/s390/kernel/smp.c1
-rw-r--r--arch/s390/kernel/time.c1
-rw-r--r--arch/s390/kernel/topology.c1
-rw-r--r--arch/s390/kernel/traps.c1
-rw-r--r--arch/s390/kernel/vtime.c2
-rw-r--r--arch/s390/mm/fault.c2
-rw-r--r--arch/s390/oprofile/hwsampler.c2
13 files changed, 145 insertions, 170 deletions
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
6enum interruption_class { 7enum 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
35typedef void (*ext_int_handler_t)(unsigned int, unsigned int, unsigned long);
36
37int register_external_interrupt(u16 code, ext_int_handler_t handler);
38int unregister_external_interrupt(u16 code, ext_int_handler_t handler);
39void service_subclass_irq_register(void);
40void 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 85b2154b899f..000000000000
--- a/arch/s390/include/asm/s390_ext.h
+++ /dev/null
@@ -1,19 +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
12typedef void (*ext_int_handler_t)(unsigned int, unsigned int, unsigned long);
13
14int register_external_interrupt(__u16 code, ext_int_handler_t handler);
15int unregister_external_interrupt(__u16 code, ext_int_handler_t handler);
16void service_subclass_irq_register(void);
17void service_subclass_irq_unregister(void);
18
19#endif /* _S390_EXTINT_H */
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
21CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w 21CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
22 22
23obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o \ 23obj-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
28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 29obj-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
18struct irq_class { 27struct 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 */
85void __init 94void __init init_IRQ(void)
86init_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
153struct ext_int_info {
154 struct ext_int_info *next;
155 ext_int_handler_t handler;
156 u16 code;
157};
158
159static struct ext_int_info *ext_int_hash[256];
160
161static inline int ext_hash(u16 code)
162{
163 return (code + (code >> 9)) & 0xff;
164}
165
166int 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}
181EXPORT_SYMBOL(register_external_interrupt);
182
183int 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}
206EXPORT_SYMBOL(unregister_external_interrupt);
207
208void __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
236static DEFINE_SPINLOCK(sc_irq_lock);
237static int sc_irq_refcount;
238
239void 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}
247EXPORT_SYMBOL(service_subclass_irq_register);
248
249void 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}
257EXPORT_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 87b5c532abf1..000000000000
--- a/arch/s390/kernel/s390_ext.c
+++ /dev/null
@@ -1,131 +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
21struct 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 */
33static struct ext_int_info *ext_int_hash[256];
34
35static inline int ext_hash(__u16 code)
36{
37 return (code + (code >> 9)) & 0xff;
38}
39
40int 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}
55EXPORT_SYMBOL(register_external_interrupt);
56
57int 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}
80EXPORT_SYMBOL(unregister_external_interrupt);
81
82void __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}
109
110static DEFINE_SPINLOCK(sc_irq_lock);
111static int sc_irq_refcount;
112
113void service_subclass_irq_register(void)
114{
115 spin_lock(&sc_irq_lock);
116 if (!sc_irq_refcount)
117 ctl_set_bit(0, 9);
118 sc_irq_refcount++;
119 spin_unlock(&sc_irq_lock);
120}
121EXPORT_SYMBOL(service_subclass_irq_register);
122
123void service_subclass_irq_unregister(void)
124{
125 spin_lock(&sc_irq_lock);
126 sc_irq_refcount--;
127 if (!sc_irq_refcount)
128 ctl_clear_bit(0, 9);
129 spin_unlock(&sc_irq_lock);
130}
131EXPORT_SYMBOL(service_subclass_irq_unregister);
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
30static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); 30static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
31 31
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 6e922b50efa4..105fa1071435 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"
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c
index 053caa0fd276..4634c9ef9722 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