[PATCH v5 14/19] coresight: Control path during CPU idle

Leo Yan leo.yan at arm.com
Wed Nov 19 07:49:12 PST 2025


Control links and helpers on an activated path during CPU idle.  Set the
"path->in_idle" flag to true during idle to guide path control.

Since coresight_disable_path() doesn't handle a source device's helpers,
explicitly disable them alongside the source device.

Reviewed-by: James Clark <james.clark at linaro.org>
Tested-by: James Clark <james.clark at linaro.org>
Signed-off-by: Leo Yan <leo.yan at arm.com>
---
 drivers/hwtracing/coresight/coresight-core.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index e3efa7c9ef9fa1bf7b2f727205abe577bfc493e3..7a9f2c1b105d097cee846ba7ff54475483a0c8e0 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1649,12 +1649,33 @@ static bool coresight_pm_is_needed(struct coresight_device *csdev)
 
 static int coresight_pm_save(struct coresight_device *csdev)
 {
-	return coresight_ops(csdev)->pm_save_disable(csdev);
+	int ret;
+
+	if (WARN_ON(!csdev->path))
+		return -EINVAL;
+
+	/* in_idle flag will be used for path controlling */
+	csdev->path->in_idle = true;
+
+	ret = coresight_ops(csdev)->pm_save_disable(csdev);
+	if (ret) {
+		csdev->path->in_idle = false;
+		return ret;
+	}
+
+	coresight_disable_helpers(csdev, csdev->path);
+	coresight_disable_path(csdev->path);
+	return 0;
 }
 
 static void coresight_pm_restore(struct coresight_device *csdev)
 {
+	if (WARN_ON(!csdev->path))
+		return;
+
+	coresight_enable_path(csdev->path, coresight_get_mode(csdev));
 	coresight_ops(csdev)->pm_restore_enable(csdev);
+	csdev->path->in_idle = false;
 }
 
 static int coresight_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,

-- 
2.34.1




More information about the linux-arm-kernel mailing list