Lines Matching +full:irq +full:- +full:can +full:- +full:wake
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
4 * Copyright (C) 2005-2006, Thomas Gleixner, Russell King
7 * information is available in Documentation/core-api/genericirq.rst
11 #include <linux/irq.h>
19 #include <trace/events/irq.h>
28 * handle_bad_irq - handle spurious and unhandled irqs
31 * Handles spurious and unhandled IRQ's. It also prints a debugmessage.
35 unsigned int irq = irq_desc_get_irq(desc); in handle_bad_irq() local
37 print_irq_desc(irq, desc); in handle_bad_irq()
39 ack_bad_irq(irq); in handle_bad_irq()
44 * Special, empty irq handler:
52 static void warn_no_thread(unsigned int irq, struct irqaction *action) in warn_no_thread() argument
54 if (test_and_set_bit(IRQTF_WARNED, &action->thread_flags)) in warn_no_thread()
57 printk(KERN_WARNING "IRQ %d device %s returned IRQ_WAKE_THREAD " in warn_no_thread()
58 "but no thread function available.", irq, action->name); in warn_no_thread()
66 * device interrupt, so no irq storm is lurking. in __irq_wake_thread()
68 if (action->thread->flags & PF_EXITING) in __irq_wake_thread()
72 * Wake up the handler thread for this action. If the in __irq_wake_thread()
75 if (test_and_set_bit(IRQTF_RUNTHREAD, &action->thread_flags)) in __irq_wake_thread()
81 * irq thread. in __irq_wake_thread()
83 * This code is the hard irq context and can never run on two in __irq_wake_thread()
87 * The irq threads of this irq which clear their "running" bit in __irq_wake_thread()
88 * in threads_oneshot are serialized via desc->lock against in __irq_wake_thread()
92 * Hard irq handler: in __irq_wake_thread()
94 * spin_lock(desc->lock); in __irq_wake_thread()
95 * desc->state |= IRQS_INPROGRESS; in __irq_wake_thread()
96 * spin_unlock(desc->lock); in __irq_wake_thread()
97 * set_bit(IRQTF_RUNTHREAD, &action->thread_flags); in __irq_wake_thread()
98 * desc->threads_oneshot |= mask; in __irq_wake_thread()
99 * spin_lock(desc->lock); in __irq_wake_thread()
100 * desc->state &= ~IRQS_INPROGRESS; in __irq_wake_thread()
101 * spin_unlock(desc->lock); in __irq_wake_thread()
103 * irq thread: in __irq_wake_thread()
106 * spin_lock(desc->lock); in __irq_wake_thread()
107 * if (desc->state & IRQS_INPROGRESS) { in __irq_wake_thread()
108 * spin_unlock(desc->lock); in __irq_wake_thread()
109 * while(desc->state & IRQS_INPROGRESS) in __irq_wake_thread()
113 * if (!test_bit(IRQTF_RUNTHREAD, &action->thread_flags)) in __irq_wake_thread()
114 * desc->threads_oneshot &= ~mask; in __irq_wake_thread()
115 * spin_unlock(desc->lock); in __irq_wake_thread()
118 * or we are waiting in the flow handler for desc->lock to be in __irq_wake_thread()
120 * IRQTF_RUNTHREAD under desc->lock. If set it leaves in __irq_wake_thread()
123 desc->threads_oneshot |= action->thread_mask; in __irq_wake_thread()
126 * We increment the threads_active counter in case we wake up in __irq_wake_thread()
127 * the irq thread. The irq thread decrements the counter when in __irq_wake_thread()
131 * against this code (hard irq handler) via IRQS_INPROGRESS in __irq_wake_thread()
134 atomic_inc(&desc->threads_active); in __irq_wake_thread()
136 wake_up_process(action->thread); in __irq_wake_thread()
142 unsigned int irq = desc->irq_data.irq; in __handle_irq_event_percpu() local
151 * If this IRQ would be threaded under force_irqthreads, mark it so. in __handle_irq_event_percpu()
154 !(action->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))) in __handle_irq_event_percpu()
157 trace_irq_handler_entry(irq, action); in __handle_irq_event_percpu()
158 res = action->handler(irq, action->dev_id); in __handle_irq_event_percpu()
159 trace_irq_handler_exit(irq, action, res); in __handle_irq_event_percpu()
161 if (WARN_ONCE(!irqs_disabled(),"irq %u handler %pS enabled interrupts\n", in __handle_irq_event_percpu()
162 irq, action->handler)) in __handle_irq_event_percpu()
171 if (unlikely(!action->thread_fn)) { in __handle_irq_event_percpu()
172 warn_no_thread(irq, action); in __handle_irq_event_percpu()
195 add_interrupt_randomness(desc->irq_data.irq); in handle_irq_event_percpu()
206 desc->istate &= ~IRQS_PENDING; in handle_irq_event()
207 irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS); in handle_irq_event()
208 raw_spin_unlock(&desc->lock); in handle_irq_event()
212 raw_spin_lock(&desc->lock); in handle_irq_event()
213 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS); in handle_irq_event()
221 return -EBUSY; in set_handle_irq()
228 * generic_handle_arch_irq - root irq handler for architectures which do no
230 * @regs: Register file coming from the low-level handling code