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
156 unsigned long flags, const char *devname,156 unsigned long flags, const char *devname,
157 void __percpu *percpu_dev_id);157 void __percpu *percpu_dev_id);
158 158
159extern int __must_check
160request_nmi(unsigned int irq, irq_handler_t handler, unsigned long flags,
161 const char *name, void *dev);
162
159static inline int __must_check163static inline int __must_check
160request_percpu_irq(unsigned int irq, irq_handler_t handler,164request_percpu_irq(unsigned int irq, irq_handler_t handler,
161 const char *devname, void __percpu *percpu_dev_id)165 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
167extern const void *free_irq(unsigned int, void *);171extern const void *free_irq(unsigned int, void *);
168extern void free_percpu_irq(unsigned int, void __percpu *);172extern void free_percpu_irq(unsigned int, void __percpu *);
169 173
174extern const void *free_nmi(unsigned int irq, void *dev_id);
175
170struct device;176struct device;
171 177
172extern int __must_check178extern int __must_check
@@ -217,6 +223,9 @@ extern void enable_percpu_irq(unsigned int irq, unsigned int type); · 44 unmodified lines
217extern bool irq_percpu_is_enabled(unsigned int irq);223extern bool irq_percpu_is_enabled(unsigned int irq);
218extern void irq_wake_thread(unsigned int irq, void *dev_id);224extern void irq_wake_thread(unsigned int irq, void *dev_id);
219 225
226extern void disable_nmi_nosync(unsigned int irq);
227extern void enable_nmi(unsigned int irq);
228
220/* The following three functions are for the core kernel use only. */229/* The following three functions are for the core kernel use only. */
221extern void suspend_device_irqs(void);230extern void suspend_device_irqs(void);
222extern void resume_device_irqs(void);231extern 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
442 * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine442 * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine
443 * @ipi_send_single: send a single IPI to destination cpus443 * @ipi_send_single: send a single IPI to destination cpus
444 * @ipi_send_mask: send an IPI to destination cpus in cpumask444 * @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 * @flags: chip specific flags447 * @flags: chip specific flags
446 */448 */
447struct irq_chip {449struct irq_chip {
@@ -490,6 +492,9 @@ struct irq_chip { · 42 unmodified lines
490 void (*ipi_send_single)(struct irq_data *data, unsigned int cpu);492 void (*ipi_send_single)(struct irq_data *data, unsigned int cpu);
491 void (*ipi_send_mask)(struct irq_data *data, const struct cpumask *dest);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 unsigned long flags;498 unsigned long flags;
494};499};
495 500
@@ -505,6 +510,7 @@ struct irq_chip { · 9 unmodified lines
505 * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask510 * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask
506 * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode511 * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode
507 * IRQCHIP_SUPPORTS_LEVEL_MSI Chip can provide two doorbells for Level MSIs512 * 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 */
509enum {515enum {
510 IRQCHIP_SET_TYPE_MASKED = (1 << 0),516 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
@@ -515,6 +521,7 @@ enum { · 4 unmodified lines
515 IRQCHIP_ONESHOT_SAFE = (1 << 5),521 IRQCHIP_ONESHOT_SAFE = (1 << 5),
516 IRQCHIP_EOI_THREADED = (1 << 6),522 IRQCHIP_EOI_THREADED = (1 << 6),
517 IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),523 IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
524 IRQCHIP_SUPPORTS_NMI = (1 << 8),
518};525};
519 526
520#include <linux/irqdesc.h>527#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