hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/irq.h
....@@ -27,6 +27,7 @@
2727 struct seq_file;
2828 struct module;
2929 struct msi_msg;
30
+struct irq_affinity_desc;
3031 enum irqchip_irq_state;
3132
3233 /*
....@@ -70,6 +71,8 @@
7071 * it from the spurious interrupt detection
7172 * mechanism and from core side polling.
7273 * IRQ_DISABLE_UNLAZY - Disable lazy irq disable
74
+ * IRQ_HIDDEN - Don't show up in /proc/interrupts
75
+ * IRQ_RAW - Skip tick management and irqtime accounting
7376 */
7477 enum {
7578 IRQ_TYPE_NONE = 0x00000000,
....@@ -96,13 +99,15 @@
9699 IRQ_PER_CPU_DEVID = (1 << 17),
97100 IRQ_IS_POLLED = (1 << 18),
98101 IRQ_DISABLE_UNLAZY = (1 << 19),
102
+ IRQ_HIDDEN = (1 << 20),
103
+ IRQ_RAW = (1 << 21),
99104 };
100105
101106 #define IRQF_MODIFY_MASK \
102107 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
103108 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
104109 IRQ_PER_CPU | IRQ_NESTED_THREAD | IRQ_NOTHREAD | IRQ_PER_CPU_DEVID | \
105
- IRQ_IS_POLLED | IRQ_DISABLE_UNLAZY)
110
+ IRQ_IS_POLLED | IRQ_DISABLE_UNLAZY | IRQ_HIDDEN)
106111
107112 #define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
108113
....@@ -194,7 +199,7 @@
194199 * IRQD_LEVEL - Interrupt is level triggered
195200 * IRQD_WAKEUP_STATE - Interrupt is configured for wakeup
196201 * from suspend
197
- * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process
202
+ * IRQD_MOVE_PCNTXT - Interrupt can be moved in process
198203 * context
199204 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
200205 * IRQD_IRQ_MASKED - Masked state of the interrupt
....@@ -210,8 +215,12 @@
210215 * IRQD_CAN_RESERVE - Can use reservation mode
211216 * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change
212217 * required
218
+ * IRQD_HANDLE_ENFORCE_IRQCTX - Enforce that handle_irq_*() is only invoked
219
+ * from actual interrupt context.
213220 * IRQD_AFFINITY_ON_ACTIVATE - Affinity is set on activation. Don't call
214221 * irq_chip::irq_set_affinity() when deactivated.
222
+ * IRQD_IRQ_ENABLED_ON_SUSPEND - Interrupt is enabled on suspend by irq pm if
223
+ * irqchip have flag IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND set.
215224 */
216225 enum {
217226 IRQD_TRIGGER_MASK = 0xf,
....@@ -235,7 +244,9 @@
235244 IRQD_DEFAULT_TRIGGER_SET = (1 << 25),
236245 IRQD_CAN_RESERVE = (1 << 26),
237246 IRQD_MSI_NOMASK_QUIRK = (1 << 27),
247
+ IRQD_HANDLE_ENFORCE_IRQCTX = (1 << 28),
238248 IRQD_AFFINITY_ON_ACTIVATE = (1 << 29),
249
+ IRQD_IRQ_ENABLED_ON_SUSPEND = (1 << 30),
239250 };
240251
241252 #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
....@@ -303,6 +314,21 @@
303314 static inline bool irqd_is_single_target(struct irq_data *d)
304315 {
305316 return __irqd_to_state(d) & IRQD_SINGLE_TARGET;
317
+}
318
+
319
+static inline void irqd_set_handle_enforce_irqctx(struct irq_data *d)
320
+{
321
+ __irqd_to_state(d) |= IRQD_HANDLE_ENFORCE_IRQCTX;
322
+}
323
+
324
+static inline bool irqd_is_handle_enforce_irqctx(struct irq_data *d)
325
+{
326
+ return __irqd_to_state(d) & IRQD_HANDLE_ENFORCE_IRQCTX;
327
+}
328
+
329
+static inline bool irqd_is_enabled_on_suspend(struct irq_data *d)
330
+{
331
+ return __irqd_to_state(d) & IRQD_IRQ_ENABLED_ON_SUSPEND;
306332 }
307333
308334 static inline bool irqd_is_wakeup_set(struct irq_data *d)
....@@ -472,6 +498,8 @@
472498 * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine
473499 * @ipi_send_single: send a single IPI to destination cpus
474500 * @ipi_send_mask: send an IPI to destination cpus in cpumask
501
+ * @irq_nmi_setup: function called from core code before enabling an NMI
502
+ * @irq_nmi_teardown: function called from core code after disabling an NMI
475503 * @flags: chip specific flags
476504 */
477505 struct irq_chip {
....@@ -520,33 +548,41 @@
520548 void (*ipi_send_single)(struct irq_data *data, unsigned int cpu);
521549 void (*ipi_send_mask)(struct irq_data *data, const struct cpumask *dest);
522550
551
+ int (*irq_nmi_setup)(struct irq_data *data);
552
+ void (*irq_nmi_teardown)(struct irq_data *data);
553
+
523554 unsigned long flags;
524555 };
525556
526557 /*
527558 * irq_chip specific flags
528559 *
529
- * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
530
- * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
531
- * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
532
- * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
533
- * when irq enabled
534
- * IRQCHIP_SKIP_SET_WAKE: Skip chip.irq_set_wake(), for this irq chip
535
- * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask
536
- * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode
537
- * IRQCHIP_SUPPORTS_LEVEL_MSI Chip can provide two doorbells for Level MSIs
560
+ * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
561
+ * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
562
+ * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
563
+ * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
564
+ * when irq enabled
565
+ * IRQCHIP_SKIP_SET_WAKE: Skip chip.irq_set_wake(), for this irq chip
566
+ * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask
567
+ * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode
568
+ * IRQCHIP_SUPPORTS_LEVEL_MSI: Chip can provide two doorbells for Level MSIs
569
+ * IRQCHIP_SUPPORTS_NMI: Chip can deliver NMIs, only for root irqchips
570
+ * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs
571
+ * in the suspend path if they are in disabled state
538572 * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup
539573 */
540574 enum {
541
- IRQCHIP_SET_TYPE_MASKED = (1 << 0),
542
- IRQCHIP_EOI_IF_HANDLED = (1 << 1),
543
- IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
544
- IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
545
- IRQCHIP_SKIP_SET_WAKE = (1 << 4),
546
- IRQCHIP_ONESHOT_SAFE = (1 << 5),
547
- IRQCHIP_EOI_THREADED = (1 << 6),
548
- IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
549
- IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10),
575
+ IRQCHIP_SET_TYPE_MASKED = (1 << 0),
576
+ IRQCHIP_EOI_IF_HANDLED = (1 << 1),
577
+ IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
578
+ IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
579
+ IRQCHIP_SKIP_SET_WAKE = (1 << 4),
580
+ IRQCHIP_ONESHOT_SAFE = (1 << 5),
581
+ IRQCHIP_EOI_THREADED = (1 << 6),
582
+ IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
583
+ IRQCHIP_SUPPORTS_NMI = (1 << 8),
584
+ IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9),
585
+ IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10),
550586 };
551587
552588 #include <linux/irqdesc.h>
....@@ -567,8 +603,6 @@
567603 #define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS
568604
569605 struct irqaction;
570
-extern int setup_irq(unsigned int irq, struct irqaction *new);
571
-extern void remove_irq(unsigned int irq, struct irqaction *act);
572606 extern int setup_percpu_irq(unsigned int irq, struct irqaction *new);
573607 extern void remove_percpu_irq(unsigned int irq, struct irqaction *act);
574608
....@@ -617,6 +651,7 @@
617651 */
618652 extern void handle_level_irq(struct irq_desc *desc);
619653 extern void handle_fasteoi_irq(struct irq_desc *desc);
654
+extern void handle_percpu_devid_fasteoi_ipi(struct irq_desc *desc);
620655 extern void handle_edge_irq(struct irq_desc *desc);
621656 extern void handle_edge_eoi_irq(struct irq_desc *desc);
622657 extern void handle_simple_irq(struct irq_desc *desc);
....@@ -625,6 +660,9 @@
625660 extern void handle_percpu_devid_irq(struct irq_desc *desc);
626661 extern void handle_bad_irq(struct irq_desc *desc);
627662 extern void handle_nested_irq(unsigned int irq);
663
+
664
+extern void handle_fasteoi_nmi(struct irq_desc *desc);
665
+extern void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc);
628666
629667 extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
630668 extern int irq_chip_pm_get(struct irq_data *data);
....@@ -643,6 +681,7 @@
643681 extern void irq_chip_ack_parent(struct irq_data *data);
644682 extern int irq_chip_retrigger_hierarchy(struct irq_data *data);
645683 extern void irq_chip_mask_parent(struct irq_data *data);
684
+extern void irq_chip_mask_ack_parent(struct irq_data *data);
646685 extern void irq_chip_unmask_parent(struct irq_data *data);
647686 extern void irq_chip_eoi_parent(struct irq_data *data);
648687 extern int irq_chip_set_affinity_parent(struct irq_data *data,
....@@ -652,6 +691,8 @@
652691 extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data,
653692 void *vcpu_info);
654693 extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type);
694
+extern int irq_chip_request_resources_parent(struct irq_data *data);
695
+extern void irq_chip_release_resources_parent(struct irq_data *data);
655696 #endif
656697
657698 /* Handling of unhandled and spurious interrupts: */
....@@ -713,6 +754,9 @@
713754 void
714755 irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
715756 void *data);
757
+
758
+void __irq_modify_status(unsigned int irq, unsigned long clr,
759
+ unsigned long set, unsigned long mask);
716760
717761 void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set);
718762
....@@ -873,18 +917,19 @@
873917 unsigned int arch_dynirq_lower_bound(unsigned int from);
874918
875919 int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
876
- struct module *owner, const struct cpumask *affinity);
920
+ struct module *owner,
921
+ const struct irq_affinity_desc *affinity);
877922
878923 int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from,
879924 unsigned int cnt, int node, struct module *owner,
880
- const struct cpumask *affinity);
925
+ const struct irq_affinity_desc *affinity);
881926
882927 /* use macros to avoid needing export.h for THIS_MODULE */
883928 #define irq_alloc_descs(irq, from, cnt, node) \
884929 __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE, NULL)
885930
886931 #define irq_alloc_desc(node) \
887
- irq_alloc_descs(-1, 0, 1, node)
932
+ irq_alloc_descs(-1, 1, 1, node)
888933
889934 #define irq_alloc_desc_at(at, node) \
890935 irq_alloc_descs(at, at, 1, node)
....@@ -899,7 +944,7 @@
899944 __devm_irq_alloc_descs(dev, irq, from, cnt, node, THIS_MODULE, NULL)
900945
901946 #define devm_irq_alloc_desc(dev, node) \
902
- devm_irq_alloc_descs(dev, -1, 0, 1, node)
947
+ devm_irq_alloc_descs(dev, -1, 1, 1, node)
903948
904949 #define devm_irq_alloc_desc_at(dev, at, node) \
905950 devm_irq_alloc_descs(dev, at, at, 1, node)
....@@ -1030,7 +1075,7 @@
10301075 unsigned long unused;
10311076 struct irq_domain *domain;
10321077 struct list_head list;
1033
- struct irq_chip_type chip_types[0];
1078
+ struct irq_chip_type chip_types[];
10341079 };
10351080
10361081 /**
....@@ -1066,7 +1111,7 @@
10661111 unsigned int irq_flags_to_clear;
10671112 unsigned int irq_flags_to_set;
10681113 enum irq_gc_flags gc_flags;
1069
- struct irq_chip_generic *gc[0];
1114
+ struct irq_chip_generic *gc[];
10701115 };
10711116
10721117 /* Generic chip callback functions */
....@@ -1228,6 +1273,12 @@
12281273 * top-level IRQ handler.
12291274 */
12301275 extern void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
1276
+#else
1277
+#define set_handle_irq(handle_irq) \
1278
+ do { \
1279
+ (void)handle_irq; \
1280
+ WARN_ON(1); \
1281
+ } while (0)
12311282 #endif
12321283
12331284 #endif /* _LINUX_IRQ_H */