Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / arch / s390 / kernel / irq.c
1 /*
2  *    Copyright IBM Corp. 2004,2010
3  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
4  *               Thomas Spatzier (tspat@de.ibm.com)
5  *
6  * This file contains interrupt related functions.
7  */
8
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/kernel_stat.h>
12 #include <linux/interrupt.h>
13 #include <linux/seq_file.h>
14 #include <linux/cpu.h>
15 #include <linux/proc_fs.h>
16 #include <linux/profile.h>
17
18 struct irq_class {
19         char *name;
20         char *desc;
21 };
22
23 static const struct irq_class intrclass_names[] = {
24         {.name = "EXT" },
25         {.name = "I/O" },
26         {.name = "CLK", .desc = "[EXT] Clock Comparator" },
27         {.name = "IPI", .desc = "[EXT] Signal Processor" },
28         {.name = "TMR", .desc = "[EXT] CPU Timer" },
29         {.name = "TAL", .desc = "[EXT] Timing Alert" },
30         {.name = "PFL", .desc = "[EXT] Pseudo Page Fault" },
31         {.name = "DSD", .desc = "[EXT] DASD Diag" },
32         {.name = "VRT", .desc = "[EXT] Virtio" },
33         {.name = "SCP", .desc = "[EXT] Service Call" },
34         {.name = "IUC", .desc = "[EXT] IUCV" },
35         {.name = "CPM", .desc = "[EXT] CPU Measurement" },
36         {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt" },
37         {.name = "QDI", .desc = "[I/O] QDIO Interrupt" },
38         {.name = "DAS", .desc = "[I/O] DASD" },
39         {.name = "C15", .desc = "[I/O] 3215" },
40         {.name = "C70", .desc = "[I/O] 3270" },
41         {.name = "TAP", .desc = "[I/O] Tape" },
42         {.name = "VMR", .desc = "[I/O] Unit Record Devices" },
43         {.name = "LCS", .desc = "[I/O] LCS" },
44         {.name = "CLW", .desc = "[I/O] CLAW" },
45         {.name = "CTC", .desc = "[I/O] CTC" },
46         {.name = "APB", .desc = "[I/O] AP Bus" },
47         {.name = "NMI", .desc = "[NMI] Machine Check" },
48 };
49
50 /*
51  * show_interrupts is needed by /proc/interrupts.
52  */
53 int show_interrupts(struct seq_file *p, void *v)
54 {
55         int i = *(loff_t *) v, j;
56
57         get_online_cpus();
58         if (i == 0) {
59                 seq_puts(p, "           ");
60                 for_each_online_cpu(j)
61                         seq_printf(p, "CPU%d       ",j);
62                 seq_putc(p, '\n');
63         }
64
65         if (i < NR_IRQS) {
66                 seq_printf(p, "%s: ", intrclass_names[i].name);
67 #ifndef CONFIG_SMP
68                 seq_printf(p, "%10u ", kstat_irqs(i));
69 #else
70                 for_each_online_cpu(j)
71                         seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
72 #endif
73                 if (intrclass_names[i].desc)
74                         seq_printf(p, "  %s", intrclass_names[i].desc);
75                 seq_putc(p, '\n');
76         }
77         put_online_cpus();
78         return 0;
79 }
80
81 /*
82  * For compatibilty only. S/390 specific setup of interrupts et al. is done
83  * much later in init_channel_subsystem().
84  */
85 void __init
86 init_IRQ(void)
87 {
88         /* nothing... */
89 }
90
91 /*
92  * Switch to the asynchronous interrupt stack for softirq execution.
93  */
94 asmlinkage void do_softirq(void)
95 {
96         unsigned long flags, old, new;
97
98         if (in_interrupt())
99                 return;
100
101         local_irq_save(flags);
102
103         if (local_softirq_pending()) {
104                 /* Get current stack pointer. */
105                 asm volatile("la %0,0(15)" : "=a" (old));
106                 /* Check against async. stack address range. */
107                 new = S390_lowcore.async_stack;
108                 if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) {
109                         /* Need to switch to the async. stack. */
110                         new -= STACK_FRAME_OVERHEAD;
111                         ((struct stack_frame *) new)->back_chain = old;
112
113                         asm volatile("   la    15,0(%0)\n"
114                                      "   basr  14,%2\n"
115                                      "   la    15,0(%1)\n"
116                                      : : "a" (new), "a" (old),
117                                          "a" (__do_softirq)
118                                      : "0", "1", "2", "3", "4", "5", "14",
119                                        "cc", "memory" );
120                 } else
121                         /* We are already on the async stack. */
122                         __do_softirq();
123         }
124
125         local_irq_restore(flags);
126 }
127
128 #ifdef CONFIG_PROC_FS
129 void init_irq_proc(void)
130 {
131         struct proc_dir_entry *root_irq_dir;
132
133         root_irq_dir = proc_mkdir("irq", NULL);
134         create_prof_cpu_mask(root_irq_dir);
135 }
136 #endif