Skip to contentSkip to conversation

iommu/arm-smmu: Set rpm auto_suspend once during probe

PATCH Applied Pranjal Shrivastava 2 participants 2 messages Jan 23, 2025 – Mar 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 & 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].

Thanks,
Praan

[1] https://lore.kernel.org/all/20241023164835.GF29251@willie-the-truck/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b7d46644e554ed017dfabc0841acf418d0584bc9

---
 drivers/iommu/arm/arm-smmu/arm-smmu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/iommu/arm/arm-smmu/arm-smmu.c +6 -4
index 79afc92e1d8b..5c26c9328cec 100644
@@ -78,8 +78,11 @@ static inline int arm_smmu_rpm_get(struct arm_smmu_device *smmu)
 
 static inline void arm_smmu_rpm_put(struct arm_smmu_device *smmu)
 {
-	if (pm_runtime_enabled(smmu->dev))
-		pm_runtime_put_autosuspend(smmu->dev);
+	if (pm_runtime_enabled(smmu->dev)) {
+		pm_runtime_mark_last_busy(smmu->dev);
+		__pm_runtime_put_autosuspend(smmu->dev);
+
+	}
 }
 
 static void arm_smmu_rpm_use_autosuspend(struct arm_smmu_device *smmu)
@@ -1194,7 +1197,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 	/* Looks ok, so add the device to the domain */
 	arm_smmu_master_install_s2crs(cfg, S2CR_TYPE_TRANS,
 				      smmu_domain->cfg.cbndx, fwspec);
-	arm_smmu_rpm_use_autosuspend(smmu);
 rpm_put:
 	arm_smmu_rpm_put(smmu);
 	return ret;
@@ -1217,7 +1219,6 @@ static int arm_smmu_attach_dev_type(struct device *dev,
 		return ret;
 
 	arm_smmu_master_install_s2crs(cfg, type, 0, fwspec);
-	arm_smmu_rpm_use_autosuspend(smmu);
 	arm_smmu_rpm_put(smmu);
 	return 0;
 }
@@ -2245,6 +2246,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 	if (dev->pm_domain) {
 		pm_runtime_set_active(dev);
 		pm_runtime_enable(dev);
+		arm_smmu_rpm_use_autosuspend(smmu);
 	}
 
 	return 0;
Signature · 1 line
2.48.1.262.g85cc9f2d1e-goog
maintainer Applied
#1 lore raw
Quoted 8 lines · Pranjal Shrivastava

The current code calls arm_smmu_rpm_use_autosuspend during device attach, which seems unusual as it sets the autosuspend delay & 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].

[...]

Applied to iommu (arm/smmu/updates), thanks!

[1/1] iommu/arm-smmu: Set rpm auto_suspend once during probe

      https://git.kernel.org/iommu/c/0a679336dc17

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev