blob: 3624c4a0037a6e79e2a5ec2939f7bee98880ab60 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/s390/kernel/irq.c
3 *
Heiko Carstens55dff522007-02-05 21:16:44 +01004 * Copyright IBM Corp. 2004,2007
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
Heiko Carstens55dff522007-02-05 21:16:44 +01006 * Thomas Spatzier (tspat@de.ibm.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * This file contains interrupt related functions.
9 */
10
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/kernel_stat.h>
14#include <linux/interrupt.h>
15#include <linux/seq_file.h>
16#include <linux/cpu.h>
Heiko Carstens55dff522007-02-05 21:16:44 +010017#include <linux/proc_fs.h>
18#include <linux/profile.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Yinghai Lu85c0f902008-08-19 20:49:47 -070020int nr_irqs = NR_IRQS;
Ingo Molnarc59d85a2008-08-28 08:56:33 +020021EXPORT_SYMBOL(nr_irqs);
Yinghai Lu85c0f902008-08-19 20:49:47 -070022
Linus Torvalds1da177e2005-04-16 15:20:36 -070023/*
24 * show_interrupts is needed by /proc/interrupts.
25 */
26int show_interrupts(struct seq_file *p, void *v)
27{
28 static const char *intrclass_names[] = { "EXT", "I/O", };
29 int i = *(loff_t *) v, j;
30
Heiko Carstens8dd79cb2008-05-15 16:52:39 +020031 get_online_cpus();
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 if (i == 0) {
33 seq_puts(p, " ");
34 for_each_online_cpu(j)
35 seq_printf(p, "CPU%d ",j);
36 seq_putc(p, '\n');
37 }
38
39 if (i < NR_IRQS) {
40 seq_printf(p, "%s: ", intrclass_names[i]);
41#ifndef CONFIG_SMP
42 seq_printf(p, "%10u ", kstat_irqs(i));
43#else
44 for_each_online_cpu(j)
45 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
46#endif
47 seq_putc(p, '\n');
48
49 }
Heiko Carstens8dd79cb2008-05-15 16:52:39 +020050 put_online_cpus();
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 return 0;
52}
53
54/*
55 * For compatibilty only. S/390 specific setup of interrupts et al. is done
56 * much later in init_channel_subsystem().
57 */
58void __init
59init_IRQ(void)
60{
61 /* nothing... */
62}
63
64/*
65 * Switch to the asynchronous interrupt stack for softirq execution.
66 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070067asmlinkage void do_softirq(void)
68{
69 unsigned long flags, old, new;
70
71 if (in_interrupt())
72 return;
73
74 local_irq_save(flags);
75
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 if (local_softirq_pending()) {
77 /* Get current stack pointer. */
78 asm volatile("la %0,0(15)" : "=a" (old));
79 /* Check against async. stack address range. */
80 new = S390_lowcore.async_stack;
81 if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) {
82 /* Need to switch to the async. stack. */
83 new -= STACK_FRAME_OVERHEAD;
84 ((struct stack_frame *) new)->back_chain = old;
85
86 asm volatile(" la 15,0(%0)\n"
87 " basr 14,%2\n"
88 " la 15,0(%1)\n"
89 : : "a" (new), "a" (old),
90 "a" (__do_softirq)
91 : "0", "1", "2", "3", "4", "5", "14",
92 "cc", "memory" );
93 } else
94 /* We are already on the async stack. */
95 __do_softirq();
96 }
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 local_irq_restore(flags);
99}
Heiko Carstens55dff522007-02-05 21:16:44 +0100100
101void init_irq_proc(void)
102{
103 struct proc_dir_entry *root_irq_dir;
104
105 root_irq_dir = proc_mkdir("irq", NULL);
106 create_prof_cpu_mask(root_irq_dir);
107}