Control links and helpers on an active path during CPU idle.
Retrieves the per-CPU path pointer. Since the path pointer is only set via an SMP call on the local CPU, which is serialized with CPU PM notifiers. If the CPU PM notifier retrieves a non-NULL path pointer, it is safe to iterate over the path and control it up to the node before the sink to avoid latency.
Signed-off-by: Leo Yan leo.yan@arm.com --- drivers/hwtracing/coresight/coresight-core.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index c0f76ea7857e2bf368f9e5abbb023d7a34b4caf5..7fafec04de3e8262b7ca66671c6de635b671ceba 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1768,13 +1768,32 @@ static void coresight_pm_device_restore(struct coresight_device *csdev) static int coresight_pm_save(struct coresight_path *path) { struct coresight_device *source = coresight_get_source(path); + struct coresight_node *from, *to; + int ret; + + ret = coresight_pm_device_save(source); + if (ret) + return ret;
- return coresight_pm_device_save(source); + from = coresight_path_first_node(path); + /* Up to the node before sink to avoid latency */ + to = list_prev_entry(coresight_path_last_node(path), link); + coresight_disable_path_from_to(path, from, to); + + return 0; }
static void coresight_pm_restore(struct coresight_path *path) { struct coresight_device *source = coresight_get_source(path); + struct coresight_node *from, *to; + + from = coresight_path_first_node(path); + /* Up to the node before sink to avoid latency */ + to = list_prev_entry(coresight_path_last_node(path), link); + if (coresight_enable_path_from_to(path, coresight_get_mode(source), + from, to)) + return;
coresight_pm_device_restore(source); }