]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
iommu/arm-smmu-v3: Clear prior settings when updating STEs
authorNate Watterson <nwatters@codeaurora.org>
Wed, 21 Dec 2016 04:11:48 +0000 (23:11 -0500)
committerTim Gardner <tim.gardner@canonical.com>
Tue, 21 Feb 2017 17:00:32 +0000 (10:00 -0700)
To prevent corruption of the stage-1 context pointer field when
updating STEs, rebuild the entire containing dword instead of
clearing individual fields.

Signed-off-by: Nate Watterson <nwatters@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 810871c57011eb3e89e6768932757f169d666cd2)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/iommu/arm-smmu-v3.c

index d9cf6cb8c6cc199509201a529bd20bb2b3838e55..867081fc780f83b7af031ea775fcf457737bbea3 100644 (file)
@@ -1045,13 +1045,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
                }
        }
 
-       /* Nuke the existing Config, as we're going to rewrite it */
-       val &= ~(STRTAB_STE_0_CFG_MASK << STRTAB_STE_0_CFG_SHIFT);
-
-       if (ste->valid)
-               val |= STRTAB_STE_0_V;
-       else
-               val &= ~STRTAB_STE_0_V;
+       /* Nuke the existing STE_0 value, as we're going to rewrite it */
+       val = ste->valid ? STRTAB_STE_0_V : 0;
 
        if (ste->bypass) {
                val |= disable_bypass ? STRTAB_STE_0_CFG_ABORT
@@ -1086,7 +1081,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
                val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK
                        << STRTAB_STE_0_S1CTXPTR_SHIFT) |
                        STRTAB_STE_0_CFG_S1_TRANS;
-
        }
 
        if (ste->s2_cfg) {