Skip to content

Commit 810871c

Browse files
Nate Wattersonwildea01
authored andcommitted
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: Nate Watterson <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent a121103 commit 810871c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/iommu/arm-smmu-v3.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,13 +1042,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
10421042
}
10431043
}
10441044

1045-
/* Nuke the existing Config, as we're going to rewrite it */
1046-
val &= ~(STRTAB_STE_0_CFG_MASK << STRTAB_STE_0_CFG_SHIFT);
1047-
1048-
if (ste->valid)
1049-
val |= STRTAB_STE_0_V;
1050-
else
1051-
val &= ~STRTAB_STE_0_V;
1045+
/* Nuke the existing STE_0 value, as we're going to rewrite it */
1046+
val = ste->valid ? STRTAB_STE_0_V : 0;
10521047

10531048
if (ste->bypass) {
10541049
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,
10831078
val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK
10841079
<< STRTAB_STE_0_S1CTXPTR_SHIFT) |
10851080
STRTAB_STE_0_CFG_S1_TRANS;
1086-
10871081
}
10881082

10891083
if (ste->s2_cfg) {

0 commit comments

Comments
 (0)