diff options
-rw-r--r-- | drivers/iommu/intel-iommu.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 5d7383775bf1..0ba078bc0f32 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1389,7 +1389,7 @@ static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu) | |||
1389 | raw_spin_unlock_irqrestore(&iommu->register_lock, flags); | 1389 | raw_spin_unlock_irqrestore(&iommu->register_lock, flags); |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | static int iommu_enable_translation(struct intel_iommu *iommu) | 1392 | static void iommu_enable_translation(struct intel_iommu *iommu) |
1393 | { | 1393 | { |
1394 | u32 sts; | 1394 | u32 sts; |
1395 | unsigned long flags; | 1395 | unsigned long flags; |
@@ -1403,10 +1403,9 @@ static int iommu_enable_translation(struct intel_iommu *iommu) | |||
1403 | readl, (sts & DMA_GSTS_TES), sts); | 1403 | readl, (sts & DMA_GSTS_TES), sts); |
1404 | 1404 | ||
1405 | raw_spin_unlock_irqrestore(&iommu->register_lock, flags); | 1405 | raw_spin_unlock_irqrestore(&iommu->register_lock, flags); |
1406 | return 0; | ||
1407 | } | 1406 | } |
1408 | 1407 | ||
1409 | static int iommu_disable_translation(struct intel_iommu *iommu) | 1408 | static void iommu_disable_translation(struct intel_iommu *iommu) |
1410 | { | 1409 | { |
1411 | u32 sts; | 1410 | u32 sts; |
1412 | unsigned long flag; | 1411 | unsigned long flag; |
@@ -1420,7 +1419,6 @@ static int iommu_disable_translation(struct intel_iommu *iommu) | |||
1420 | readl, (!(sts & DMA_GSTS_TES)), sts); | 1419 | readl, (!(sts & DMA_GSTS_TES)), sts); |
1421 | 1420 | ||
1422 | raw_spin_unlock_irqrestore(&iommu->register_lock, flag); | 1421 | raw_spin_unlock_irqrestore(&iommu->register_lock, flag); |
1423 | return 0; | ||
1424 | } | 1422 | } |
1425 | 1423 | ||
1426 | 1424 | ||
@@ -2860,11 +2858,7 @@ static int __init init_dmars(void) | |||
2860 | 2858 | ||
2861 | iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL); | 2859 | iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL); |
2862 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH); | 2860 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH); |
2863 | 2861 | iommu_enable_translation(iommu); | |
2864 | ret = iommu_enable_translation(iommu); | ||
2865 | if (ret) | ||
2866 | goto free_iommu; | ||
2867 | |||
2868 | iommu_disable_protect_mem_regions(iommu); | 2862 | iommu_disable_protect_mem_regions(iommu); |
2869 | } | 2863 | } |
2870 | 2864 | ||
@@ -3578,10 +3572,8 @@ static int init_iommu_hw(void) | |||
3578 | 3572 | ||
3579 | iommu->flush.flush_context(iommu, 0, 0, 0, | 3573 | iommu->flush.flush_context(iommu, 0, 0, 0, |
3580 | DMA_CCMD_GLOBAL_INVL); | 3574 | DMA_CCMD_GLOBAL_INVL); |
3581 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, | 3575 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH); |
3582 | DMA_TLB_GLOBAL_FLUSH); | 3576 | iommu_enable_translation(iommu); |
3583 | if (iommu_enable_translation(iommu)) | ||
3584 | return 1; | ||
3585 | iommu_disable_protect_mem_regions(iommu); | 3577 | iommu_disable_protect_mem_regions(iommu); |
3586 | } | 3578 | } |
3587 | 3579 | ||