Skip to content

Commit 0a67933

Browse files
pran005willdeacon
authored andcommitted
iommu/arm-smmu: Set rpm auto_suspend once during probe
The current code calls arm_smmu_rpm_use_autosuspend() during device attach, which seems unusual as it sets the autosuspend delay and the 'use_autosuspend' flag for the smmu device. These parameters can be simply set once during the smmu probe and in order to avoid bouncing rpm states, we can simply mark_last_busy() during a client dev attach as discussed in [1]. Move the handling of arm_smmu_rpm_use_autosuspend() to the SMMU probe and modify the arm_smmu_rpm_put() function to mark_last_busy() before calling __pm_runtime_put_autosuspend(). Additionally, s/pm_runtime_put_autosuspend/__pm_runtime_put_autosuspend/ to help with the refactor of the pm_runtime_put_autosuspend() API [2]. Link: https://lore.kernel.org/r/20241023164835.GF29251@willie-the-truck [1] Link: https://git.kernel.org/linus/b7d46644e554 [2] Signed-off-by: Pranjal Shrivastava <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 0ad2507 commit 0a67933

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ static inline int arm_smmu_rpm_get(struct arm_smmu_device *smmu)
7979

8080
static inline void arm_smmu_rpm_put(struct arm_smmu_device *smmu)
8181
{
82-
if (pm_runtime_enabled(smmu->dev))
83-
pm_runtime_put_autosuspend(smmu->dev);
82+
if (pm_runtime_enabled(smmu->dev)) {
83+
pm_runtime_mark_last_busy(smmu->dev);
84+
__pm_runtime_put_autosuspend(smmu->dev);
85+
86+
}
8487
}
8588

8689
static void arm_smmu_rpm_use_autosuspend(struct arm_smmu_device *smmu)
@@ -1195,7 +1198,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
11951198
/* Looks ok, so add the device to the domain */
11961199
arm_smmu_master_install_s2crs(cfg, S2CR_TYPE_TRANS,
11971200
smmu_domain->cfg.cbndx, fwspec);
1198-
arm_smmu_rpm_use_autosuspend(smmu);
11991201
rpm_put:
12001202
arm_smmu_rpm_put(smmu);
12011203
return ret;
@@ -1218,7 +1220,6 @@ static int arm_smmu_attach_dev_type(struct device *dev,
12181220
return ret;
12191221

12201222
arm_smmu_master_install_s2crs(cfg, type, 0, fwspec);
1221-
arm_smmu_rpm_use_autosuspend(smmu);
12221223
arm_smmu_rpm_put(smmu);
12231224
return 0;
12241225
}
@@ -2246,6 +2247,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
22462247
if (dev->pm_domain) {
22472248
pm_runtime_set_active(dev);
22482249
pm_runtime_enable(dev);
2250+
arm_smmu_rpm_use_autosuspend(smmu);
22492251
}
22502252

22512253
return 0;

0 commit comments

Comments
 (0)