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