* [PATCH] iommu/qcom: Disable clocks if restoring the secure config fails
@ 2026-11-22 10:11 Suyuan Wang via B4 Relay
0 siblings, 0 replies; only message in thread
From: Suyuan Wang via B4 Relay @ 2026-11-22 10:11 UTC (permalink / raw)
To: joro, will, robin.clark
Cc: iommu, robin.murphy, linux-arm-msm, linux-kernel, linux-arm-kernel
From: Suyuan Wang <stevewong@hust.edu.cn>
qcom_iommu_resume() enables the clocks and then, for an IOMMU with a
power domain, calls qcom_scm_restore_sec_cfg(). If that call fails, the
error is returned but the clocks stay enabled. The PM core then treats
the device as still suspended, so qcom_iommu_suspend() will not run to
turn them off.
Disable the clocks again when qcom_scm_restore_sec_cfg() fails.
Found with a static analysis tool and checked by hand.
Fixes: 268dd4edb748 ("iommu/qcom: restore IOMMU state if needed")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
---
Compile tested on arm64 (W=1). I don't have the hardware.
---
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index 96903cd9cfc2..52bcb8cf46b1 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -898,8 +898,11 @@ static int __maybe_unused qcom_iommu_resume(struct device *dev)
if (ret < 0)
return ret;
- if (dev->pm_domain)
- return qcom_scm_restore_sec_cfg(qcom_iommu->sec_id, 0);
+ if (dev->pm_domain) {
+ ret = qcom_scm_restore_sec_cfg(qcom_iommu->sec_id, 0);
+ if (ret)
+ clk_bulk_disable_unprepare(CLK_NUM, qcom_iommu->clks);
+ }
return ret;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-22 10:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22 10:11 [PATCH] iommu/qcom: Disable clocks if restoring the secure config fails Suyuan Wang via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®