Skip to content

Commit 9f3fef2

Browse files
AngeloGioacchino Del Regnowilldeacon
authored andcommitted
iommu/qcom: Disable and reset context bank before programming
Writing the new TTBRs, TCRs and MAIRs on a previously enabled context bank may trigger a context fault, resulting in firmware driven AP resets: change the domain initialization programming sequence to disable the context bank(s) and to also clear the related fault address (CB_FAR) and fault status (CB_FSR) registers before writing new values to TTBR0/1, TCR/TCR2, MAIR0/1. Fixes: 0ae349a ("iommu/qcom: Add qcom_iommu") Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent fcf226f commit 9f3fef2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/iommu/arm/arm-smmu/qcom_iommu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain,
273273
ctx->secure_init = true;
274274
}
275275

276+
/* Disable context bank before programming */
277+
iommu_writel(ctx, ARM_SMMU_CB_SCTLR, 0);
278+
279+
/* Clear context bank fault address fault status registers */
280+
iommu_writel(ctx, ARM_SMMU_CB_FAR, 0);
281+
iommu_writel(ctx, ARM_SMMU_CB_FSR, ARM_SMMU_FSR_FAULT);
282+
276283
/* TTBRs */
277284
iommu_writeq(ctx, ARM_SMMU_CB_TTBR0,
278285
pgtbl_cfg.arm_lpae_s1_cfg.ttbr |

0 commit comments

Comments
 (0)