xref: /openbmc/linux/arch/x86/kernel/irq_work.c (revision 174cd4b1)
1 /*
2  * x86 specific code for irq_work
3  *
4  * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra
5  */
6 
7 #include <linux/kernel.h>
8 #include <linux/irq_work.h>
9 #include <linux/hardirq.h>
10 #include <asm/apic.h>
11 #include <asm/trace/irq_vectors.h>
12 #include <linux/interrupt.h>
13 
14 static inline void __smp_irq_work_interrupt(void)
15 {
16 	inc_irq_stat(apic_irq_work_irqs);
17 	irq_work_run();
18 }
19 
20 __visible void __irq_entry smp_irq_work_interrupt(struct pt_regs *regs)
21 {
22 	ipi_entering_ack_irq();
23 	__smp_irq_work_interrupt();
24 	exiting_irq();
25 }
26 
27 __visible void __irq_entry smp_trace_irq_work_interrupt(struct pt_regs *regs)
28 {
29 	ipi_entering_ack_irq();
30 	trace_irq_work_entry(IRQ_WORK_VECTOR);
31 	__smp_irq_work_interrupt();
32 	trace_irq_work_exit(IRQ_WORK_VECTOR);
33 	exiting_irq();
34 }
35 
36 void arch_irq_work_raise(void)
37 {
38 #ifdef CONFIG_X86_LOCAL_APIC
39 	if (!arch_irq_work_has_interrupt())
40 		return;
41 
42 	apic->send_IPI_self(IRQ_WORK_VECTOR);
43 	apic_wait_icr_idle();
44 #endif
45 }
46