aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-08-14 13:55:16 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-15 07:56:54 -0400
commit9f5f5fb35d2934fe7dc0cb019854a030efd10cd7 (patch)
tree061412d890a702fddb46ac259080a963dce939f4
parent519c31bacf78a969efa8d2e55ed8862848f28590 (diff)
x86, AMD IOMMU: initialize device table properly
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>
-rw-r--r--arch/x86/kernel/amd_iommu_init.c18
-rw-r--r--include/asm-x86/amd_iommu_types.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index d9a9da597e79..ceba33811537 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -801,6 +801,21 @@ static int __init init_memory_definitions(struct acpi_table_header *table)
801} 801}
802 802
803/* 803/*
804 * Init the device table to not allow DMA access for devices and
805 * suppress all page faults
806 */
807static void init_device_table(void)
808{
809 u16 devid;
810
811 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) {
812 set_dev_entry_bit(devid, DEV_ENTRY_VALID);
813 set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION);
814 set_dev_entry_bit(devid, DEV_ENTRY_NO_PAGE_FAULT);
815 }
816}
817
818/*
804 * This function finally enables all IOMMUs found in the system after 819 * This function finally enables all IOMMUs found in the system after
805 * they have been initialized 820 * they have been initialized
806 */ 821 */
@@ -931,6 +946,9 @@ int __init amd_iommu_init(void)
931 if (amd_iommu_pd_alloc_bitmap == NULL) 946 if (amd_iommu_pd_alloc_bitmap == NULL)
932 goto free; 947 goto free;
933 948
949 /* init the device table */
950 init_device_table();
951
934 /* 952 /*
935 * let all alias entries point to itself 953 * let all alias entries point to itself
936 */ 954 */
diff --git a/include/asm-x86/amd_iommu_types.h b/include/asm-x86/amd_iommu_types.h
index 32543229db76..f0beca73e364 100644
--- a/include/asm-x86/amd_iommu_types.h
+++ b/include/asm-x86/amd_iommu_types.h
@@ -103,6 +103,7 @@
103#define DEV_ENTRY_TRANSLATION 0x01 103#define DEV_ENTRY_TRANSLATION 0x01
104#define DEV_ENTRY_IR 0x3d 104#define DEV_ENTRY_IR 0x3d
105#define DEV_ENTRY_IW 0x3e 105#define DEV_ENTRY_IW 0x3e
106#define DEV_ENTRY_NO_PAGE_FAULT 0x62
106#define DEV_ENTRY_EX 0x67 107#define DEV_ENTRY_EX 0x67
107#define DEV_ENTRY_SYSMGT1 0x68 108#define DEV_ENTRY_SYSMGT1 0x68
108#define DEV_ENTRY_SYSMGT2 0x69 109#define DEV_ENTRY_SYSMGT2 0x69