1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include <asm/delay.h>
21#include <linux/uaccess.h>
22#include <linux/module.h>
23#include <linux/seq_file.h>
24#include <linux/interrupt.h>
25#include <linux/kernel_stat.h>
26
27#include <asm/mca.h>
28
29
30
31
32
33void ack_bad_irq(unsigned int irq)
34{
35 printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", irq, smp_processor_id());
36}
37
38#ifdef CONFIG_IA64_GENERIC
39ia64_vector __ia64_irq_to_vector(int irq)
40{
41 return irq_cfg[irq].vector;
42}
43
44unsigned int __ia64_local_vector_to_irq (ia64_vector vec)
45{
46 return __this_cpu_read(vector_irq[vec]);
47}
48#endif
49
50
51
52
53
54atomic_t irq_err_count;
55
56
57
58
59int arch_show_interrupts(struct seq_file *p, int prec)
60{
61 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
62 return 0;
63}
64
65#ifdef CONFIG_SMP
66static char irq_redir [NR_IRQS];
67
68void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
69{
70 if (irq < NR_IRQS) {
71 cpumask_copy(irq_get_affinity_mask(irq),
72 cpumask_of(cpu_logical_id(hwid)));
73 irq_redir[irq] = (char) (redir & 0xff);
74 }
75}
76
77bool is_affinity_mask_valid(const struct cpumask *cpumask)
78{
79 if (ia64_platform_is("sn2")) {
80
81 if (cpumask_weight(cpumask) != 1)
82 return false;
83 }
84 return true;
85}
86
87#endif
88
89int __init arch_early_irq_init(void)
90{
91 ia64_mca_irq_init();
92 return 0;
93}
94
95#ifdef CONFIG_HOTPLUG_CPU
96unsigned int vectors_in_migration[NR_IRQS];
97
98
99
100
101
102static void migrate_irqs(void)
103{
104 int irq, new_cpu;
105
106 for (irq=0; irq < NR_IRQS; irq++) {
107 struct irq_desc *desc = irq_to_desc(irq);
108 struct irq_data *data = irq_desc_get_irq_data(desc);
109 struct irq_chip *chip = irq_data_get_irq_chip(data);
110
111 if (irqd_irq_disabled(data))
112 continue;
113
114
115
116
117
118
119
120 if (irqd_is_per_cpu(data))
121 continue;
122
123 if (cpumask_any_and(irq_data_get_affinity_mask(data),
124 cpu_online_mask) >= nr_cpu_ids) {
125
126
127
128 vectors_in_migration[irq] = irq;
129
130 new_cpu = cpumask_any(cpu_online_mask);
131
132
133
134
135 if (chip && chip->irq_disable &&
136 chip->irq_enable && chip->irq_set_affinity) {
137 chip->irq_disable(data);
138 chip->irq_set_affinity(data,
139 cpumask_of(new_cpu), false);
140 chip->irq_enable(data);
141 } else {
142 WARN_ON((!chip || !chip->irq_disable ||
143 !chip->irq_enable ||
144 !chip->irq_set_affinity));
145 }
146 }
147 }
148}
149
150void fixup_irqs(void)
151{
152 unsigned int irq;
153 extern void ia64_process_pending_intr(void);
154 extern volatile int time_keeper_id;
155
156
157 ia64_set_itv(1 << 16);
158
159
160
161
162 if (smp_processor_id() == time_keeper_id) {
163 time_keeper_id = cpumask_first(cpu_online_mask);
164 printk ("CPU %d is now promoted to time-keeper master\n", time_keeper_id);
165 }
166
167
168
169
170
171 migrate_irqs();
172
173
174
175
176
177 ia64_process_pending_intr();
178
179
180
181
182
183
184 for (irq=0; irq < NR_IRQS; irq++) {
185 if (vectors_in_migration[irq]) {
186 struct pt_regs *old_regs = set_irq_regs(NULL);
187
188 vectors_in_migration[irq]=0;
189 generic_handle_irq(irq);
190 set_irq_regs(old_regs);
191 }
192 }
193
194
195
196
197
198
199
200 max_xtp();
201 local_irq_disable();
202}
203#endif
204