diff options
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 0c247032308e..2efc3d59b7e6 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -890,7 +890,7 @@ int __init amd_iommu_init(void) | |||
890 | ret = -ENOMEM; | 890 | ret = -ENOMEM; |
891 | 891 | ||
892 | /* Device table - directly used by all IOMMUs */ | 892 | /* Device table - directly used by all IOMMUs */ |
893 | amd_iommu_dev_table = (void *)__get_free_pages(GFP_KERNEL, | 893 | amd_iommu_dev_table = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
894 | get_order(dev_table_size)); | 894 | get_order(dev_table_size)); |
895 | if (amd_iommu_dev_table == NULL) | 895 | if (amd_iommu_dev_table == NULL) |
896 | goto out; | 896 | goto out; |
@@ -914,27 +914,23 @@ int __init amd_iommu_init(void) | |||
914 | * Protection Domain table - maps devices to protection domains | 914 | * Protection Domain table - maps devices to protection domains |
915 | * This table has the same size as the rlookup_table | 915 | * This table has the same size as the rlookup_table |
916 | */ | 916 | */ |
917 | amd_iommu_pd_table = (void *)__get_free_pages(GFP_KERNEL, | 917 | amd_iommu_pd_table = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
918 | get_order(rlookup_table_size)); | 918 | get_order(rlookup_table_size)); |
919 | if (amd_iommu_pd_table == NULL) | 919 | if (amd_iommu_pd_table == NULL) |
920 | goto free; | 920 | goto free; |
921 | 921 | ||
922 | amd_iommu_pd_alloc_bitmap = (void *)__get_free_pages(GFP_KERNEL, | 922 | amd_iommu_pd_alloc_bitmap = (void *)__get_free_pages( |
923 | GFP_KERNEL | __GFP_ZERO, | ||
923 | get_order(MAX_DOMAIN_ID/8)); | 924 | get_order(MAX_DOMAIN_ID/8)); |
924 | if (amd_iommu_pd_alloc_bitmap == NULL) | 925 | if (amd_iommu_pd_alloc_bitmap == NULL) |
925 | goto free; | 926 | goto free; |
926 | 927 | ||
927 | /* | 928 | /* |
928 | * memory is allocated now; initialize the device table with all zeroes | 929 | * let all alias entries point to itself |
929 | * and let all alias entries point to itself | ||
930 | */ | 930 | */ |
931 | memset(amd_iommu_dev_table, 0, dev_table_size); | ||
932 | for (i = 0; i < amd_iommu_last_bdf; ++i) | 931 | for (i = 0; i < amd_iommu_last_bdf; ++i) |
933 | amd_iommu_alias_table[i] = i; | 932 | amd_iommu_alias_table[i] = i; |
934 | 933 | ||
935 | memset(amd_iommu_pd_table, 0, rlookup_table_size); | ||
936 | memset(amd_iommu_pd_alloc_bitmap, 0, MAX_DOMAIN_ID / 8); | ||
937 | |||
938 | /* | 934 | /* |
939 | * never allocate domain 0 because its used as the non-allocated and | 935 | * never allocate domain 0 because its used as the non-allocated and |
940 | * error value placeholder | 936 | * error value placeholder |