diff options
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r-- | drivers/pci/intel-iommu.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 2e2c7406131d..bc99b1e47fbc 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -819,7 +819,7 @@ static int iommu_alloc_root_entry(struct intel_iommu *iommu) | |||
819 | static void iommu_set_root_entry(struct intel_iommu *iommu) | 819 | static void iommu_set_root_entry(struct intel_iommu *iommu) |
820 | { | 820 | { |
821 | void *addr; | 821 | void *addr; |
822 | u32 cmd, sts; | 822 | u32 sts; |
823 | unsigned long flag; | 823 | unsigned long flag; |
824 | 824 | ||
825 | addr = iommu->root_entry; | 825 | addr = iommu->root_entry; |
@@ -827,12 +827,11 @@ static void iommu_set_root_entry(struct intel_iommu *iommu) | |||
827 | spin_lock_irqsave(&iommu->register_lock, flag); | 827 | spin_lock_irqsave(&iommu->register_lock, flag); |
828 | dmar_writeq(iommu->reg + DMAR_RTADDR_REG, virt_to_phys(addr)); | 828 | dmar_writeq(iommu->reg + DMAR_RTADDR_REG, virt_to_phys(addr)); |
829 | 829 | ||
830 | cmd = iommu->gcmd | DMA_GCMD_SRTP; | 830 | writel(iommu->gcmd | DMA_GCMD_SRTP, iommu->reg + DMAR_GCMD_REG); |
831 | writel(cmd, iommu->reg + DMAR_GCMD_REG); | ||
832 | 831 | ||
833 | /* Make sure hardware complete it */ | 832 | /* Make sure hardware complete it */ |
834 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, | 833 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, |
835 | readl, (sts & DMA_GSTS_RTPS), sts); | 834 | readl, (sts & DMA_GSTS_RTPS), sts); |
836 | 835 | ||
837 | spin_unlock_irqrestore(&iommu->register_lock, flag); | 836 | spin_unlock_irqrestore(&iommu->register_lock, flag); |
838 | } | 837 | } |
@@ -844,12 +843,13 @@ static void iommu_flush_write_buffer(struct intel_iommu *iommu) | |||
844 | 843 | ||
845 | if (!rwbf_quirk && !cap_rwbf(iommu->cap)) | 844 | if (!rwbf_quirk && !cap_rwbf(iommu->cap)) |
846 | return; | 845 | return; |
846 | |||
847 | spin_lock_irqsave(&iommu->register_lock, flag); | 847 | spin_lock_irqsave(&iommu->register_lock, flag); |
848 | writel(iommu->gcmd | DMA_GCMD_WBF, iommu->reg + DMAR_GCMD_REG); | 848 | writel(iommu->gcmd | DMA_GCMD_WBF, iommu->reg + DMAR_GCMD_REG); |
849 | 849 | ||
850 | /* Make sure hardware complete it */ | 850 | /* Make sure hardware complete it */ |
851 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, | 851 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, |
852 | readl, (!(val & DMA_GSTS_WBFS)), val); | 852 | readl, (!(val & DMA_GSTS_WBFS)), val); |
853 | 853 | ||
854 | spin_unlock_irqrestore(&iommu->register_lock, flag); | 854 | spin_unlock_irqrestore(&iommu->register_lock, flag); |
855 | } | 855 | } |
@@ -995,13 +995,13 @@ static int iommu_enable_translation(struct intel_iommu *iommu) | |||
995 | unsigned long flags; | 995 | unsigned long flags; |
996 | 996 | ||
997 | spin_lock_irqsave(&iommu->register_lock, flags); | 997 | spin_lock_irqsave(&iommu->register_lock, flags); |
998 | writel(iommu->gcmd|DMA_GCMD_TE, iommu->reg + DMAR_GCMD_REG); | 998 | iommu->gcmd |= DMA_GCMD_TE; |
999 | writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); | ||
999 | 1000 | ||
1000 | /* Make sure hardware complete it */ | 1001 | /* Make sure hardware complete it */ |
1001 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, | 1002 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, |
1002 | readl, (sts & DMA_GSTS_TES), sts); | 1003 | readl, (sts & DMA_GSTS_TES), sts); |
1003 | 1004 | ||
1004 | iommu->gcmd |= DMA_GCMD_TE; | ||
1005 | spin_unlock_irqrestore(&iommu->register_lock, flags); | 1005 | spin_unlock_irqrestore(&iommu->register_lock, flags); |
1006 | return 0; | 1006 | return 0; |
1007 | } | 1007 | } |
@@ -1017,7 +1017,7 @@ static int iommu_disable_translation(struct intel_iommu *iommu) | |||
1017 | 1017 | ||
1018 | /* Make sure hardware complete it */ | 1018 | /* Make sure hardware complete it */ |
1019 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, | 1019 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, |
1020 | readl, (!(sts & DMA_GSTS_TES)), sts); | 1020 | readl, (!(sts & DMA_GSTS_TES)), sts); |
1021 | 1021 | ||
1022 | spin_unlock_irqrestore(&iommu->register_lock, flag); | 1022 | spin_unlock_irqrestore(&iommu->register_lock, flag); |
1023 | return 0; | 1023 | return 0; |