[patch 12/32] iommu: dmar: Provide arch specific irq allocation

From: Thomas Gleixner
Date: Wed May 07 2014 - 11:52:48 EST


ia64 and x86 share this driver. x86 is moving to a different irq
allocation and ia64 keeps its private irq_create/destroy stuff.

Use macros to redirect to one or the other. Yes, macros to avoid
include hell.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Fenghua Yu <fenghua.yu@xxxxxxxxx>
Cc: linux-ia64@xxxxxxxxxxxxxxx
Cc: Joerg Roedel <joro@xxxxxxxxxx>
Cc: iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
---
arch/ia64/include/asm/irq_remapping.h | 2 ++
arch/x86/include/asm/irq_remapping.h | 3 +++
drivers/iommu/dmar.c | 6 +++---
3 files changed, 8 insertions(+), 3 deletions(-)

Index: tip/arch/ia64/include/asm/irq_remapping.h
===================================================================
--- tip.orig/arch/ia64/include/asm/irq_remapping.h
+++ tip/arch/ia64/include/asm/irq_remapping.h
@@ -1,4 +1,6 @@
#ifndef __IA64_INTR_REMAPPING_H
#define __IA64_INTR_REMAPPING_H
#define irq_remapping_enabled 0
+#define dmar_alloc_hwirq create_irq
+#define dmar_free_hwirq destroy_irq
#endif
Index: tip/arch/x86/include/asm/irq_remapping.h
===================================================================
--- tip.orig/arch/x86/include/asm/irq_remapping.h
+++ tip/arch/x86/include/asm/irq_remapping.h
@@ -58,6 +58,9 @@ extern bool setup_remapped_irq(int irq,

void irq_remap_modify_chip_defaults(struct irq_chip *chip);

+#define dmar_alloc_hwirq() irq_alloc_hwirq(-1)
+#define dmar_free_hwirq irq_free_hwirq
+
#else /* CONFIG_IRQ_REMAP */

static inline void setup_irq_remapping_ops(void) { }
Index: tip/drivers/iommu/dmar.c
===================================================================
--- tip.orig/drivers/iommu/dmar.c
+++ tip/drivers/iommu/dmar.c
@@ -994,7 +994,7 @@ static void free_iommu(struct intel_iomm
if (iommu->irq) {
free_irq(iommu->irq, iommu);
irq_set_handler_data(iommu->irq, NULL);
- destroy_irq(iommu->irq);
+ dmar_free_hwirq(iommu->irq);
}

if (iommu->qi) {
@@ -1550,7 +1550,7 @@ int dmar_set_interrupt(struct intel_iomm
if (iommu->irq)
return 0;

- irq = create_irq();
+ irq = dmar_alloc_hwirq();
if (irq <= 0) {
pr_err("IOMMU: no free vectors\n");
return -EINVAL;
@@ -1563,7 +1563,7 @@ int dmar_set_interrupt(struct intel_iomm
if (ret) {
irq_set_handler_data(irq, NULL);
iommu->irq = 0;
- destroy_irq(irq);
+ dmar_free_hwirq(irq);
return ret;
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/