summaryrefslogtreecommitdiff
path: root/drivers/iommu/intel_intr_remapping.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-03-30 11:47:00 -0700
committerJoerg Roedel <joerg.roedel@amd.com>2012-05-07 14:34:59 +0200
commit736baef4472d00574089f295bc759ac002b9558c (patch)
treed4c9c69b1a0eecd6d87b3378a27396384e4b08f0 /drivers/iommu/intel_intr_remapping.c
parenteef93fdb7cd41ae36794db0e765059dc1039e940 (diff)
downloadlwn-736baef4472d00574089f295bc759ac002b9558c.tar.gz
lwn-736baef4472d00574089f295bc759ac002b9558c.zip
iommu/vt-d: Make intr-remapping initialization generic
This patch introduces irq_remap_ops to hold implementation specific function pointer to handle interrupt remapping. As the first part the initialization functions for VT-d are converted to these ops. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/intel_intr_remapping.c')
-rw-r--r--drivers/iommu/intel_intr_remapping.c52
1 files changed, 12 insertions, 40 deletions
diff --git a/drivers/iommu/intel_intr_remapping.c b/drivers/iommu/intel_intr_remapping.c
index 212fff0c24b5..9c742fb111b6 100644
--- a/drivers/iommu/intel_intr_remapping.c
+++ b/drivers/iommu/intel_intr_remapping.c
@@ -11,8 +11,11 @@
#include <asm/cpu.h>
#include <linux/intel-iommu.h>
#include <acpi/acpi.h>
+#include <asm/intr_remapping.h>
#include <asm/pci-direct.h>
+#include "intr_remapping.h"
+
struct ioapic_scope {
struct intel_iommu *iommu;
unsigned int id;
@@ -32,42 +35,6 @@ struct hpet_scope {
static struct ioapic_scope ir_ioapic[MAX_IO_APICS];
static struct hpet_scope ir_hpet[MAX_HPET_TBS];
static int ir_ioapic_num, ir_hpet_num;
-int intr_remapping_enabled;
-
-static int disable_intremap;
-static int disable_sourceid_checking;
-static int no_x2apic_optout;
-
-static __init int setup_nointremap(char *str)
-{
- disable_intremap = 1;
- return 0;
-}
-early_param("nointremap", setup_nointremap);
-
-static __init int setup_intremap(char *str)
-{
- if (!str)
- return -EINVAL;
-
- while (*str) {
- if (!strncmp(str, "on", 2))
- disable_intremap = 0;
- else if (!strncmp(str, "off", 3))
- disable_intremap = 1;
- else if (!strncmp(str, "nosid", 5))
- disable_sourceid_checking = 1;
- else if (!strncmp(str, "no_x2apic_optout", 16))
- no_x2apic_optout = 1;
-
- str += strcspn(str, ",");
- while (*str == ',')
- str++;
- }
-
- return 0;
-}
-early_param("intremap", setup_intremap);
static DEFINE_RAW_SPINLOCK(irq_2_ir_lock);
@@ -465,7 +432,7 @@ static void iommu_set_intr_remapping(struct intel_iommu *iommu, int mode)
}
-static int setup_intr_remapping(struct intel_iommu *iommu, int mode)
+static int intel_setup_intr_remapping(struct intel_iommu *iommu, int mode)
{
struct ir_table *ir_table;
struct page *pages;
@@ -534,7 +501,7 @@ static int __init dmar_x2apic_optout(void)
return dmar->flags & DMAR_X2APIC_OPT_OUT;
}
-int __init intr_remapping_supported(void)
+static int __init intel_intr_remapping_supported(void)
{
struct dmar_drhd_unit *drhd;
@@ -554,7 +521,7 @@ int __init intr_remapping_supported(void)
return 1;
}
-int __init enable_intr_remapping(void)
+static int __init intel_enable_intr_remapping(void)
{
struct dmar_drhd_unit *drhd;
int setup = 0;
@@ -638,7 +605,7 @@ int __init enable_intr_remapping(void)
if (!ecap_ir_support(iommu->ecap))
continue;
- if (setup_intr_remapping(iommu, eim))
+ if (intel_setup_intr_remapping(iommu, eim))
goto error;
setup = 1;
@@ -847,3 +814,8 @@ error:
return -1;
}
+struct irq_remap_ops intel_irq_remap_ops = {
+ .supported = intel_intr_remapping_supported,
+ .hardware_init = dmar_table_init,
+ .hardware_enable = intel_enable_intr_remapping,
+};