The flag X86_IRQ_ALLOC_AS_NMI indicates to the interrupt controller that it should configure the delivery mode of an IRQ as NMI. Implement such request. This causes irq_domain children in the hierarchy to configure their irq_chips accordingly. When no specific delivery mode is requested, continue using the delivery mode of the APIC driver in use.
Cc: Andi Kleen <[email protected]> Cc: "Ravi V. Shankar" <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Suggested-by: Thomas Gleixner <[email protected]> Reviewed-by: Tony Luck <[email protected]> Signed-off-by: Ricardo Neri <[email protected]> --- Changes since v5: * Introduced this patch. Changes since v4: * N/A Changes since v3: * N/A Changes since v2: * N/A Changes since v1: * N/A --- arch/x86/kernel/apic/vector.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 11f881f45cec..df4d7b9f6e27 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -570,6 +570,10 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq, if ((info->flags & X86_IRQ_ALLOC_CONTIGUOUS_VECTORS) && nr_irqs > 1) return -ENOSYS; + /* Only one IRQ per NMI */ + if ((info->flags & X86_IRQ_ALLOC_AS_NMI) && nr_irqs != 1) + return -EINVAL; + /* * Catch any attempt to touch the cascade interrupt on a PIC * equipped system. @@ -610,7 +614,15 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq, * default delivery mode of the APIC. Children irq domains * may take the delivery mode from the individual irq * configuration rather than from the APIC driver. + * + * Vectors are meaningless if the delivery mode is NMI. Since + * nr_irqs is 1, we can return. */ + if (info->flags & X86_IRQ_ALLOC_AS_NMI) { + apicd->hw_irq_cfg.delivery_mode = APIC_DELIVERY_MODE_NMI; + return 0; + } + apicd->hw_irq_cfg.delivery_mode = apic->delivery_mode; /* -- 2.17.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
