Skip to content

Commit afefe67

Browse files
Sai Prakash Ranjanwilldeacon
authored andcommitted
iommu/arm-smmu: Add clk_bulk_{prepare/unprepare} to system pm callbacks
Some clocks for SMMU can have parent as XO such as gpu_cc_hub_cx_int_clk of GPU SMMU in QTI SC7280 SoC and in order to enter deep sleep states in such cases, we would need to drop the XO clock vote in unprepare call and this unprepare callback for XO is in RPMh (Resource Power Manager-Hardened) clock driver which controls RPMh managed clock resources for new QTI SoCs. Given we cannot have a sleeping calls such as clk_bulk_prepare() and clk_bulk_unprepare() in arm-smmu runtime pm callbacks since the iommu operations like map and unmap can be in atomic context and are in fast path, add this prepare and unprepare call to drop the XO vote only for system pm callbacks since it is not a fast path and we expect the system to enter deep sleep states with system pm as opposed to runtime pm. This is a similar sequence of clock requests (prepare,enable and disable,unprepare) in arm-smmu probe and remove. Signed-off-by: Sai Prakash Ranjan <[email protected]> Co-developed-by: Rajendra Nayak <[email protected]> Signed-off-by: Rajendra Nayak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 5c08c5a commit afefe67

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,18 +2281,38 @@ static int __maybe_unused arm_smmu_runtime_suspend(struct device *dev)
22812281

22822282
static int __maybe_unused arm_smmu_pm_resume(struct device *dev)
22832283
{
2284+
int ret;
2285+
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
2286+
2287+
ret = clk_bulk_prepare(smmu->num_clks, smmu->clks);
2288+
if (ret)
2289+
return ret;
2290+
22842291
if (pm_runtime_suspended(dev))
22852292
return 0;
22862293

2287-
return arm_smmu_runtime_resume(dev);
2294+
ret = arm_smmu_runtime_resume(dev);
2295+
if (ret)
2296+
clk_bulk_unprepare(smmu->num_clks, smmu->clks);
2297+
2298+
return ret;
22882299
}
22892300

22902301
static int __maybe_unused arm_smmu_pm_suspend(struct device *dev)
22912302
{
2303+
int ret = 0;
2304+
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
2305+
22922306
if (pm_runtime_suspended(dev))
2293-
return 0;
2307+
goto clk_unprepare;
22942308

2295-
return arm_smmu_runtime_suspend(dev);
2309+
ret = arm_smmu_runtime_suspend(dev);
2310+
if (ret)
2311+
return ret;
2312+
2313+
clk_unprepare:
2314+
clk_bulk_unprepare(smmu->num_clks, smmu->clks);
2315+
return ret;
22962316
}
22972317

22982318
static const struct dev_pm_ops arm_smmu_pm_ops = {

0 commit comments

Comments
 (0)