Skip to content

Commit 268dd4e

Browse files
vldlywilldeacon
authored andcommitted
iommu/qcom: restore IOMMU state if needed
If the IOMMU has a power domain then some state will be lost in qcom_iommu_suspend and TZ will reset device if we don't call qcom_scm_restore_sec_cfg before accessing it again. Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com> [luca@z3ntu.xyz: reword commit message a bit] Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Link: https://lore.kernel.org/r/20231011-msm8953-iommu-restore-v1-1-48a0c93809a2@z3ntu.xyz Signed-off-by: Will Deacon <will@kernel.org>
1 parent 28af105 commit 268dd4e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,16 @@ static void qcom_iommu_device_remove(struct platform_device *pdev)
900900
static int __maybe_unused qcom_iommu_resume(struct device *dev)
901901
{
902902
struct qcom_iommu_dev *qcom_iommu = dev_get_drvdata(dev);
903+
int ret;
904+
905+
ret = clk_bulk_prepare_enable(CLK_NUM, qcom_iommu->clks);
906+
if (ret < 0)
907+
return ret;
908+
909+
if (dev->pm_domain)
910+
return qcom_scm_restore_sec_cfg(qcom_iommu->sec_id, 0);
903911

904-
return clk_bulk_prepare_enable(CLK_NUM, qcom_iommu->clks);
912+
return ret;
905913
}
906914

907915
static int __maybe_unused qcom_iommu_suspend(struct device *dev)

0 commit comments

Comments
 (0)