iommu/arm-smmu-v3: Ensure we sync STE when only changing config field
PATCH 1/1 iommu/arm-smmu-v3: Ensure we sync STE when only changing config field
The SMMUv3 architecture permits caching of data structures deemed to be "reachable" by the SMU, which includes STEs marked as invalid. When transitioning an STE to a bypass/fault configuration at init or detach time, we mistakenly elide the CMDQ_OP_CFGI_STE operation in some cases, therefore potentially leaving the old STE state cached in the SMMU.
This patch fixes the problem by ensuring that we perform the CMDQ_OP_CFGI_STE operation irrespective of the validity of the previous STE.
--- drivers/iommu/arm-smmu-v3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/arm-smmu-v3.c +5 -2
@@ -1085,8 +1085,11 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, dst[1 ] =cpu_to_le64 (STRTAB_STE_1_SHCFG_INCOMING <<STRTAB_STE_1_SHCFG_SHIFT ); dst[2 ] =0 ;/* Nuke the VMID */ -if (ste_live) -arm_smmu_sync_ste_for_sid (smmu, sid); +/* +* The SMMU can perform negative caching, so we must sync +* the STE regardless of whether the old value was live. +*/ +arm_smmu_sync_ste_for_sid (smmu, sid);return ; }
Signature · 1 line
2.1.4
Robin Murphy
reviewerPATCH 1/1 iommu/arm-smmu-v3: Ensure we sync STE when only changing config field
Quoted 9 lines · Will Deacon
The SMMUv3 architecture permits caching of data structures deemed to be "reachable" by the SMU, which includes STEs marked as invalid. When transitioning an STE to a bypass/fault configuration at init or detach time, we mistakenly elide the
CMDQ_OP_CFGI_STEoperation in some cases, therefore potentially leaving the old STE state cached in the SMMU.This patch fixes the problem by ensuring that we perform the
CMDQ_OP_CFGI_STEoperation irrespective of the validity of the previous STE.
Quoted 26 lines
Cc Robin Murphy <[email protected]>Reported-by Eric Auger <[email protected]>Signed-off-by Will Deacon <[email protected]>--- drivers/iommu/arm-smmu-v3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/iommu/arm-smmu-v3.c +5
-2@@ -1085,8 +1085,11 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, dst[1 ] =cpu_to_le64 (STRTAB_STE_1_SHCFG_INCOMING <<STRTAB_STE_1_SHCFG_SHIFT ); dst[2 ] =0 ;/* Nuke the VMID */ -if (ste_live) -arm_smmu_sync_ste_for_sid (smmu, sid); +/* +* The SMMU can perform negative caching, so we must sync +* the STE regardless of whether the old value was live. +*/ +arm_smmu_sync_ste_for_sid (smmu, sid);return ; }
PATCH 1/1 iommu/arm-smmu-v3: Ensure we sync STE when only changing config field
Hi Will,
Quoted 7 lines · Robin Murphy
Quoted 6 lines · Will Deacon
The SMMUv3 architecture permits caching of data structures deemed to be "reachable" by the SMU, which includes STEs marked as invalid. When transitioning an STE to a bypass/fault configuration at init or detach time, we mistakenly elide the
CMDQ_OP_CFGI_STEoperation in some cases, therefore potentially leaving the old STE state cached in the SMMU.
Quoted 5 lines
Quoted 3 lines
This patch fixes the problem by ensuring that we perform the
CMDQ_OP_CFGI_STEoperation irrespective of the validity of the previous STE.Reviewed-by Robin Murphy <[email protected]>
Thanks
Eric
Quoted 34 lines
Quoted 17 lines
Cc Robin Murphy <[email protected]>Reported-by Eric Auger <[email protected]>Signed-off-by Will Deacon <[email protected]>--- drivers/iommu/arm-smmu-v3.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/iommu/arm-smmu-v3.c +0
-0@@ -1085,8 +1085,11 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, dst[1 ] =cpu_to_le64 (STRTAB_STE_1_SHCFG_INCOMING <<STRTAB_STE_1_SHCFG_SHIFT ); dst[2 ] =0 ;/* Nuke the VMID */ drivers/iommu/arm-smmu-v3.c static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, · line 1095
Quoted 10 lines
drivers/iommu/arm-smmu-v3.c +5
-2-if (ste_live) -arm_smmu_sync_ste_for_sid (smmu, sid); +/* +* The SMMU can perform negative caching, so we must sync +* the STE regardless of whether the old value was live. +*/ +arm_smmu_sync_ste_for_sid (smmu, sid);return ; }_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel