1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <linux/kernel_stat.h>
25#include <linux/irq.h>
26#include <linux/memory.h>
27#include <linux/smp.h>
28#include <linux/init.h>
29#include <linux/irqchip.h>
30#include <linux/seq_file.h>
31#include <linux/vmalloc.h>
32#include <asm/vmap_stack.h>
33
34unsigned long irq_err_count;
35
36DEFINE_PER_CPU(unsigned long *, irq_stack_ptr);
37
38int arch_show_interrupts(struct seq_file *p, int prec)
39{
40 show_ipi_list(p, prec);
41 seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count);
42 return 0;
43}
44
45void (*handle_arch_irq)(struct pt_regs *) = NULL;
46
47void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
48{
49 if (handle_arch_irq)
50 return;
51
52 handle_arch_irq = handle_irq;
53}
54
55#ifdef CONFIG_VMAP_STACK
56static void init_irq_stacks(void)
57{
58 int cpu;
59 unsigned long *p;
60
61 for_each_possible_cpu(cpu) {
62 p = arch_alloc_vmap_stack(IRQ_STACK_SIZE, cpu_to_node(cpu));
63 per_cpu(irq_stack_ptr, cpu) = p;
64 }
65}
66#else
67
68DEFINE_PER_CPU_ALIGNED(unsigned long [IRQ_STACK_SIZE/sizeof(long)], irq_stack);
69
70static void init_irq_stacks(void)
71{
72 int cpu;
73
74 for_each_possible_cpu(cpu)
75 per_cpu(irq_stack_ptr, cpu) = per_cpu(irq_stack, cpu);
76}
77#endif
78
79void __init init_IRQ(void)
80{
81 init_irq_stacks();
82 irqchip_init();
83 if (!handle_arch_irq)
84 panic("No interrupt controller found.");
85}
86