]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
x86, AMD IOMMU: initialize device table properly
authorJoerg Roedel <joerg.roedel@amd.com>
Thu, 14 Aug 2008 17:55:16 +0000 (19:55 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 15 Aug 2008 11:56:54 +0000 (13:56 +0200)
This patch adds device table initializations which forbids memory accesses
for devices per default and disables all page faults.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/amd_iommu_init.c
include/asm-x86/amd_iommu_types.h

index d9a9da597e796cbcda869180879a7804888e70ea..ceba33811537336dd4948350fa7a8433b978463e 100644 (file)
@@ -800,6 +800,21 @@ static int __init init_memory_definitions(struct acpi_table_header *table)
        return 0;
 }
 
+/*
+ * Init the device table to not allow DMA access for devices and
+ * suppress all page faults
+ */
+static void init_device_table(void)
+{
+       u16 devid;
+
+       for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) {
+               set_dev_entry_bit(devid, DEV_ENTRY_VALID);
+               set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION);
+               set_dev_entry_bit(devid, DEV_ENTRY_NO_PAGE_FAULT);
+       }
+}
+
 /*
  * This function finally enables all IOMMUs found in the system after
  * they have been initialized
@@ -931,6 +946,9 @@ int __init amd_iommu_init(void)
        if (amd_iommu_pd_alloc_bitmap == NULL)
                goto free;
 
+       /* init the device table */
+       init_device_table();
+
        /*
         * let all alias entries point to itself
         */
index 32543229db769d5b85742394c3459301fc348599..f0beca73e36471ee295fd3e88b526cdbb4004f21 100644 (file)
 #define DEV_ENTRY_TRANSLATION   0x01
 #define DEV_ENTRY_IR            0x3d
 #define DEV_ENTRY_IW            0x3e
+#define DEV_ENTRY_NO_PAGE_FAULT        0x62
 #define DEV_ENTRY_EX            0x67
 #define DEV_ENTRY_SYSMGT1       0x68
 #define DEV_ENTRY_SYSMGT2       0x69