hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
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 /*
....@@ -69,8 +70,9 @@
6970 * IRQ_IS_POLLED - Always polled by another interrupt. Exclude
7071 * it from the spurious interrupt detection
7172 * mechanism and from core side polling.
72
- * IRQ_NO_SOFTIRQ_CALL - No softirq processing in the irq thread context (RT)
7373 * 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
7476 */
7577 enum {
7678 IRQ_TYPE_NONE = 0x00000000,
....@@ -97,14 +99,15 @@
9799 IRQ_PER_CPU_DEVID = (1 << 17),
98100 IRQ_IS_POLLED = (1 << 18),
99101 IRQ_DISABLE_UNLAZY = (1 << 19),
100
- IRQ_NO_SOFTIRQ_CALL = (1 << 20),
102
+ IRQ_HIDDEN = (1 << 20),
103
+ IRQ_RAW = (1 << 21),
101104 };
102105
103106 #define IRQF_MODIFY_MASK \
104107 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
105108 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
106109 IRQ_PER_CPU | IRQ_NESTED_THREAD | IRQ_NOTHREAD | IRQ_PER_CPU_DEVID | \
107
- IRQ_IS_POLLED | IRQ_DISABLE_UNLAZY | IRQ_NO_SOFTIRQ_CALL)
110
+ IRQ_IS_POLLED | IRQ_DISABLE_UNLAZY | IRQ_HIDDEN)
108111
109112 #define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
110113
....@@ -115,7 +118,7 @@
115118 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_common_data.affinity
116119 * IRQ_SET_MASK_OK_DONE - Same as IRQ_SET_MASK_OK for core. Special code to
117120 * support stacked irqchips, which indicates skipping
118
- * all descendent irqchips.
121
+ * all descendant irqchips.
119122 */
120123 enum {
121124 IRQ_SET_MASK_OK = 0,
....@@ -196,7 +199,7 @@
196199 * IRQD_LEVEL - Interrupt is level triggered
197200 * IRQD_WAKEUP_STATE - Interrupt is configured for wakeup
198201 * from suspend
199
- * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process
202
+ * IRQD_MOVE_PCNTXT - Interrupt can be moved in process
200203 * context
201204 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
202205 * IRQD_IRQ_MASKED - Masked state of the interrupt
....@@ -212,8 +215,12 @@
212215 * IRQD_CAN_RESERVE - Can use reservation mode
213216 * IRQD_MSI_NOMASK_QUIRK - Non-maskable MSI quirk for affinity change
214217 * required
218
+ * IRQD_HANDLE_ENFORCE_IRQCTX - Enforce that handle_irq_*() is only invoked
219
+ * from actual interrupt context.
215220 * IRQD_AFFINITY_ON_ACTIVATE - Affinity is set on activation. Don't call
216221 * 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.
217224 */
218225 enum {
219226 IRQD_TRIGGER_MASK = 0xf,
....@@ -237,7 +244,9 @@
237244 IRQD_DEFAULT_TRIGGER_SET = (1 << 25),
238245 IRQD_CAN_RESERVE = (1 << 26),
239246 IRQD_MSI_NOMASK_QUIRK = (1 << 27),
247
+ IRQD_HANDLE_ENFORCE_IRQCTX = (1 << 28),
240248 IRQD_AFFINITY_ON_ACTIVATE = (1 << 29),
249
+ IRQD_IRQ_ENABLED_ON_SUSPEND = (1 << 30),
241250 };
242251
243252 #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
....@@ -295,7 +304,7 @@
295304
296305 /*
297306 * Must only be called of irqchip.irq_set_affinity() or low level
298
- * hieararchy domain allocation functions.
307
+ * hierarchy domain allocation functions.
299308 */
300309 static inline void irqd_set_single_target(struct irq_data *d)
301310 {
....@@ -305,6 +314,21 @@
305314 static inline bool irqd_is_single_target(struct irq_data *d)
306315 {
307316 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;
308332 }
309333
310334 static inline bool irqd_is_wakeup_set(struct irq_data *d)
....@@ -474,6 +498,8 @@
474498 * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine
475499 * @ipi_send_single: send a single IPI to destination cpus
476500 * @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
477503 * @flags: chip specific flags
478504 */
479505 struct irq_chip {
....@@ -522,33 +548,41 @@
522548 void (*ipi_send_single)(struct irq_data *data, unsigned int cpu);
523549 void (*ipi_send_mask)(struct irq_data *data, const struct cpumask *dest);
524550
551
+ int (*irq_nmi_setup)(struct irq_data *data);
552
+ void (*irq_nmi_teardown)(struct irq_data *data);
553
+
525554 unsigned long flags;
526555 };
527556
528557 /*
529558 * irq_chip specific flags
530559 *
531
- * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
532
- * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
533
- * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
534
- * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
535
- * when irq enabled
536
- * IRQCHIP_SKIP_SET_WAKE: Skip chip.irq_set_wake(), for this irq chip
537
- * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask
538
- * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode
539
- * 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
540572 * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup
541573 */
542574 enum {
543
- IRQCHIP_SET_TYPE_MASKED = (1 << 0),
544
- IRQCHIP_EOI_IF_HANDLED = (1 << 1),
545
- IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
546
- IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
547
- IRQCHIP_SKIP_SET_WAKE = (1 << 4),
548
- IRQCHIP_ONESHOT_SAFE = (1 << 5),
549
- IRQCHIP_EOI_THREADED = (1 << 6),
550
- IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
551
- 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),
552586 };
553587
554588 #include <linux/irqdesc.h>
....@@ -569,8 +603,6 @@
569603 #define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS
570604
571605 struct irqaction;
572
-extern int setup_irq(unsigned int irq, struct irqaction *new);
573
-extern void remove_irq(unsigned int irq, struct irqaction *act);
574606 extern int setup_percpu_irq(unsigned int irq, struct irqaction *new);
575607 extern void remove_percpu_irq(unsigned int irq, struct irqaction *act);
576608
....@@ -619,6 +651,7 @@
619651 */
620652 extern void handle_level_irq(struct irq_desc *desc);
621653 extern void handle_fasteoi_irq(struct irq_desc *desc);
654
+extern void handle_percpu_devid_fasteoi_ipi(struct irq_desc *desc);
622655 extern void handle_edge_irq(struct irq_desc *desc);
623656 extern void handle_edge_eoi_irq(struct irq_desc *desc);
624657 extern void handle_simple_irq(struct irq_desc *desc);
....@@ -627,6 +660,9 @@
627660 extern void handle_percpu_devid_irq(struct irq_desc *desc);
628661 extern void handle_bad_irq(struct irq_desc *desc);
629662 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);
630666
631667 extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
632668 extern int irq_chip_pm_get(struct irq_data *data);
....@@ -645,6 +681,7 @@
645681 extern void irq_chip_ack_parent(struct irq_data *data);
646682 extern int irq_chip_retrigger_hierarchy(struct irq_data *data);
647683 extern void irq_chip_mask_parent(struct irq_data *data);
684
+extern void irq_chip_mask_ack_parent(struct irq_data *data);
648685 extern void irq_chip_unmask_parent(struct irq_data *data);
649686 extern void irq_chip_eoi_parent(struct irq_data *data);
650687 extern int irq_chip_set_affinity_parent(struct irq_data *data,
....@@ -654,6 +691,8 @@
654691 extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data,
655692 void *vcpu_info);
656693 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);
657696 #endif
658697
659698 /* Handling of unhandled and spurious interrupts: */
....@@ -715,6 +754,9 @@
715754 void
716755 irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
717756 void *data);
757
+
758
+void __irq_modify_status(unsigned int irq, unsigned long clr,
759
+ unsigned long set, unsigned long mask);
718760
719761 void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set);
720762
....@@ -875,18 +917,19 @@
875917 unsigned int arch_dynirq_lower_bound(unsigned int from);
876918
877919 int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
878
- struct module *owner, const struct cpumask *affinity);
920
+ struct module *owner,
921
+ const struct irq_affinity_desc *affinity);
879922
880923 int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from,
881924 unsigned int cnt, int node, struct module *owner,
882
- const struct cpumask *affinity);
925
+ const struct irq_affinity_desc *affinity);
883926
884927 /* use macros to avoid needing export.h for THIS_MODULE */
885928 #define irq_alloc_descs(irq, from, cnt, node) \
886929 __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE, NULL)
887930
888931 #define irq_alloc_desc(node) \
889
- irq_alloc_descs(-1, 0, 1, node)
932
+ irq_alloc_descs(-1, 1, 1, node)
890933
891934 #define irq_alloc_desc_at(at, node) \
892935 irq_alloc_descs(at, at, 1, node)
....@@ -901,7 +944,7 @@
901944 __devm_irq_alloc_descs(dev, irq, from, cnt, node, THIS_MODULE, NULL)
902945
903946 #define devm_irq_alloc_desc(dev, node) \
904
- devm_irq_alloc_descs(dev, -1, 0, 1, node)
947
+ devm_irq_alloc_descs(dev, -1, 1, 1, node)
905948
906949 #define devm_irq_alloc_desc_at(dev, at, node) \
907950 devm_irq_alloc_descs(dev, at, at, 1, node)
....@@ -1032,7 +1075,7 @@
10321075 unsigned long unused;
10331076 struct irq_domain *domain;
10341077 struct list_head list;
1035
- struct irq_chip_type chip_types[0];
1078
+ struct irq_chip_type chip_types[];
10361079 };
10371080
10381081 /**
....@@ -1068,7 +1111,7 @@
10681111 unsigned int irq_flags_to_clear;
10691112 unsigned int irq_flags_to_set;
10701113 enum irq_gc_flags gc_flags;
1071
- struct irq_chip_generic *gc[0];
1114
+ struct irq_chip_generic *gc[];
10721115 };
10731116
10741117 /* Generic chip callback functions */
....@@ -1230,6 +1273,12 @@
12301273 * top-level IRQ handler.
12311274 */
12321275 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)
12331282 #endif
12341283
12351284 #endif /* _LINUX_IRQ_H */