hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/kernel/irq/internals.h
....@@ -29,12 +29,14 @@
2929 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
3030 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
3131 * IRQTF_FORCED_THREAD - irq action is force threaded
32
+ * IRQTF_READY - signals that irq thread is ready
3233 */
3334 enum {
3435 IRQTF_RUNTHREAD,
3536 IRQTF_WARNED,
3637 IRQTF_AFFINITY,
3738 IRQTF_FORCED_THREAD,
39
+ IRQTF_READY,
3840 };
3941
4042 /*
....@@ -49,6 +51,7 @@
4951 * IRQS_WAITING - irq is waiting
5052 * IRQS_PENDING - irq is pending and replayed later
5153 * IRQS_SUSPENDED - irq is suspended
54
+ * IRQS_NMI - irq line is used to deliver NMIs
5255 */
5356 enum {
5457 IRQS_AUTODETECT = 0x00000001,
....@@ -60,6 +63,7 @@
6063 IRQS_PENDING = 0x00000200,
6164 IRQS_SUSPENDED = 0x00000800,
6265 IRQS_TIMINGS = 0x00001000,
66
+ IRQS_NMI = 0x00002000,
6367 };
6468
6569 #include "debug.h"
....@@ -106,7 +110,7 @@
106110 irqreturn_t handle_irq_event(struct irq_desc *desc);
107111
108112 /* Resending of interrupts :*/
109
-void check_irq_resend(struct irq_desc *desc);
113
+int check_irq_resend(struct irq_desc *desc, bool inject);
110114 bool irq_wait_for_poll(struct irq_desc *desc);
111115 void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action);
112116
....@@ -355,6 +359,16 @@
355359 return value & U16_MAX;
356360 }
357361
362
+static __always_inline void irq_timings_push(u64 ts, int irq)
363
+{
364
+ struct irq_timings *timings = this_cpu_ptr(&irq_timings);
365
+
366
+ timings->values[timings->count & IRQ_TIMINGS_MASK] =
367
+ irq_timing_encode(ts, irq);
368
+
369
+ timings->count++;
370
+}
371
+
358372 /*
359373 * The function record_irq_time is only called in one place in the
360374 * interrupts handler. We want this function always inline so the code
....@@ -368,15 +382,8 @@
368382 if (!static_branch_likely(&irq_timing_enabled))
369383 return;
370384
371
- if (desc->istate & IRQS_TIMINGS) {
372
- struct irq_timings *timings = this_cpu_ptr(&irq_timings);
373
-
374
- timings->values[timings->count & IRQ_TIMINGS_MASK] =
375
- irq_timing_encode(local_clock(),
376
- irq_desc_get_irq(desc));
377
-
378
- timings->count++;
379
- }
385
+ if (desc->istate & IRQS_TIMINGS)
386
+ irq_timings_push(local_clock(), irq_desc_get_irq(desc));
380387 }
381388 #else
382389 static inline void irq_remove_timings(struct irq_desc *desc) {}
....@@ -420,6 +427,10 @@
420427 {
421428 return desc->pending_mask;
422429 }
430
+static inline bool handle_enforce_irqctx(struct irq_data *data)
431
+{
432
+ return irqd_is_handle_enforce_irqctx(data);
433
+}
423434 bool irq_fixup_move_pending(struct irq_desc *desc, bool force_clear);
424435 #else /* CONFIG_GENERIC_PENDING_IRQ */
425436 static inline bool irq_can_move_pcntxt(struct irq_data *data)
....@@ -446,6 +457,10 @@
446457 {
447458 return false;
448459 }
460
+static inline bool handle_enforce_irqctx(struct irq_data *data)
461
+{
462
+ return false;
463
+}
449464 #endif /* !CONFIG_GENERIC_PENDING_IRQ */
450465
451466 #if !defined(CONFIG_IRQ_DOMAIN) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY)
....@@ -460,6 +475,15 @@
460475 }
461476 #endif
462477
478
+static inline struct irq_data *irqd_get_parent_data(struct irq_data *irqd)
479
+{
480
+#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
481
+ return irqd->parent_data;
482
+#else
483
+ return NULL;
484
+#endif
485
+}
486
+
463487 #ifdef CONFIG_GENERIC_IRQ_DEBUGFS
464488 #include <linux/debugfs.h>
465489