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 ...
Showing the changes to include/linux (6 of 30 files). Show all
Unified · Split
| @@ -156,6 +156,10 @@ __request_percpu_irq(unsigned int irq, irq_handler_t handler, · 155 unmodified lines | ||
| 156 | 156 | unsigned long flags, const char *devname, |
| 157 | 157 | void __percpu *percpu_dev_id); |
| 158 | 158 | |
| 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 | + | |
| 159 | 163 | static inline int __must_check |
| 160 | 164 | request_percpu_irq(unsigned int irq, irq_handler_t handler, |
| 161 | 165 | 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 | ||
| 164 | 168 | devname, percpu_dev_id); |
| 165 | 169 | } |
| 166 | 170 | |
| 171 | +extern int __must_check | |
| 172 | +request_percpu_nmi(unsigned int irq, irq_handler_t handler, | |
| 173 | + const char *devname, void __percpu *dev); | |
| 174 | + | |
| 167 | 175 | extern const void *free_irq(unsigned int, void *); |
| 168 | 176 | extern void free_percpu_irq(unsigned int, void __percpu *); |
| 169 | 177 | |
| 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 | + | |
| 170 | 181 | struct device; |
| 171 | 182 | |
| 172 | 183 | extern int __must_check |
| @@ -217,6 +228,13 @@ extern void enable_percpu_irq(unsigned int irq, unsigned int type); · 44 unmodified lines | ||
| 217 | 228 | extern bool irq_percpu_is_enabled(unsigned int irq); |
| 218 | 229 | extern void irq_wake_thread(unsigned int irq, void *dev_id); |
| 219 | 230 | |
| 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 | + | |
| 220 | 238 | /* The following three functions are for the core kernel use only. */ |
| 221 | 239 | extern void suspend_device_irqs(void); |
| 222 | 240 | extern void resume_device_irqs(void); |
| @@ -241,20 +259,29 @@ struct irq_affinity_notify { · 18 unmodified lines | ||
| 241 | 259 | void (*release)(struct kref *ref); |
| 242 | 260 | }; |
| 243 | 261 | |
| 262 | +#define IRQ_AFFINITY_MAX_SETS 4 | |
| 263 | + | |
| 244 | 264 | /** |
| 245 | 265 | * struct irq_affinity - Description for automatic irq affinity assignements |
| 246 | 266 | * @pre_vectors: Don't apply affinity to @pre_vectors at beginning of |
| 247 | 267 | * the MSI(-X) vector space |
| 248 | 268 | * @post_vectors: Don't apply affinity to @post_vectors at end of |
| 249 | 269 | * 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. | |
| 252 | 277 | */ |
| 253 | 278 | 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; | |
| 258 | 285 | }; |
| 259 | 286 | |
| 260 | 287 | /** |
| @@ -314,9 +341,10 @@ extern int · 53 unmodified lines | ||
| 314 | 341 | irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); |
| 315 | 342 | |
| 316 | 343 | 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); | |
| 318 | 345 | |
| 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); | |
| 320 | 348 | |
| 321 | 349 | #else /* CONFIG_SMP */ |
| 322 | 350 | |
| @@ -350,13 +378,14 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) · 27 unmodified lines | ||
| 350 | 378 | } |
| 351 | 379 | |
| 352 | 380 | 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) | |
| 354 | 382 | { |
| 355 | 383 | return NULL; |
| 356 | 384 | } |
| 357 | 385 | |
| 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) | |
| 360 | 389 | { |
| 361 | 390 | return maxvec; |
| 362 | 391 | } |
| @@ -442,6 +442,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) · 441 unmodified lines | ||
| 442 | 442 | * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine |
| 443 | 443 | * @ipi_send_single: send a single IPI to destination cpus |
| 444 | 444 | * @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 | |
| 445 | 447 | * @flags: chip specific flags |
| 446 | 448 | */ |
| 447 | 449 | struct irq_chip { |
| @@ -490,6 +492,9 @@ struct irq_chip { · 42 unmodified lines | ||
| 490 | 492 | void (*ipi_send_single)(struct irq_data *data, unsigned int cpu); |
| 491 | 493 | void (*ipi_send_mask)(struct irq_data *data, const struct cpumask *dest); |
| 492 | 494 | |
| 495 | + int (*irq_nmi_setup)(struct irq_data *data); | |
| 496 | + void (*irq_nmi_teardown)(struct irq_data *data); | |
| 497 | + | |
| 493 | 498 | unsigned long flags; |
| 494 | 499 | }; |
| 495 | 500 | |
| @@ -505,6 +510,7 @@ struct irq_chip { · 9 unmodified lines | ||
| 505 | 510 | * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask |
| 506 | 511 | * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode |
| 507 | 512 | * IRQCHIP_SUPPORTS_LEVEL_MSI Chip can provide two doorbells for Level MSIs |
| 513 | + * IRQCHIP_SUPPORTS_NMI: Chip can deliver NMIs, only for root irqchips | |
| 508 | 514 | */ |
| 509 | 515 | enum { |
| 510 | 516 | IRQCHIP_SET_TYPE_MASKED = (1 << 0), |
| @@ -515,6 +521,7 @@ enum { · 4 unmodified lines | ||
| 515 | 521 | IRQCHIP_ONESHOT_SAFE = (1 << 5), |
| 516 | 522 | IRQCHIP_EOI_THREADED = (1 << 6), |
| 517 | 523 | IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7), |
| 524 | + IRQCHIP_SUPPORTS_NMI = (1 << 8), | |
| 518 | 525 | }; |
| 519 | 526 | |
| 520 | 527 | #include <linux/irqdesc.h> |
| @@ -594,6 +601,9 @@ extern void handle_percpu_devid_irq(struct irq_desc *desc); · 73 unmodified lines | ||
| 594 | 601 | extern void handle_bad_irq(struct irq_desc *desc); |
| 595 | 602 | extern void handle_nested_irq(unsigned int irq); |
| 596 | 603 | |
| 604 | +extern void handle_fasteoi_nmi(struct irq_desc *desc); | |
| 605 | +extern void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc); | |
| 606 | + | |
| 597 | 607 | extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg); |
| 598 | 608 | extern int irq_chip_pm_get(struct irq_data *data); |
| 599 | 609 | extern int irq_chip_pm_put(struct irq_data *data); |
| @@ -28,6 +28,7 @@ struct pt_regs; · 27 unmodified lines | ||
| 28 | 28 | * @core_internal_state__do_not_mess_with_it: core internal status information |
| 29 | 29 | * @depth: disable-depth, for nested irq_disable() calls |
| 30 | 30 | * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers |
| 31 | + * @tot_count: stats field for non-percpu irqs | |
| 31 | 32 | * @irq_count: stats field to detect stalled irqs |
| 32 | 33 | * @last_unhandled: aging timer for unhandled count |
| 33 | 34 | * @irqs_unhandled: stats field for spurious unhandled interrupts |
| @@ -65,6 +66,7 @@ struct irq_desc { · 31 unmodified lines | ||
| 65 | 66 | unsigned int core_internal_state__do_not_mess_with_it; |
| 66 | 67 | unsigned int depth; /* nested irq disables */ |
| 67 | 68 | unsigned int wake_depth; /* nested wake enables */ |
| 69 | + unsigned int tot_count; | |
| 68 | 70 | unsigned int irq_count; /* For detecting broken IRQs */ |
| 69 | 71 | unsigned long last_unhandled; /* Aging timer for unhandled count */ |
| 70 | 72 | unsigned int irqs_unhandled; |
| @@ -171,6 +173,11 @@ static inline int handle_domain_irq(struct irq_domain *domain, · 100 unmodified lines | ||
| 171 | 173 | { |
| 172 | 174 | return __handle_domain_irq(domain, hwirq, true, regs); |
| 173 | 175 | } |
| 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 | |
| 174 | 181 | #endif |
| 175 | 182 | |
| 176 | 183 | /* Test to see if a driver has successfully requested an irq */ |
| @@ -265,6 +265,7 @@ extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec, · 264 unmodified lines | ||
| 265 | 265 | enum irq_domain_bus_token bus_token); |
| 266 | 266 | extern bool irq_domain_check_msi_remap(void); |
| 267 | 267 | extern void irq_set_default_host(struct irq_domain *host); |
| 268 | +extern struct irq_domain *irq_get_default_host(void); | |
| 268 | 269 | extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs, |
| 269 | 270 | irq_hw_number_t hwirq, int node, |
| 270 | 271 | const struct irq_affinity_desc *affinity); |
| @@ -56,6 +56,7 @@ void kthread_bind_mask(struct task_struct *k, const struct cpumask *mask); · 55 unmodified lines | ||
| 56 | 56 | int kthread_stop(struct task_struct *k); |
| 57 | 57 | bool kthread_should_stop(void); |
| 58 | 58 | bool kthread_should_park(void); |
| 59 | +bool __kthread_should_park(struct task_struct *k); | |
| 59 | 60 | bool kthread_freezable_should_stop(bool *was_frozen); |
| 60 | 61 | void *kthread_data(struct task_struct *k); |
| 61 | 62 | void *kthread_probe_data(struct task_struct *k); |
| @@ -1393,7 +1393,7 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev, · 1392 unmodified lines | ||
| 1393 | 1393 | } |
| 1394 | 1394 | int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, |
| 1395 | 1395 | unsigned int max_vecs, unsigned int flags, |
| 1396 | − const struct irq_affinity *affd); | |
| 1396 | + struct irq_affinity *affd); | |
| 1397 | 1397 | |
| 1398 | 1398 | void pci_free_irq_vectors(struct pci_dev *dev); |
| 1399 | 1399 | 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 | ||
| 1419 | 1419 | static inline int |
| 1420 | 1420 | pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, |
| 1421 | 1421 | unsigned int max_vecs, unsigned int flags, |
| 1422 | − const struct irq_affinity *aff_desc) | |
| 1422 | + struct irq_affinity *aff_desc) | |
| 1423 | 1423 | { |
| 1424 | 1424 | if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq) |
| 1425 | 1425 | return 1; |