blob: a2c48058354c871803eb9650db60acc0e7cb4b13 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * IRQ subsystem internal functions and variables:
Thomas Gleixnerdbec07b2011-02-07 20:19:55 +01003 *
4 * Do not ever include this file from anything else than
5 * kernel/irq/. Do not even think about using any information outside
6 * of this file for your non core code.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
Thomas Gleixnere1447102010-10-01 16:03:45 +02008#include <linux/irqdesc.h>
Thomas Gleixner8f945a32014-02-23 21:40:23 +00009#include <linux/kernel_stat.h>
Jon Hunterbe45beb2016-06-07 16:12:29 +010010#include <linux/pm_runtime.h>
Daniel Lezcanob2d3d612017-06-23 16:11:07 +020011#include <linux/sched/clock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Thomas Gleixnerc1ee6262011-02-17 17:45:15 +010013#ifdef CONFIG_SPARSE_IRQ
14# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
15#else
16# define IRQ_BITMAP_BITS NR_IRQS
17#endif
18
Thomas Gleixnerdbec07b2011-02-07 20:19:55 +010019#define istate core_internal_state__do_not_mess_with_it
20
Rusty Russell2329abf2012-01-13 09:32:18 +103021extern bool noirqdebug;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Mika Westerberge509bd72015-10-05 13:12:15 +030023extern struct irqaction chained_action;
24
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010025/*
26 * Bits used by threaded handlers:
27 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010028 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
29 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
Thomas Gleixner8d32a302011-02-23 23:52:23 +000030 * IRQTF_FORCED_THREAD - irq action is force threaded
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010031 */
32enum {
33 IRQTF_RUNTHREAD,
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010034 IRQTF_WARNED,
35 IRQTF_AFFINITY,
Thomas Gleixner8d32a302011-02-23 23:52:23 +000036 IRQTF_FORCED_THREAD,
Thomas Gleixner1535dfa2011-02-07 01:55:43 +010037};
38
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010039/*
Jiang Liua2579542014-05-27 16:07:37 +080040 * Bit masks for desc->core_internal_state__do_not_mess_with_it
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010041 *
42 * IRQS_AUTODETECT - autodetection in progress
Thomas Gleixner7acdd532011-02-07 20:40:54 +010043 * IRQS_SPURIOUS_DISABLED - was disabled due to spurious interrupt
44 * detection
Thomas Gleixner6954b752011-02-07 20:55:35 +010045 * IRQS_POLL_INPROGRESS - polling in progress
Thomas Gleixner3d67bae2011-02-07 21:02:10 +010046 * IRQS_ONESHOT - irq is not unmasked in primary handler
Thomas Gleixner163ef302011-02-08 11:39:15 +010047 * IRQS_REPLAY - irq is replayed
48 * IRQS_WAITING - irq is waiting
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +010049 * IRQS_PENDING - irq is pending and replayed later
Thomas Gleixnerc531e832011-02-08 12:44:58 +010050 * IRQS_SUSPENDED - irq is suspended
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010051 */
52enum {
53 IRQS_AUTODETECT = 0x00000001,
Thomas Gleixner7acdd532011-02-07 20:40:54 +010054 IRQS_SPURIOUS_DISABLED = 0x00000002,
Thomas Gleixner6954b752011-02-07 20:55:35 +010055 IRQS_POLL_INPROGRESS = 0x00000008,
Thomas Gleixner3d67bae2011-02-07 21:02:10 +010056 IRQS_ONESHOT = 0x00000020,
Thomas Gleixner163ef302011-02-08 11:39:15 +010057 IRQS_REPLAY = 0x00000040,
58 IRQS_WAITING = 0x00000080,
Thomas Gleixner2a0d6fb2011-02-08 12:17:57 +010059 IRQS_PENDING = 0x00000200,
Thomas Gleixnerc531e832011-02-08 12:44:58 +010060 IRQS_SUSPENDED = 0x00000800,
Daniel Lezcanob2d3d612017-06-23 16:11:07 +020061 IRQS_TIMINGS = 0x00001000,
Thomas Gleixnerbd062e72011-02-07 20:25:25 +010062};
63
Thomas Gleixner1ce60682011-02-09 20:44:21 +010064#include "debug.h"
65#include "settings.h"
66
Jiang Liua1ff5412015-06-23 19:47:29 +020067extern int __irq_set_trigger(struct irq_desc *desc, unsigned long flags);
Jiang Liu79ff1cd2015-06-23 19:52:36 +020068extern void __disable_irq(struct irq_desc *desc);
69extern void __enable_irq(struct irq_desc *desc);
David Brownell0c5d1eb2008-10-01 14:46:18 -070070
Thomas Gleixner4cde9c62017-06-20 01:37:49 +020071#define IRQ_RESEND true
72#define IRQ_NORESEND false
73
74#define IRQ_START_FORCE true
75#define IRQ_START_COND false
76
77extern int irq_startup(struct irq_desc *desc, bool resend, bool force);
78
Thomas Gleixner46999232011-02-02 21:41:14 +000079extern void irq_shutdown(struct irq_desc *desc);
Thomas Gleixner87923472011-02-03 12:27:44 +010080extern void irq_enable(struct irq_desc *desc);
81extern void irq_disable(struct irq_desc *desc);
Marc Zyngier31d9d9b2011-09-23 17:03:06 +010082extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
83extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
Thomas Gleixnerd4d5e082011-02-10 13:16:14 +010084extern void mask_irq(struct irq_desc *desc);
85extern void unmask_irq(struct irq_desc *desc);
Thomas Gleixner328a4972014-03-13 19:03:51 +010086extern void unmask_threaded_irq(struct irq_desc *desc);
Thomas Gleixner46999232011-02-02 21:41:14 +000087
Thomas Gleixnerf63b6a02014-05-07 15:44:21 +000088#ifdef CONFIG_SPARSE_IRQ
89static inline void irq_mark_irq(unsigned int irq) { }
90#else
91extern void irq_mark_irq(unsigned int irq);
92#endif
93
Yinghai Lu85ac16d2009-04-27 18:00:38 -070094extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
Mike Travis0fa0ebb2009-01-10 22:24:06 -080095
Keith Buschedd14cf2016-06-17 16:00:20 -060096irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags);
Huang Shijie71f64342015-09-02 10:24:55 +080097irqreturn_t handle_irq_event_percpu(struct irq_desc *desc);
Thomas Gleixner49126092011-02-07 01:08:49 +010098irqreturn_t handle_irq_event(struct irq_desc *desc);
99
Thomas Gleixnere1447102010-10-01 16:03:45 +0200100/* Resending of interrupts :*/
Jiang Liu0798abe2015-06-04 12:13:27 +0800101void check_irq_resend(struct irq_desc *desc);
Thomas Gleixnerfe200ae2011-02-07 10:34:30 +0100102bool irq_wait_for_poll(struct irq_desc *desc);
Thomas Gleixnera92444c2014-02-15 00:55:19 +0000103void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action);
Thomas Gleixnere1447102010-10-01 16:03:45 +0200104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105#ifdef CONFIG_PROC_FS
Yinghai Lu2c6927a2008-08-19 20:50:11 -0700106extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
Thomas Gleixner13bfe992010-09-30 02:46:07 +0200107extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108extern void register_handler_proc(unsigned int irq, struct irqaction *action);
109extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
110#else
Yinghai Lu2c6927a2008-08-19 20:50:11 -0700111static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Thomas Gleixner13bfe992010-09-30 02:46:07 +0200112static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113static inline void register_handler_proc(unsigned int irq,
114 struct irqaction *action) { }
115static inline void unregister_handler_proc(unsigned int irq,
116 struct irqaction *action) { }
117#endif
118
Thomas Gleixner9c255582016-07-04 17:39:23 +0900119extern bool irq_can_set_affinity_usr(unsigned int irq);
120
Thomas Gleixnercba42352017-06-20 01:37:21 +0200121extern int irq_select_affinity_usr(unsigned int irq);
Thomas Gleixnerf6d87f42008-11-07 13:18:30 +0100122
Thomas Gleixner591d2fb2009-07-21 11:09:39 +0200123extern void irq_set_thread_affinity(struct irq_desc *desc);
Yinghai Lu57b150c2009-04-27 17:59:53 -0700124
Jiang Liu818b0f32012-03-30 23:11:34 +0800125extern int irq_do_set_affinity(struct irq_data *data,
126 const struct cpumask *dest, bool force);
127
Thomas Gleixner43564bd2017-06-20 01:37:22 +0200128#ifdef CONFIG_SMP
129extern int irq_setup_affinity(struct irq_desc *desc);
130#else
131static inline int irq_setup_affinity(struct irq_desc *desc) { return 0; }
132#endif
133
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200134/* Inline functions for support of irq chips on slow busses */
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000135static inline void chip_bus_lock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200136{
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000137 if (unlikely(desc->irq_data.chip->irq_bus_lock))
138 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200139}
140
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000141static inline void chip_bus_sync_unlock(struct irq_desc *desc)
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200142{
Thomas Gleixner3876ec92010-09-27 12:44:35 +0000143 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
144 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
Thomas Gleixner70aedd22009-08-13 12:17:48 +0200145}
146
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100147#define _IRQ_DESC_CHECK (1 << 0)
148#define _IRQ_DESC_PERCPU (1 << 1)
149
150#define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK)
151#define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU)
152
Daniel Lezcanof944b5a2016-01-14 10:54:13 +0100153#define for_each_action_of_desc(desc, act) \
154 for (act = desc->act; act; act = act->next)
155
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100156struct irq_desc *
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100157__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
158 unsigned int check);
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100159void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus);
160
161static inline struct irq_desc *
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100162irq_get_desc_buslock(unsigned int irq, unsigned long *flags, unsigned int check)
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100163{
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100164 return __irq_get_desc_lock(irq, flags, true, check);
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100165}
166
167static inline void
168irq_put_desc_busunlock(struct irq_desc *desc, unsigned long flags)
169{
170 __irq_put_desc_unlock(desc, flags, true);
171}
172
173static inline struct irq_desc *
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100174irq_get_desc_lock(unsigned int irq, unsigned long *flags, unsigned int check)
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100175{
Marc Zyngier31d9d9b2011-09-23 17:03:06 +0100176 return __irq_get_desc_lock(irq, flags, false, check);
Thomas Gleixnerd5eb4ad22011-02-12 12:16:16 +0100177}
178
179static inline void
180irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags)
181{
182 __irq_put_desc_unlock(desc, flags, false);
183}
184
Boqun Fengb3542862015-12-29 12:18:48 +0800185#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
186
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200187static inline unsigned int irqd_get(struct irq_data *d)
188{
189 return __irqd_to_state(d);
190}
191
Ingo Molnar43f77752006-06-29 02:24:58 -0700192/*
Thomas Gleixnerf230b6d2011-02-05 15:20:04 +0100193 * Manipulation functions for irq_data.state
194 */
195static inline void irqd_set_move_pending(struct irq_data *d)
196{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800197 __irqd_to_state(d) |= IRQD_SETAFFINITY_PENDING;
Thomas Gleixnerf230b6d2011-02-05 15:20:04 +0100198}
199
200static inline void irqd_clr_move_pending(struct irq_data *d)
201{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800202 __irqd_to_state(d) &= ~IRQD_SETAFFINITY_PENDING;
Thomas Gleixnerf230b6d2011-02-05 15:20:04 +0100203}
Thomas Gleixnera0056772011-02-08 17:11:03 +0100204
Thomas Gleixner54fdf6a2017-06-20 01:37:47 +0200205static inline void irqd_set_managed_shutdown(struct irq_data *d)
206{
207 __irqd_to_state(d) |= IRQD_MANAGED_SHUTDOWN;
208}
209
210static inline void irqd_clr_managed_shutdown(struct irq_data *d)
211{
212 __irqd_to_state(d) &= ~IRQD_MANAGED_SHUTDOWN;
213}
214
Thomas Gleixnera0056772011-02-08 17:11:03 +0100215static inline void irqd_clear(struct irq_data *d, unsigned int mask)
216{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800217 __irqd_to_state(d) &= ~mask;
Thomas Gleixnera0056772011-02-08 17:11:03 +0100218}
219
220static inline void irqd_set(struct irq_data *d, unsigned int mask)
221{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800222 __irqd_to_state(d) |= mask;
Thomas Gleixnera0056772011-02-08 17:11:03 +0100223}
224
Thomas Gleixner2bdd1052011-02-08 17:22:00 +0100225static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
226{
Jiang Liu0d0b4c82015-06-01 16:05:12 +0800227 return __irqd_to_state(d) & mask;
Thomas Gleixner2bdd1052011-02-08 17:22:00 +0100228}
Thomas Gleixner8f945a32014-02-23 21:40:23 +0000229
Juergen Grossa6967122017-07-17 19:47:02 +0200230static inline void irq_state_set_disabled(struct irq_desc *desc)
231{
232 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
233}
234
235static inline void irq_state_set_masked(struct irq_desc *desc)
236{
237 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
238}
239
Boqun Fengb3542862015-12-29 12:18:48 +0800240#undef __irqd_to_state
241
Jiang Liub51bf952015-06-04 12:13:25 +0800242static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc)
Thomas Gleixner8f945a32014-02-23 21:40:23 +0000243{
244 __this_cpu_inc(*desc->kstat_irqs);
245 __this_cpu_inc(kstat.irqs_sum);
246}
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200247
Jiang Liu67830112015-06-01 16:05:13 +0800248static inline int irq_desc_get_node(struct irq_desc *desc)
249{
Jiang Liu449e9ca2015-06-01 16:05:16 +0800250 return irq_common_data_get_node(&desc->irq_common_data);
Jiang Liu67830112015-06-01 16:05:13 +0800251}
252
Grygorii Strashko4717f132015-11-10 11:58:12 +0200253static inline int irq_desc_is_chained(struct irq_desc *desc)
254{
255 return (desc->action && desc->action == &chained_action);
256}
257
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200258#ifdef CONFIG_PM_SLEEP
Thomas Gleixner9ce7a252014-08-29 14:00:16 +0200259bool irq_pm_check_wakeup(struct irq_desc *desc);
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200260void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action);
261void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action);
262#else
Thomas Gleixner9ce7a252014-08-29 14:00:16 +0200263static inline bool irq_pm_check_wakeup(struct irq_desc *desc) { return false; }
Thomas Gleixnercab303b2014-08-28 11:44:31 +0200264static inline void
265irq_pm_install_action(struct irq_desc *desc, struct irqaction *action) { }
266static inline void
267irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action) { }
268#endif
Bartosz Golaszewskif1602032017-05-31 18:06:58 +0200269
Daniel Lezcanob2d3d612017-06-23 16:11:07 +0200270#ifdef CONFIG_IRQ_TIMINGS
271
272#define IRQ_TIMINGS_SHIFT 5
273#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT)
274#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1)
275
276/**
277 * struct irq_timings - irq timings storing structure
278 * @values: a circular buffer of u64 encoded <timestamp,irq> values
279 * @count: the number of elements in the array
280 */
281struct irq_timings {
282 u64 values[IRQ_TIMINGS_SIZE];
283 int count;
284};
285
286DECLARE_PER_CPU(struct irq_timings, irq_timings);
287
Daniel Lezcanoe1c92142017-06-23 16:11:08 +0200288extern void irq_timings_free(int irq);
289extern int irq_timings_alloc(int irq);
290
Daniel Lezcanob2d3d612017-06-23 16:11:07 +0200291static inline void irq_remove_timings(struct irq_desc *desc)
292{
293 desc->istate &= ~IRQS_TIMINGS;
Daniel Lezcanoe1c92142017-06-23 16:11:08 +0200294
295 irq_timings_free(irq_desc_get_irq(desc));
Daniel Lezcanob2d3d612017-06-23 16:11:07 +0200296}
297
298static inline void irq_setup_timings(struct irq_desc *desc, struct irqaction *act)
299{
Daniel Lezcanoe1c92142017-06-23 16:11:08 +0200300 int irq = irq_desc_get_irq(desc);
301 int ret;
302
Daniel Lezcanob2d3d612017-06-23 16:11:07 +0200303 /*
304 * We don't need the measurement because the idle code already
305 * knows the next expiry event.
306 */
307 if (act->flags & __IRQF_TIMER)
308 return;
309
Daniel Lezcanoe1c92142017-06-23 16:11:08 +0200310 /*
311 * In case the timing allocation fails, we just want to warn,
312 * not fail, so letting the system boot anyway.
313 */
314 ret = irq_timings_alloc(irq);
315 if (ret) {
316 pr_warn("Failed to allocate irq timing stats for irq%d (%d)",
317 irq, ret);
318 return;
319 }
320
Daniel Lezcanob2d3d612017-06-23 16:11:07 +0200321 desc->istate |= IRQS_TIMINGS;
322}
323
324extern void irq_timings_enable(void);
325extern void irq_timings_disable(void);
326
327DECLARE_STATIC_KEY_FALSE(irq_timing_enabled);
328
329/*
330 * The interrupt number and the timestamp are encoded into a single
331 * u64 variable to optimize the size.
332 * 48 bit time stamp and 16 bit IRQ number is way sufficient.
333 * Who cares an IRQ after 78 hours of idle time?
334 */
335static inline u64 irq_timing_encode(u64 timestamp, int irq)
336{
337 return (timestamp << 16) | irq;
338}
339
340static inline int irq_timing_decode(u64 value, u64 *timestamp)
341{
342 *timestamp = value >> 16;
343 return value & U16_MAX;
344}
345
346/*
347 * The function record_irq_time is only called in one place in the
348 * interrupts handler. We want this function always inline so the code
349 * inside is embedded in the function and the static key branching
350 * code can act at the higher level. Without the explicit
351 * __always_inline we can end up with a function call and a small
352 * overhead in the hotpath for nothing.
353 */
354static __always_inline void record_irq_time(struct irq_desc *desc)
355{
356 if (!static_branch_likely(&irq_timing_enabled))
357 return;
358
359 if (desc->istate & IRQS_TIMINGS) {
360 struct irq_timings *timings = this_cpu_ptr(&irq_timings);
361
362 timings->values[timings->count & IRQ_TIMINGS_MASK] =
363 irq_timing_encode(local_clock(),
364 irq_desc_get_irq(desc));
365
366 timings->count++;
367 }
368}
369#else
370static inline void irq_remove_timings(struct irq_desc *desc) {}
371static inline void irq_setup_timings(struct irq_desc *desc,
372 struct irqaction *act) {};
373static inline void record_irq_time(struct irq_desc *desc) {}
374#endif /* CONFIG_IRQ_TIMINGS */
375
376
Bartosz Golaszewskif1602032017-05-31 18:06:58 +0200377#ifdef CONFIG_GENERIC_IRQ_CHIP
378void irq_init_generic_chip(struct irq_chip_generic *gc, const char *name,
379 int num_ct, unsigned int irq_base,
380 void __iomem *reg_base, irq_flow_handler_t handler);
381#else
382static inline void
383irq_init_generic_chip(struct irq_chip_generic *gc, const char *name,
384 int num_ct, unsigned int irq_base,
385 void __iomem *reg_base, irq_flow_handler_t handler) { }
386#endif /* CONFIG_GENERIC_IRQ_CHIP */
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200387
Christoph Hellwig137221d2017-06-20 01:37:24 +0200388#ifdef CONFIG_GENERIC_PENDING_IRQ
389static inline bool irq_can_move_pcntxt(struct irq_data *data)
390{
391 return irqd_can_move_in_process_context(data);
392}
393static inline bool irq_move_pending(struct irq_data *data)
394{
395 return irqd_is_setaffinity_pending(data);
396}
397static inline void
398irq_copy_pending(struct irq_desc *desc, const struct cpumask *mask)
399{
400 cpumask_copy(desc->pending_mask, mask);
401}
402static inline void
403irq_get_pending(struct cpumask *mask, struct irq_desc *desc)
404{
405 cpumask_copy(mask, desc->pending_mask);
406}
Thomas Gleixnerf0383c22017-06-20 01:37:29 +0200407static inline struct cpumask *irq_desc_get_pending_mask(struct irq_desc *desc)
408{
409 return desc->pending_mask;
410}
Thomas Gleixner36d84fb2017-06-20 01:37:34 +0200411bool irq_fixup_move_pending(struct irq_desc *desc, bool force_clear);
Christoph Hellwig137221d2017-06-20 01:37:24 +0200412#else /* CONFIG_GENERIC_PENDING_IRQ */
413static inline bool irq_can_move_pcntxt(struct irq_data *data)
414{
415 return true;
416}
417static inline bool irq_move_pending(struct irq_data *data)
418{
419 return false;
420}
421static inline void
422irq_copy_pending(struct irq_desc *desc, const struct cpumask *mask)
423{
424}
425static inline void
426irq_get_pending(struct cpumask *mask, struct irq_desc *desc)
427{
428}
Thomas Gleixnerf0383c22017-06-20 01:37:29 +0200429static inline struct cpumask *irq_desc_get_pending_mask(struct irq_desc *desc)
430{
431 return NULL;
432}
Thomas Gleixner36d84fb2017-06-20 01:37:34 +0200433static inline bool irq_fixup_move_pending(struct irq_desc *desc, bool fclear)
434{
435 return false;
436}
Thomas Gleixnerf0383c22017-06-20 01:37:29 +0200437#endif /* !CONFIG_GENERIC_PENDING_IRQ */
Christoph Hellwig137221d2017-06-20 01:37:24 +0200438
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200439#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
Thomas Gleixnerc2ce34c2017-06-24 11:05:59 +0200440#include <linux/debugfs.h>
441
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200442void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *desc);
Thomas Gleixnerc2ce34c2017-06-24 11:05:59 +0200443static inline void irq_remove_debugfs_entry(struct irq_desc *desc)
444{
445 debugfs_remove(desc->debugfs_file);
446}
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200447# ifdef CONFIG_IRQ_DOMAIN
448void irq_domain_debugfs_init(struct dentry *root);
449# else
Sebastian Otte5682b42017-07-04 11:25:15 +0200450static inline void irq_domain_debugfs_init(struct dentry *root)
451{
452}
Thomas Gleixner087cdfb2017-06-20 01:37:17 +0200453# endif
454#else /* CONFIG_GENERIC_IRQ_DEBUGFS */
455static inline void irq_add_debugfs_entry(unsigned int irq, struct irq_desc *d)
456{
457}
458static inline void irq_remove_debugfs_entry(struct irq_desc *d)
459{
460}
461#endif /* CONFIG_GENERIC_IRQ_DEBUGFS */