Skip to content

Commit 87e5fe5

Browse files
jpbruckerwilldeacon
authored andcommitted
iommu/arm-smmu-v3: Write level-1 descriptors atomically
Use WRITE_ONCE() to make sure that the SMMU doesn't read incomplete stream table descriptors. Refer to the comment about 64-bit accesses, and add the comment to the equivalent context descriptor code. Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 058c59a commit 87e5fe5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iommu/arm-smmu-v3.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,7 @@ static void arm_smmu_write_cd_l1_desc(__le64 *dst,
15311531
u64 val = (l1_desc->l2ptr_dma & CTXDESC_L1_DESC_L2PTR_MASK) |
15321532
CTXDESC_L1_DESC_V;
15331533

1534+
/* See comment in arm_smmu_write_ctx_desc() */
15341535
WRITE_ONCE(*dst, cpu_to_le64(val));
15351536
}
15361537

@@ -1726,7 +1727,8 @@ arm_smmu_write_strtab_l1_desc(__le64 *dst, struct arm_smmu_strtab_l1_desc *desc)
17261727
val |= FIELD_PREP(STRTAB_L1_DESC_SPAN, desc->span);
17271728
val |= desc->l2ptr_dma & STRTAB_L1_DESC_L2PTR_MASK;
17281729

1729-
*dst = cpu_to_le64(val);
1730+
/* See comment in arm_smmu_write_ctx_desc() */
1731+
WRITE_ONCE(*dst, cpu_to_le64(val));
17301732
}
17311733

17321734
static void arm_smmu_sync_ste_for_sid(struct arm_smmu_device *smmu, u32 sid)

0 commit comments

Comments
 (0)