diff options
author | Nate Watterson <nwatters@codeaurora.org> | 2016-12-20 23:11:48 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2017-01-26 13:16:56 -0500 |
commit | 810871c57011eb3e89e6768932757f169d666cd2 (patch) | |
tree | b4cb8856949505229663c55947417cf55bb2729b | |
parent | a121103c922847ba5010819a3f250f1f7fc84ab8 (diff) |
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 <nwatters@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | drivers/iommu/arm-smmu-v3.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4d6ec444a9d6..94f305db8739 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
@@ -1042,13 +1042,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, | |||
1042 | } | 1042 | } |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | /* Nuke the existing Config, as we're going to rewrite it */ | 1045 | /* Nuke the existing STE_0 value, as we're going to rewrite it */ |
1046 | val &= ~(STRTAB_STE_0_CFG_MASK << STRTAB_STE_0_CFG_SHIFT); | 1046 | val = ste->valid ? STRTAB_STE_0_V : 0; |
1047 | |||
1048 | if (ste->valid) | ||
1049 | val |= STRTAB_STE_0_V; | ||
1050 | else | ||
1051 | val &= ~STRTAB_STE_0_V; | ||
1052 | 1047 | ||
1053 | if (ste->bypass) { | 1048 | if (ste->bypass) { |
1054 | val |= disable_bypass ? STRTAB_STE_0_CFG_ABORT | 1049 | 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 | val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK | 1078 | val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK |
1084 | << STRTAB_STE_0_S1CTXPTR_SHIFT) | | 1079 | << STRTAB_STE_0_S1CTXPTR_SHIFT) | |
1085 | STRTAB_STE_0_CFG_S1_TRANS; | 1080 | STRTAB_STE_0_CFG_S1_TRANS; |
1086 | |||
1087 | } | 1081 | } |
1088 | 1082 | ||
1089 | if (ste->s2_cfg) { | 1083 | if (ste->s2_cfg) { |