Merge tag 'drm-vc4-fixes-2016-09-14' of https://github.com/anholt/linux into drm...
[linux-2.6-block.git] / arch / x86 / kernel / irq.c
CommitLineData
6b39ba77
TG
1/*
2 * Common interrupt code for 32 and 64 bit
3 */
4#include <linux/cpu.h>
5#include <linux/interrupt.h>
6#include <linux/kernel_stat.h>
4722d194 7#include <linux/of.h>
6b39ba77 8#include <linux/seq_file.h>
6a02e710 9#include <linux/smp.h>
7c1d7cdc 10#include <linux/ftrace.h>
ca444564 11#include <linux/delay.h>
69c60c88 12#include <linux/export.h>
6b39ba77 13
7b6aa335 14#include <asm/apic.h>
6b39ba77 15#include <asm/io_apic.h>
c3d80000 16#include <asm/irq.h>
7c1d7cdc 17#include <asm/idle.h>
01ca79f1 18#include <asm/mce.h>
2c1b284e 19#include <asm/hw_irq.h>
ac2a5539 20#include <asm/desc.h>
83ab8514
SRRH
21
22#define CREATE_TRACE_POINTS
cf910e83 23#include <asm/trace/irq_vectors.h>
6b39ba77 24
c5bde906
BG
25DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
26EXPORT_PER_CPU_SYMBOL(irq_stat);
27
28DEFINE_PER_CPU(struct pt_regs *, irq_regs);
29EXPORT_PER_CPU_SYMBOL(irq_regs);
30
6b39ba77
TG
31atomic_t irq_err_count;
32
acaabe79 33/* Function pointer for generic interrupt vector handling */
4a4de9c7 34void (*x86_platform_ipi_callback)(void) = NULL;
acaabe79 35
249f6d9e
TG
36/*
37 * 'what should we do if we get a hw irq event on an illegal vector'.
38 * each architecture has to answer this themselves.
39 */
40void ack_bad_irq(unsigned int irq)
41{
edea7148
CG
42 if (printk_ratelimit())
43 pr_err("unexpected IRQ trap at vector %02x\n", irq);
249f6d9e 44
249f6d9e
TG
45 /*
46 * Currently unexpected vectors happen only on SMP and APIC.
47 * We _must_ ack these because every local APIC has only N
48 * irq slots per priority level, and a 'hanging, unacked' IRQ
49 * holds up an irq slot - in excessive cases (when multiple
50 * unexpected vectors occur) that might lock up the APIC
51 * completely.
52 * But only ack when the APIC is enabled -AK
53 */
08306ce6 54 ack_APIC_irq();
249f6d9e
TG
55}
56
1b437c8c 57#define irq_stats(x) (&per_cpu(irq_stat, x))
6b39ba77 58/*
517e4981 59 * /proc/interrupts printing for arch specific interrupts
6b39ba77 60 */
517e4981 61int arch_show_interrupts(struct seq_file *p, int prec)
6b39ba77
TG
62{
63 int j;
64
7a81d9a7 65 seq_printf(p, "%*s: ", prec, "NMI");
6b39ba77
TG
66 for_each_online_cpu(j)
67 seq_printf(p, "%10u ", irq_stats(j)->__nmi_count);
3736708f 68 seq_puts(p, " Non-maskable interrupts\n");
6b39ba77 69#ifdef CONFIG_X86_LOCAL_APIC
7a81d9a7 70 seq_printf(p, "%*s: ", prec, "LOC");
6b39ba77
TG
71 for_each_online_cpu(j)
72 seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs);
3736708f 73 seq_puts(p, " Local timer interrupts\n");
474e56b8
JSR
74
75 seq_printf(p, "%*s: ", prec, "SPU");
76 for_each_online_cpu(j)
77 seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count);
3736708f 78 seq_puts(p, " Spurious interrupts\n");
89ccf465 79 seq_printf(p, "%*s: ", prec, "PMI");
241771ef
IM
80 for_each_online_cpu(j)
81 seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs);
3736708f 82 seq_puts(p, " Performance monitoring interrupts\n");
e360adbe 83 seq_printf(p, "%*s: ", prec, "IWI");
b6276f35 84 for_each_online_cpu(j)
e360adbe 85 seq_printf(p, "%10u ", irq_stats(j)->apic_irq_work_irqs);
3736708f 86 seq_puts(p, " IRQ work interrupts\n");
346b46be
FLVC
87 seq_printf(p, "%*s: ", prec, "RTR");
88 for_each_online_cpu(j)
b49d7d87 89 seq_printf(p, "%10u ", irq_stats(j)->icr_read_retry_count);
3736708f 90 seq_puts(p, " APIC ICR read retries\n");
6b39ba77 91#endif
4a4de9c7 92 if (x86_platform_ipi_callback) {
59d13812 93 seq_printf(p, "%*s: ", prec, "PLT");
acaabe79 94 for_each_online_cpu(j)
4a4de9c7 95 seq_printf(p, "%10u ", irq_stats(j)->x86_platform_ipis);
3736708f 96 seq_puts(p, " Platform interrupts\n");
acaabe79 97 }
6b39ba77 98#ifdef CONFIG_SMP
7a81d9a7 99 seq_printf(p, "%*s: ", prec, "RES");
6b39ba77
TG
100 for_each_online_cpu(j)
101 seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
3736708f 102 seq_puts(p, " Rescheduling interrupts\n");
7a81d9a7 103 seq_printf(p, "%*s: ", prec, "CAL");
6b39ba77 104 for_each_online_cpu(j)
82ba4fac 105 seq_printf(p, "%10u ", irq_stats(j)->irq_call_count);
3736708f 106 seq_puts(p, " Function call interrupts\n");
7a81d9a7 107 seq_printf(p, "%*s: ", prec, "TLB");
6b39ba77
TG
108 for_each_online_cpu(j)
109 seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count);
3736708f 110 seq_puts(p, " TLB shootdowns\n");
6b39ba77 111#endif
0444c9bd 112#ifdef CONFIG_X86_THERMAL_VECTOR
7a81d9a7 113 seq_printf(p, "%*s: ", prec, "TRM");
6b39ba77
TG
114 for_each_online_cpu(j)
115 seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count);
3736708f 116 seq_puts(p, " Thermal event interrupts\n");
0444c9bd
JB
117#endif
118#ifdef CONFIG_X86_MCE_THRESHOLD
7a81d9a7 119 seq_printf(p, "%*s: ", prec, "THR");
6b39ba77
TG
120 for_each_online_cpu(j)
121 seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count);
3736708f 122 seq_puts(p, " Threshold APIC interrupts\n");
01ca79f1 123#endif
24fd78a8
AG
124#ifdef CONFIG_X86_MCE_AMD
125 seq_printf(p, "%*s: ", prec, "DFR");
126 for_each_online_cpu(j)
127 seq_printf(p, "%10u ", irq_stats(j)->irq_deferred_error_count);
128 seq_puts(p, " Deferred Error APIC interrupts\n");
129#endif
c1ebf835 130#ifdef CONFIG_X86_MCE
01ca79f1
AK
131 seq_printf(p, "%*s: ", prec, "MCE");
132 for_each_online_cpu(j)
133 seq_printf(p, "%10u ", per_cpu(mce_exception_count, j));
3736708f 134 seq_puts(p, " Machine check exceptions\n");
ca84f696
AK
135 seq_printf(p, "%*s: ", prec, "MCP");
136 for_each_online_cpu(j)
137 seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
3736708f 138 seq_puts(p, " Machine check polls\n");
6b39ba77 139#endif
f704a7d7 140#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
9d87cd61
VK
141 if (test_bit(HYPERVISOR_CALLBACK_VECTOR, used_vectors)) {
142 seq_printf(p, "%*s: ", prec, "HYP");
143 for_each_online_cpu(j)
144 seq_printf(p, "%10u ",
145 irq_stats(j)->irq_hv_callback_count);
146 seq_puts(p, " Hypervisor callback interrupts\n");
147 }
929320e4 148#endif
7a81d9a7 149 seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
6b39ba77 150#if defined(CONFIG_X86_IO_APIC)
7a81d9a7 151 seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
501b3265
FW
152#endif
153#ifdef CONFIG_HAVE_KVM
154 seq_printf(p, "%*s: ", prec, "PIN");
155 for_each_online_cpu(j)
156 seq_printf(p, "%10u ", irq_stats(j)->kvm_posted_intr_ipis);
157 seq_puts(p, " Posted-interrupt notification event\n");
158
159 seq_printf(p, "%*s: ", prec, "PIW");
160 for_each_online_cpu(j)
161 seq_printf(p, "%10u ",
162 irq_stats(j)->kvm_posted_intr_wakeup_ipis);
163 seq_puts(p, " Posted-interrupt wakeup event\n");
6b39ba77
TG
164#endif
165 return 0;
166}
167
6b39ba77
TG
168/*
169 * /proc/stat helpers
170 */
171u64 arch_irq_stat_cpu(unsigned int cpu)
172{
173 u64 sum = irq_stats(cpu)->__nmi_count;
174
175#ifdef CONFIG_X86_LOCAL_APIC
176 sum += irq_stats(cpu)->apic_timer_irqs;
474e56b8 177 sum += irq_stats(cpu)->irq_spurious_count;
241771ef 178 sum += irq_stats(cpu)->apic_perf_irqs;
e360adbe 179 sum += irq_stats(cpu)->apic_irq_work_irqs;
b49d7d87 180 sum += irq_stats(cpu)->icr_read_retry_count;
6b39ba77 181#endif
4a4de9c7
DS
182 if (x86_platform_ipi_callback)
183 sum += irq_stats(cpu)->x86_platform_ipis;
6b39ba77
TG
184#ifdef CONFIG_SMP
185 sum += irq_stats(cpu)->irq_resched_count;
186 sum += irq_stats(cpu)->irq_call_count;
6b39ba77 187#endif
0444c9bd 188#ifdef CONFIG_X86_THERMAL_VECTOR
6b39ba77 189 sum += irq_stats(cpu)->irq_thermal_count;
0444c9bd
JB
190#endif
191#ifdef CONFIG_X86_MCE_THRESHOLD
6b39ba77 192 sum += irq_stats(cpu)->irq_threshold_count;
8051dbd2 193#endif
c1ebf835 194#ifdef CONFIG_X86_MCE
8051dbd2
HS
195 sum += per_cpu(mce_exception_count, cpu);
196 sum += per_cpu(mce_poll_count, cpu);
6b39ba77
TG
197#endif
198 return sum;
199}
200
201u64 arch_irq_stat(void)
202{
203 u64 sum = atomic_read(&irq_err_count);
6b39ba77
TG
204 return sum;
205}
c3d80000 206
7c1d7cdc
JF
207
208/*
209 * do_IRQ handles all normal device IRQ's (the special
210 * SMP cross-CPU interrupts have their own specific
211 * handlers).
212 */
1d9090e2 213__visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
7c1d7cdc
JF
214{
215 struct pt_regs *old_regs = set_irq_regs(regs);
a782a7e4 216 struct irq_desc * desc;
7c1d7cdc
JF
217 /* high bit used in ret_from_ code */
218 unsigned vector = ~regs->orig_ax;
7c1d7cdc 219
0333a209
AL
220 /*
221 * NB: Unlike exception entries, IRQ entries do not reliably
222 * handle context tracking in the low-level entry code. This is
223 * because syscall entries execute briefly with IRQs on before
224 * updating context tracking state, so we can take an IRQ from
225 * kernel mode with CONTEXT_USER. The low-level entry code only
226 * updates the context if we came from user mode, so we won't
227 * switch to CONTEXT_KERNEL. We'll fix that once the syscall
228 * code is cleaned up enough that we can cleanly defer enabling
229 * IRQs.
230 */
231
6af7faf6 232 entering_irq();
7c1d7cdc 233
0333a209 234 /* entering_irq() tells RCU that we're not quiescent. Check it. */
5778077d 235 RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU");
0333a209 236
a782a7e4 237 desc = __this_cpu_read(vector_irq[vector]);
7c1d7cdc 238
a782a7e4 239 if (!handle_irq(desc, regs)) {
08306ce6 240 ack_APIC_irq();
7c1d7cdc 241
a782a7e4
TG
242 if (desc != VECTOR_RETRIGGERED) {
243 pr_emerg_ratelimited("%s: %d.%d No irq handler for vector\n",
9345005f 244 __func__, smp_processor_id(),
a782a7e4 245 vector);
9345005f 246 } else {
7276c6a2 247 __this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
9345005f 248 }
7c1d7cdc
JF
249 }
250
6af7faf6 251 exiting_irq();
7c1d7cdc
JF
252
253 set_irq_regs(old_regs);
254 return 1;
255}
256
acaabe79 257/*
4a4de9c7 258 * Handler for X86_PLATFORM_IPI_VECTOR.
acaabe79 259 */
eddc0e92 260void __smp_x86_platform_ipi(void)
acaabe79 261{
4a4de9c7 262 inc_irq_stat(x86_platform_ipis);
acaabe79 263
4a4de9c7
DS
264 if (x86_platform_ipi_callback)
265 x86_platform_ipi_callback();
eddc0e92 266}
acaabe79 267
1d9090e2 268__visible void smp_x86_platform_ipi(struct pt_regs *regs)
eddc0e92
SA
269{
270 struct pt_regs *old_regs = set_irq_regs(regs);
acaabe79 271
eddc0e92
SA
272 entering_ack_irq();
273 __smp_x86_platform_ipi();
274 exiting_irq();
acaabe79
DS
275 set_irq_regs(old_regs);
276}
277
d78f2664 278#ifdef CONFIG_HAVE_KVM
f6b3c72c
FW
279static void dummy_handler(void) {}
280static void (*kvm_posted_intr_wakeup_handler)(void) = dummy_handler;
281
282void kvm_set_posted_intr_wakeup_handler(void (*handler)(void))
283{
284 if (handler)
285 kvm_posted_intr_wakeup_handler = handler;
286 else
287 kvm_posted_intr_wakeup_handler = dummy_handler;
288}
289EXPORT_SYMBOL_GPL(kvm_set_posted_intr_wakeup_handler);
290
d78f2664
YZ
291/*
292 * Handler for POSTED_INTERRUPT_VECTOR.
293 */
1d9090e2 294__visible void smp_kvm_posted_intr_ipi(struct pt_regs *regs)
d78f2664
YZ
295{
296 struct pt_regs *old_regs = set_irq_regs(regs);
297
6af7faf6 298 entering_ack_irq();
d78f2664 299 inc_irq_stat(kvm_posted_intr_ipis);
f6b3c72c
FW
300 exiting_irq();
301 set_irq_regs(old_regs);
302}
303
304/*
305 * Handler for POSTED_INTERRUPT_WAKEUP_VECTOR.
306 */
307__visible void smp_kvm_posted_intr_wakeup_ipi(struct pt_regs *regs)
308{
309 struct pt_regs *old_regs = set_irq_regs(regs);
310
311 entering_ack_irq();
312 inc_irq_stat(kvm_posted_intr_wakeup_ipis);
313 kvm_posted_intr_wakeup_handler();
6af7faf6 314 exiting_irq();
d78f2664
YZ
315 set_irq_regs(old_regs);
316}
317#endif
318
1d9090e2 319__visible void smp_trace_x86_platform_ipi(struct pt_regs *regs)
cf910e83
SA
320{
321 struct pt_regs *old_regs = set_irq_regs(regs);
322
323 entering_ack_irq();
324 trace_x86_platform_ipi_entry(X86_PLATFORM_IPI_VECTOR);
325 __smp_x86_platform_ipi();
326 trace_x86_platform_ipi_exit(X86_PLATFORM_IPI_VECTOR);
327 exiting_irq();
328 set_irq_regs(old_regs);
329}
330
c3d80000 331EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
7a7732bc
SS
332
333#ifdef CONFIG_HOTPLUG_CPU
39424e89
PB
334
335/* These two declarations are only used in check_irq_vectors_for_cpu_disable()
336 * below, which is protected by stop_machine(). Putting them on the stack
337 * results in a stack frame overflow. Dynamically allocating could result in a
338 * failure so declare these two cpumasks as global.
339 */
340static struct cpumask affinity_new, online_new;
341
da6139e4
PB
342/*
343 * This cpu is going to be removed and its vectors migrated to the remaining
344 * online cpus. Check to see if there are enough vectors in the remaining cpus.
345 * This function is protected by stop_machine().
346 */
347int check_irq_vectors_for_cpu_disable(void)
348{
da6139e4
PB
349 unsigned int this_cpu, vector, this_count, count;
350 struct irq_desc *desc;
351 struct irq_data *data;
a782a7e4 352 int cpu;
da6139e4
PB
353
354 this_cpu = smp_processor_id();
355 cpumask_copy(&online_new, cpu_online_mask);
020b37ac 356 cpumask_clear_cpu(this_cpu, &online_new);
da6139e4
PB
357
358 this_count = 0;
359 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
a782a7e4
TG
360 desc = __this_cpu_read(vector_irq[vector]);
361 if (IS_ERR_OR_NULL(desc))
44825757 362 continue;
44825757
TG
363 /*
364 * Protect against concurrent action removal, affinity
365 * changes etc.
366 */
367 raw_spin_lock(&desc->lock);
368 data = irq_desc_get_irq_data(desc);
a782a7e4
TG
369 cpumask_copy(&affinity_new,
370 irq_data_get_affinity_mask(data));
44825757 371 cpumask_clear_cpu(this_cpu, &affinity_new);
da6139e4 372
44825757 373 /* Do not count inactive or per-cpu irqs. */
a782a7e4 374 if (!irq_desc_has_action(desc) || irqd_is_per_cpu(data)) {
cbb24dc7 375 raw_spin_unlock(&desc->lock);
44825757 376 continue;
da6139e4 377 }
44825757
TG
378
379 raw_spin_unlock(&desc->lock);
380 /*
381 * A single irq may be mapped to multiple cpu's
382 * vector_irq[] (for example IOAPIC cluster mode). In
383 * this case we have two possibilities:
384 *
385 * 1) the resulting affinity mask is empty; that is
386 * this the down'd cpu is the last cpu in the irq's
387 * affinity mask, or
388 *
389 * 2) the resulting affinity mask is no longer a
390 * subset of the online cpus but the affinity mask is
391 * not zero; that is the down'd cpu is the last online
392 * cpu in a user set affinity mask.
393 */
394 if (cpumask_empty(&affinity_new) ||
395 !cpumask_subset(&affinity_new, &online_new))
396 this_count++;
da6139e4
PB
397 }
398
399 count = 0;
400 for_each_online_cpu(cpu) {
401 if (cpu == this_cpu)
402 continue;
ac2a5539
YL
403 /*
404 * We scan from FIRST_EXTERNAL_VECTOR to first system
405 * vector. If the vector is marked in the used vectors
406 * bitmap or an irq is assigned to it, we don't count
407 * it as available.
cbb24dc7
TG
408 *
409 * As this is an inaccurate snapshot anyway, we can do
410 * this w/o holding vector_lock.
ac2a5539
YL
411 */
412 for (vector = FIRST_EXTERNAL_VECTOR;
413 vector < first_system_vector; vector++) {
414 if (!test_bit(vector, used_vectors) &&
a782a7e4
TG
415 IS_ERR_OR_NULL(per_cpu(vector_irq, cpu)[vector]))
416 count++;
da6139e4
PB
417 }
418 }
419
420 if (count < this_count) {
421 pr_warn("CPU %d disable failed: CPU has %u vectors assigned and there are only %u available.\n",
422 this_cpu, this_count, count);
423 return -ERANGE;
424 }
425 return 0;
426}
427
7a7732bc
SS
428/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
429void fixup_irqs(void)
430{
5231a686 431 unsigned int irq, vector;
7a7732bc
SS
432 static int warned;
433 struct irq_desc *desc;
a3c08e5d 434 struct irq_data *data;
51c43ac6 435 struct irq_chip *chip;
fb24da80 436 int ret;
7a7732bc
SS
437
438 for_each_irq_desc(irq, desc) {
439 int break_affinity = 0;
440 int set_affinity = 1;
441 const struct cpumask *affinity;
442
443 if (!desc)
444 continue;
445 if (irq == 2)
446 continue;
447
448 /* interrupt's are disabled at this point */
239007b8 449 raw_spin_lock(&desc->lock);
7a7732bc 450
51c43ac6 451 data = irq_desc_get_irq_data(desc);
c149e4cd 452 affinity = irq_data_get_affinity_mask(data);
b87ba87c 453 if (!irq_has_action(irq) || irqd_is_per_cpu(data) ||
58bff947 454 cpumask_subset(affinity, cpu_online_mask)) {
239007b8 455 raw_spin_unlock(&desc->lock);
7a7732bc
SS
456 continue;
457 }
458
a5e74b84
SS
459 /*
460 * Complete the irq move. This cpu is going down and for
461 * non intr-remapping case, we can't wait till this interrupt
462 * arrives at this cpu before completing the irq move.
463 */
90a2282e 464 irq_force_complete_move(desc);
a5e74b84 465
7a7732bc
SS
466 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
467 break_affinity = 1;
2530cd4f 468 affinity = cpu_online_mask;
7a7732bc
SS
469 }
470
51c43ac6 471 chip = irq_data_get_irq_chip(data);
36f34c8c
TG
472 /*
473 * The interrupt descriptor might have been cleaned up
474 * already, but it is not yet removed from the radix tree
475 */
476 if (!chip) {
477 raw_spin_unlock(&desc->lock);
478 continue;
479 }
480
51c43ac6
TG
481 if (!irqd_can_move_in_process_context(data) && chip->irq_mask)
482 chip->irq_mask(data);
7a7732bc 483
fb24da80
PB
484 if (chip->irq_set_affinity) {
485 ret = chip->irq_set_affinity(data, affinity, true);
486 if (ret == -ENOSPC)
487 pr_crit("IRQ %d set affinity failed because there are no available vectors. The device assigned to this IRQ is unstable.\n", irq);
488 } else {
489 if (!(warned++))
490 set_affinity = 0;
491 }
7a7732bc 492
99dd5497
LC
493 /*
494 * We unmask if the irq was not marked masked by the
495 * core code. That respects the lazy irq disable
496 * behaviour.
497 */
983bbf1a 498 if (!irqd_can_move_in_process_context(data) &&
99dd5497 499 !irqd_irq_masked(data) && chip->irq_unmask)
51c43ac6 500 chip->irq_unmask(data);
7a7732bc 501
239007b8 502 raw_spin_unlock(&desc->lock);
7a7732bc
SS
503
504 if (break_affinity && set_affinity)
c767a54b 505 pr_notice("Broke affinity for irq %i\n", irq);
7a7732bc 506 else if (!set_affinity)
c767a54b 507 pr_notice("Cannot set affinity for irq %i\n", irq);
7a7732bc
SS
508 }
509
5231a686
SS
510 /*
511 * We can remove mdelay() and then send spuriuous interrupts to
512 * new cpu targets for all the irqs that were handled previously by
513 * this cpu. While it works, I have seen spurious interrupt messages
514 * (nothing wrong but still...).
515 *
516 * So for now, retain mdelay(1) and check the IRR and then send those
517 * interrupts to new targets as this cpu is already offlined...
518 */
7a7732bc 519 mdelay(1);
5231a686 520
09cf92b7
TG
521 /*
522 * We can walk the vector array of this cpu without holding
523 * vector_lock because the cpu is already marked !online, so
524 * nothing else will touch it.
525 */
5231a686
SS
526 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
527 unsigned int irr;
528
a782a7e4 529 if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
5231a686
SS
530 continue;
531
532 irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
533 if (irr & (1 << (vector % 32))) {
a782a7e4 534 desc = __this_cpu_read(vector_irq[vector]);
5231a686 535
09cf92b7 536 raw_spin_lock(&desc->lock);
51c43ac6
TG
537 data = irq_desc_get_irq_data(desc);
538 chip = irq_data_get_irq_chip(data);
9345005f 539 if (chip->irq_retrigger) {
51c43ac6 540 chip->irq_retrigger(data);
9345005f
PB
541 __this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
542 }
239007b8 543 raw_spin_unlock(&desc->lock);
5231a686 544 }
9345005f 545 if (__this_cpu_read(vector_irq[vector]) != VECTOR_RETRIGGERED)
7276c6a2 546 __this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
5231a686 547 }
7a7732bc
SS
548}
549#endif