[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <79413af7-da90-6503-c939-a24fc6f273b4@linaro.org>
Date: Thu, 22 Jun 2023 11:32:49 +0200
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, agross@...nel.org
Cc: andersson@...nel.org, luca@...tu.xyz, dmitry.baryshkov@...aro.org,
joro@...tes.org, will@...nel.org, robin.murphy@....com,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org, robdclark@...il.com,
linux-arm-msm@...r.kernel.org, iommu@...ts.linux.dev,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kernel@...labora.com
Subject: Re: [PATCH v5 3/6] iommu/qcom: Disable and reset context bank before
programming
On 22.06.2023 11:27, AngeloGioacchino Del Regno wrote:
> 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: 0ae349a0f33f ("iommu/qcom: Add qcom_iommu")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@...aro.org>
Konrad
> drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> index 8face57c4180..f1bd7c035db8 100644
> --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
> @@ -273,6 +273,13 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain,
> ctx->secure_init = true;
> }
>
> + /* Disable context bank before programming */
> + iommu_writel(ctx, ARM_SMMU_CB_SCTLR, 0);
> +
> + /* Clear context bank fault address fault status registers */
> + iommu_writel(ctx, ARM_SMMU_CB_FAR, 0);
> + iommu_writel(ctx, ARM_SMMU_CB_FSR, ARM_SMMU_FSR_FAULT);
> +
> /* TTBRs */
> iommu_writeq(ctx, ARM_SMMU_CB_TTBR0,
> pgtbl_cfg.arm_lpae_s1_cfg.ttbr |
Powered by blists - more mailing lists