History

genirq: Provide basic NMI management for interrupt lines

Add functionality to allocate interrupt lines that will deliver IRQs as Non-Maskable Interrupts. These allocations are only successful if the irqchip provides the necessary support and allows NMI delivery for the interrupt line. Interrupt lines allocated for NMI delivery must be enabled/disabled through enable_nmi/disable_nmi_nosync to keep their state consistent. To treat a PERCPU IRQ as NMI, the interrupt must not be shared nor threaded, the irqchip directly managing the IRQ must be the root irqchip and the irqchip cannot be behind a slow bus.

Julien Thierry committed 7 years ago

Commit b5259031 parent 49a57855 files · +249 −3Browse files

Showing the changes to include/linux (2 of 5 files). Show all

Unified · Split

2 files
  1. include/linux/interrupt.h +9 −0
  2. include/linux/irq.h +7 −0
include/linux/interrupt.h+9−0
@@ -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)
@@ -167,6 +171,8 @@ request_percpu_irq(unsigned int irq, irq_handler_t handler, · 5 unmodified lines
167171 extern const void *free_irq(unsigned int, void *);
168172 extern void free_percpu_irq(unsigned int, void __percpu *);
169173
174+extern const void *free_nmi(unsigned int irq, void *dev_id);
175+
170176 struct device;
171177
172178 extern int __must_check
@@ -217,6 +223,9 @@ extern void enable_percpu_irq(unsigned int irq, unsigned int type); · 44 unmodified lines
217223 extern bool irq_percpu_is_enabled(unsigned int irq);
218224 extern void irq_wake_thread(unsigned int irq, void *dev_id);
219225
226+extern void disable_nmi_nosync(unsigned int irq);
227+extern void enable_nmi(unsigned int irq);
228+
220229 /* The following three functions are for the core kernel use only. */
221230 extern void suspend_device_irqs(void);
222231 extern void resume_device_irqs(void);
include/linux/irq.h+7−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>

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