]> Pileus Git - ~andy/linux/commitdiff
iommu/amd: Add early maps for ioapic and hpet
authorJoerg Roedel <joro@8bytes.org>
Tue, 9 Apr 2013 15:53:14 +0000 (17:53 +0200)
committerJoerg Roedel <joro@8bytes.org>
Fri, 19 Apr 2013 18:50:24 +0000 (20:50 +0200)
This is needed in a later patch were ioapic_map and hpet_map
entries are created before the slab allocator is initialized
(and thus add_special_device() can't be used).

Reviewed-by: Shuah Khan <shuahkhan@gmail.com>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
drivers/iommu/amd_iommu_init.c

index 3a210f0c1b3f6031599cf1f2c4a23bbbbe38824e..2a3b1b174d5e669470ff3d493113dedb6fca241b 100644 (file)
@@ -213,6 +213,13 @@ enum iommu_init_state {
        IOMMU_INIT_ERROR,
 };
 
+/* Early ioapic and hpet maps from kernel command line */
+#define EARLY_MAP_SIZE         4
+static struct devid_map __initdata early_ioapic_map[EARLY_MAP_SIZE];
+static struct devid_map __initdata early_hpet_map[EARLY_MAP_SIZE];
+static int __initdata early_ioapic_map_size;
+static int __initdata early_hpet_map_size;
+
 static enum iommu_init_state init_state = IOMMU_START_STATE;
 
 static int amd_iommu_enable_interrupts(void);
@@ -738,6 +745,31 @@ static int __init add_special_device(u8 type, u8 id, u16 devid, bool cmd_line)
        return 0;
 }
 
+static int __init add_early_maps(void)
+{
+       int i, ret;
+
+       for (i = 0; i < early_ioapic_map_size; ++i) {
+               ret = add_special_device(IVHD_SPECIAL_IOAPIC,
+                                        early_ioapic_map[i].id,
+                                        early_ioapic_map[i].devid,
+                                        early_ioapic_map[i].cmd_line);
+               if (ret)
+                       return ret;
+       }
+
+       for (i = 0; i < early_hpet_map_size; ++i) {
+               ret = add_special_device(IVHD_SPECIAL_HPET,
+                                        early_hpet_map[i].id,
+                                        early_hpet_map[i].devid,
+                                        early_hpet_map[i].cmd_line);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
+
 /*
  * Reads the device exclusion range from ACPI and initializes the IOMMU with
  * it
@@ -774,6 +806,12 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
        u32 dev_i, ext_flags = 0;
        bool alias = false;
        struct ivhd_entry *e;
+       int ret;
+
+
+       ret = add_early_maps();
+       if (ret)
+               return ret;
 
        /*
         * First save the recommended feature enable bits from ACPI