aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joro@8bytes.org>2013-04-09 11:53:14 -0400
committerJoerg Roedel <joro@8bytes.org>2013-04-19 14:50:24 -0400
commit235dacbc795bb7ccf69db8ad9ff1587314cf857d (patch)
tree4b0379069161fbd0bb012bf18fe341fb0f710b3d /drivers/iommu
parent31cff67f6b00456cac8890e8fd97694cadc754b8 (diff)
iommu/amd: Add early maps for ioapic and hpet
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>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu_init.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 3a210f0c1b3f..2a3b1b174d5e 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -213,6 +213,13 @@ enum iommu_init_state {
213 IOMMU_INIT_ERROR, 213 IOMMU_INIT_ERROR,
214}; 214};
215 215
216/* Early ioapic and hpet maps from kernel command line */
217#define EARLY_MAP_SIZE 4
218static struct devid_map __initdata early_ioapic_map[EARLY_MAP_SIZE];
219static struct devid_map __initdata early_hpet_map[EARLY_MAP_SIZE];
220static int __initdata early_ioapic_map_size;
221static int __initdata early_hpet_map_size;
222
216static enum iommu_init_state init_state = IOMMU_START_STATE; 223static enum iommu_init_state init_state = IOMMU_START_STATE;
217 224
218static int amd_iommu_enable_interrupts(void); 225static 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)
738 return 0; 745 return 0;
739} 746}
740 747
748static int __init add_early_maps(void)
749{
750 int i, ret;
751
752 for (i = 0; i < early_ioapic_map_size; ++i) {
753 ret = add_special_device(IVHD_SPECIAL_IOAPIC,
754 early_ioapic_map[i].id,
755 early_ioapic_map[i].devid,
756 early_ioapic_map[i].cmd_line);
757 if (ret)
758 return ret;
759 }
760
761 for (i = 0; i < early_hpet_map_size; ++i) {
762 ret = add_special_device(IVHD_SPECIAL_HPET,
763 early_hpet_map[i].id,
764 early_hpet_map[i].devid,
765 early_hpet_map[i].cmd_line);
766 if (ret)
767 return ret;
768 }
769
770 return 0;
771}
772
741/* 773/*
742 * Reads the device exclusion range from ACPI and initializes the IOMMU with 774 * Reads the device exclusion range from ACPI and initializes the IOMMU with
743 * it 775 * it
@@ -774,6 +806,12 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
774 u32 dev_i, ext_flags = 0; 806 u32 dev_i, ext_flags = 0;
775 bool alias = false; 807 bool alias = false;
776 struct ivhd_entry *e; 808 struct ivhd_entry *e;
809 int ret;
810
811
812 ret = add_early_maps();
813 if (ret)
814 return ret;
777 815
778 /* 816 /*
779 * First save the recommended feature enable bits from ACPI 817 * First save the recommended feature enable bits from ACPI