aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-03-15 07:46:40 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2012-03-15 07:46:40 -0400
commit474d567db3d459d08ed0e683f4ace9b00ac2aa4b (patch)
tree113b7f0cde335f43aadfd0f0861d544b14103bf2 /drivers/iommu
parent525b233c7188069a360a898493d9b51ee8adec35 (diff)
iommu/amd: Don't initialize IOMMUv2 resources when not required
Add a check to the init-path of the AMD IOMMUv2 driver if the hardware is available in the system. Only allocate all the resources if it is really available. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu_v2.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 8add9f125d3e..036fe9bf157e 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -921,7 +921,16 @@ static int __init amd_iommu_v2_init(void)
921 size_t state_table_size; 921 size_t state_table_size;
922 int ret; 922 int ret;
923 923
924 pr_info("AMD IOMMUv2 driver by Joerg Roedel <joerg.roedel@amd.com>"); 924 pr_info("AMD IOMMUv2 driver by Joerg Roedel <joerg.roedel@amd.com>\n");
925
926 if (!amd_iommu_v2_supported()) {
927 pr_info("AMD IOMMUv2 functionality not available on this sytem\n");
928 /*
929 * Load anyway to provide the symbols to other modules
930 * which may use AMD IOMMUv2 optionally.
931 */
932 return 0;
933 }
925 934
926 spin_lock_init(&state_lock); 935 spin_lock_init(&state_lock);
927 936
@@ -961,6 +970,9 @@ static void __exit amd_iommu_v2_exit(void)
961 size_t state_table_size; 970 size_t state_table_size;
962 int i; 971 int i;
963 972
973 if (!amd_iommu_v2_supported())
974 return;
975
964 profile_event_unregister(PROFILE_TASK_EXIT, &profile_nb); 976 profile_event_unregister(PROFILE_TASK_EXIT, &profile_nb);
965 amd_iommu_unregister_ppr_notifier(&ppr_nb); 977 amd_iommu_unregister_ppr_notifier(&ppr_nb);
966 978