History

Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq updates from Thomas Gleixner: "The interrupt departement delivers this time: - New infrastructure to manage NMIs on platforms which have a sane NMI delivery, i.e. identifiable NMI vectors instead of a single lump. - Simplification of the interrupt affinity management so drivers don't have to implement ugly loops around the PCI/MSI enablement. - Speedup for interrupt statistics in /proc/stat - Provide a function to retrieve the default irq domain - A new interrupt controller for the Loongson LS1X platform - Affinity support for the SiFive PLIC - Better support for the iMX irqsteer driver - NUMA aware memory allocations for GICv3 - The usual small fixes, improvements and cleanups all over the place" * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits) irqchip/imx-irqsteer: Add multi output interrupts support irqchip/imx-irqsteer: Change to use reg_num instead of irq_group dt-bindings: irq: imx-irqsteer: Add multi output interrupts support dt-binding: irq: imx-irqsteer: Use irq number instead of group number irqchip/brcmstb-l2: Use _irqsave locking variants in non-interrupt code irqchip/gicv3-its: Use NUMA aware memory allocation for ITS tables irqdomain: Allow the default irq domain to be retrieved irqchip/sifive-plic: Implement irq_set_affinity() for SMP host irqchip/sifive-plic: Differentiate between PLIC handler and context irqchip/sifive-plic: Add warning in plic_init() if handler already present irqchip/sifive-plic: Pre-compute context hart base and enable base PCI/MSI: Remove obsolete sanity checks for multiple interrupt sets genirq/affinity: Remove the leftovers of the original set support nvme-pci: Simplify interrupt allocation genirq/affinity: Add new callback for (re)calculating interrupt sets genirq/affinity: Store interrupt sets size in struct irq_affinity genirq/affinity: Code consolidation irqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid. irqchip/i8259: Fix shutdown order by moving syscore_ops registration dt-bindings: interrupt-controller: loongson ls1x intc ...

Linus Torvalds committed 7 years ago

Commit 78f86012 parents 1848319 a324ca930 files · +1177 −281Browse files

Showing the changes to include/linux (6 of 30 files). Show all

Unified · Split

6 files
  1. include/linux/interrupt.h +40 −11
  2. include/linux/irq.h +10 −0
  3. include/linux/irqdesc.h +7 −0
  4. include/linux/irqdomain.h +1 −0
  5. include/linux/kthread.h +1 −0
  6. include/linux/pci.h +2 −2
include/linux/interrupt.h+40−11
@@ -156,6 +156,10 @@ __request_percpu_irq(unsigned int irq, irq_handler_t handler, · 155 unmodified lines
156156 unsigned long flags, const char *devname,
157157 void __percpu *percpu_dev_id);
158158
159+extern int __must_check
160+request_nmi(unsigned int irq, irq_handler_t handler, unsigned long flags,
161+ const char *name, void *dev);
162+
159163 static inline int __must_check
160164 request_percpu_irq(unsigned int irq, irq_handler_t handler,
161165 const char *devname, void __percpu *percpu_dev_id)
@@ -164,9 +168,16 @@ request_percpu_irq(unsigned int irq, irq_handler_t handler, · 2 unmodified lines
164168 devname, percpu_dev_id);
165169 }
166170
171+extern int __must_check
172+request_percpu_nmi(unsigned int irq, irq_handler_t handler,
173+ const char *devname, void __percpu *dev);
174+
167175 extern const void *free_irq(unsigned int, void *);
168176 extern void free_percpu_irq(unsigned int, void __percpu *);
169177
178+extern const void *free_nmi(unsigned int irq, void *dev_id);
179+extern void free_percpu_nmi(unsigned int irq, void __percpu *percpu_dev_id);
180+
170181 struct device;
171182
172183 extern int __must_check
@@ -217,6 +228,13 @@ extern void enable_percpu_irq(unsigned int irq, unsigned int type); · 44 unmodified lines
217228 extern bool irq_percpu_is_enabled(unsigned int irq);
218229 extern void irq_wake_thread(unsigned int irq, void *dev_id);
219230
231+extern void disable_nmi_nosync(unsigned int irq);
232+extern void disable_percpu_nmi(unsigned int irq);
233+extern void enable_nmi(unsigned int irq);
234+extern void enable_percpu_nmi(unsigned int irq, unsigned int type);
235+extern int prepare_percpu_nmi(unsigned int irq);
236+extern void teardown_percpu_nmi(unsigned int irq);
237+
220238 /* The following three functions are for the core kernel use only. */
221239 extern void suspend_device_irqs(void);
222240 extern void resume_device_irqs(void);
@@ -241,20 +259,29 @@ struct irq_affinity_notify { · 18 unmodified lines
241259 void (*release)(struct kref *ref);
242260 };
243261
262+#define IRQ_AFFINITY_MAX_SETS 4
263+
244264 /**
245265 * struct irq_affinity - Description for automatic irq affinity assignements
246266 * @pre_vectors: Don't apply affinity to @pre_vectors at beginning of
247267 * the MSI(-X) vector space
248268 * @post_vectors: Don't apply affinity to @post_vectors at end of
249269 * the MSI(-X) vector space
250− * @nr_sets: Length of passed in *sets array
251− * @sets: Number of affinitized sets
270+ * @nr_sets: The number of interrupt sets for which affinity
271+ * spreading is required
272+ * @set_size: Array holding the size of each interrupt set
273+ * @calc_sets: Callback for calculating the number and size
274+ * of interrupt sets
275+ * @priv: Private data for usage by @calc_sets, usually a
276+ * pointer to driver/device specific data.
252277 */
253278 struct irq_affinity {
254− int pre_vectors;
255− int post_vectors;
256− int nr_sets;
257− int *sets;
279+ unsigned int pre_vectors;
280+ unsigned int post_vectors;
281+ unsigned int nr_sets;
282+ unsigned int set_size[IRQ_AFFINITY_MAX_SETS];
283+ void (*calc_sets)(struct irq_affinity *, unsigned int nvecs);
284+ void *priv;
258285 };
259286
260287 /**
@@ -314,9 +341,10 @@ extern int · 53 unmodified lines
314341 irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
315342
316343 struct irq_affinity_desc *
317−irq_create_affinity_masks(int nvec, const struct irq_affinity *affd);
344+irq_create_affinity_masks(unsigned int nvec, struct irq_affinity *affd);
318345
319−int irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd);
346+unsigned int irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
347+ const struct irq_affinity *affd);
320348
321349 #else /* CONFIG_SMP */
322350
@@ -350,13 +378,14 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) · 27 unmodified lines
350378 }
351379
352380 static inline struct irq_affinity_desc *
353−irq_create_affinity_masks(int nvec, const struct irq_affinity *affd)
381+irq_create_affinity_masks(unsigned int nvec, struct irq_affinity *affd)
354382 {
355383 return NULL;
356384 }
357385
358−static inline int
359−irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd)
386+static inline unsigned int
387+irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
388+ const struct irq_affinity *affd)
360389 {
361390 return maxvec;
362391 }
include/linux/irq.h+10−0
@@ -442,6 +442,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) · 441 unmodified lines
442442 * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine
443443 * @ipi_send_single: send a single IPI to destination cpus
444444 * @ipi_send_mask: send an IPI to destination cpus in cpumask
445+ * @irq_nmi_setup: function called from core code before enabling an NMI
446+ * @irq_nmi_teardown: function called from core code after disabling an NMI
445447 * @flags: chip specific flags
446448 */
447449 struct irq_chip {
@@ -490,6 +492,9 @@ struct irq_chip { · 42 unmodified lines
490492 void (*ipi_send_single)(struct irq_data *data, unsigned int cpu);
491493 void (*ipi_send_mask)(struct irq_data *data, const struct cpumask *dest);
492494
495+ int (*irq_nmi_setup)(struct irq_data *data);
496+ void (*irq_nmi_teardown)(struct irq_data *data);
497+
493498 unsigned long flags;
494499 };
495500
@@ -505,6 +510,7 @@ struct irq_chip { · 9 unmodified lines
505510 * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask
506511 * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode
507512 * IRQCHIP_SUPPORTS_LEVEL_MSI Chip can provide two doorbells for Level MSIs
513+ * IRQCHIP_SUPPORTS_NMI: Chip can deliver NMIs, only for root irqchips
508514 */
509515 enum {
510516 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
@@ -515,6 +521,7 @@ enum { · 4 unmodified lines
515521 IRQCHIP_ONESHOT_SAFE = (1 << 5),
516522 IRQCHIP_EOI_THREADED = (1 << 6),
517523 IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
524+ IRQCHIP_SUPPORTS_NMI = (1 << 8),
518525 };
519526
520527 #include <linux/irqdesc.h>
@@ -594,6 +601,9 @@ extern void handle_percpu_devid_irq(struct irq_desc *desc); · 73 unmodified lines
594601 extern void handle_bad_irq(struct irq_desc *desc);
595602 extern void handle_nested_irq(unsigned int irq);
596603
604+extern void handle_fasteoi_nmi(struct irq_desc *desc);
605+extern void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc);
606+
597607 extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
598608 extern int irq_chip_pm_get(struct irq_data *data);
599609 extern int irq_chip_pm_put(struct irq_data *data);
include/linux/irqdesc.h+7−0
@@ -28,6 +28,7 @@ struct pt_regs; · 27 unmodified lines
2828 * @core_internal_state__do_not_mess_with_it: core internal status information
2929 * @depth: disable-depth, for nested irq_disable() calls
3030 * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers
31+ * @tot_count: stats field for non-percpu irqs
3132 * @irq_count: stats field to detect stalled irqs
3233 * @last_unhandled: aging timer for unhandled count
3334 * @irqs_unhandled: stats field for spurious unhandled interrupts
@@ -65,6 +66,7 @@ struct irq_desc { · 31 unmodified lines
6566 unsigned int core_internal_state__do_not_mess_with_it;
6667 unsigned int depth; /* nested irq disables */
6768 unsigned int wake_depth; /* nested wake enables */
69+ unsigned int tot_count;
6870 unsigned int irq_count; /* For detecting broken IRQs */
6971 unsigned long last_unhandled; /* Aging timer for unhandled count */
7072 unsigned int irqs_unhandled;
@@ -171,6 +173,11 @@ static inline int handle_domain_irq(struct irq_domain *domain, · 100 unmodified lines
171173 {
172174 return __handle_domain_irq(domain, hwirq, true, regs);
173175 }
176+
177+#ifdef CONFIG_IRQ_DOMAIN
178+int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
179+ struct pt_regs *regs);
180+#endif
174181 #endif
175182
176183 /* Test to see if a driver has successfully requested an irq */
include/linux/irqdomain.h+1−0
@@ -265,6 +265,7 @@ extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec, · 264 unmodified lines
265265 enum irq_domain_bus_token bus_token);
266266 extern bool irq_domain_check_msi_remap(void);
267267 extern void irq_set_default_host(struct irq_domain *host);
268+extern struct irq_domain *irq_get_default_host(void);
268269 extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
269270 irq_hw_number_t hwirq, int node,
270271 const struct irq_affinity_desc *affinity);
include/linux/kthread.h+1−0
@@ -56,6 +56,7 @@ void kthread_bind_mask(struct task_struct *k, const struct cpumask *mask); · 55 unmodified lines
5656 int kthread_stop(struct task_struct *k);
5757 bool kthread_should_stop(void);
5858 bool kthread_should_park(void);
59+bool __kthread_should_park(struct task_struct *k);
5960 bool kthread_freezable_should_stop(bool *was_frozen);
6061 void *kthread_data(struct task_struct *k);
6162 void *kthread_probe_data(struct task_struct *k);
include/linux/pci.h+2−2
@@ -1393,7 +1393,7 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev, · 1392 unmodified lines
13931393 }
13941394 int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
13951395 unsigned int max_vecs, unsigned int flags,
1396− const struct irq_affinity *affd);
1396+ struct irq_affinity *affd);
13971397
13981398 void pci_free_irq_vectors(struct pci_dev *dev);
13991399 int pci_irq_vector(struct pci_dev *dev, unsigned int nr);
@@ -1419,7 +1419,7 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev, · 19 unmodified lines
14191419 static inline int
14201420 pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
14211421 unsigned int max_vecs, unsigned int flags,
1422− const struct irq_affinity *aff_desc)
1422+ struct irq_affinity *aff_desc)
14231423 {
14241424 if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq)
14251425 return 1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t