Commit 810871c5 authored by Nate Watterson's avatar Nate Watterson Committed by Will Deacon

iommu/arm-smmu-v3: Clear prior settings when updating STEs

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: default avatarNate Watterson <nwatters@codeaurora.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent a121103c
...@@ -1042,13 +1042,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, ...@@ -1042,13 +1042,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 */ /* Nuke the existing STE_0 value, as we're going to rewrite it */
val &= ~(STRTAB_STE_0_CFG_MASK << STRTAB_STE_0_CFG_SHIFT); val = ste->valid ? STRTAB_STE_0_V : 0;
if (ste->valid)
val |= STRTAB_STE_0_V;
else
val &= ~STRTAB_STE_0_V;
if (ste->bypass) { if (ste->bypass) {
val |= disable_bypass ? STRTAB_STE_0_CFG_ABORT val |= disable_bypass ? STRTAB_STE_0_CFG_ABORT
...@@ -1083,7 +1078,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, ...@@ -1083,7 +1078,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 val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK
<< STRTAB_STE_0_S1CTXPTR_SHIFT) | << STRTAB_STE_0_S1CTXPTR_SHIFT) |
STRTAB_STE_0_CFG_S1_TRANS; STRTAB_STE_0_CFG_S1_TRANS;
} }
if (ste->s2_cfg) { if (ste->s2_cfg) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment