summaryrefslogtreecommitdiff
path: root/drivers/iommu/amd_iommu_init.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-06-15 18:05:20 +0200
committerJoerg Roedel <joerg.roedel@amd.com>2012-09-28 17:30:04 +0200
commit0ea2c422bc8da99d14baa46d4789861a4f8d4ec0 (patch)
treeda722904779083287e209324b77d9b80235d2348 /drivers/iommu/amd_iommu_init.c
parent05152a0494449f60031da683e6d4cd60d0882214 (diff)
iommu/amd: Allocate data structures to keep track of irq remapping tables
To easily map device ids to interrupt remapping table entries a new lookup table is necessary. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
-rw-r--r--drivers/iommu/amd_iommu_init.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 073ed5d1e053..2d923fe7c2a1 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -184,6 +184,12 @@ u16 *amd_iommu_alias_table;
struct amd_iommu **amd_iommu_rlookup_table;
/*
+ * This table is used to find the irq remapping table for a given device id
+ * quickly.
+ */
+struct irq_remap_table **irq_lookup_table;
+
+/*
* AMD IOMMU allows up to 2^16 differend protection domains. This is a bitmap
* to know which ones are already in use.
*/
@@ -1532,9 +1538,13 @@ static struct syscore_ops amd_iommu_syscore_ops = {
static void __init free_on_init_error(void)
{
+ free_pages((unsigned long)irq_lookup_table,
+ get_order(rlookup_table_size));
+
if (amd_iommu_irq_cache) {
kmem_cache_destroy(amd_iommu_irq_cache);
amd_iommu_irq_cache = NULL;
+
}
amd_iommu_uninit_devices();
@@ -1687,6 +1697,12 @@ static int __init early_amd_iommu_init(void)
0, NULL);
if (!amd_iommu_irq_cache)
goto out;
+
+ irq_lookup_table = (void *)__get_free_pages(
+ GFP_KERNEL | __GFP_ZERO,
+ get_order(rlookup_table_size));
+ if (!irq_lookup_table)
+ goto out;
}
ret = init_memory_definitions(ivrs_base);