From: James Clark <james.clark@linaro.org>
To: Leo Yan <leo.yan@arm.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
Yeoreum Yun <yeoreum.yun@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Yabin Cui <yabinc@google.com>, Keita Morisaki <keyz@google.com>,
Yuanfang Zhang <quic_yuanfang@quicinc.com>
Subject: Re: [PATCH v4 04/15] coresight: etm4x: Hook CPU PM callbacks
Date: Mon, 10 Nov 2025 10:50:46 +0000 [thread overview]
Message-ID: <412d49ea-045c-45ca-bc24-17ae06987e6e@linaro.org> (raw)
In-Reply-To: <20251104-arm_coresight_path_power_management_improvement-v4-4-3d4bba674709@arm.com>
On 04/11/2025 3:21 pm, Leo Yan wrote:
> Since the CoreSight core layer has registered CPU PM notifiers, this
> patch hooks CPU save and restore callbacks to be invoked from the core
> layer.
>
> The CPU PM notifier in the ETMv4 driver is no longer needed, remove it
> along with its registration and unregistration code.
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-etm4x-core.c | 59 ++++------------------
> 1 file changed, 11 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 15bf825a346826cd534ef3cd4f41c885c66321da..adb5c6b12c6f3113747f1f455087b1ab497a53f6 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -1185,11 +1185,6 @@ static const struct coresight_ops_source etm4_source_ops = {
> .pause_perf = etm4_pause_perf,
> };
>
> -static const struct coresight_ops etm4_cs_ops = {
> - .trace_id = coresight_etm_get_trace_id,
> - .source_ops = &etm4_source_ops,
> -};
> -
> static bool cpu_supports_sysreg_trace(void)
> {
> u64 dfr0 = read_sysreg_s(SYS_ID_AA64DFR0_EL1);
> @@ -1894,8 +1889,9 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
> return ret;
> }
>
> -static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
> +static int etm4_cpu_save(struct coresight_device *csdev)
> {
> + struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
> int ret = 0;
>
> if (pm_save_enable != PARAM_PM_SAVE_SELF_HOSTED)
> @@ -1918,8 +1914,10 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
> etm4_enable_hw(drvdata, false);
> }
>
> -static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)
> +static void etm4_cpu_restore(struct coresight_device *csdev)
> {
> + struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
> +
> if (pm_save_enable != PARAM_PM_SAVE_SELF_HOSTED)
> return;
>
> @@ -1927,38 +1925,11 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)
> __etm4_cpu_restore(drvdata);
> }
>
> -static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,
> - void *v)
> -{
> - struct etmv4_drvdata *drvdata;
> - unsigned int cpu = smp_processor_id();
> -
> - if (!etmdrvdata[cpu])
> - return NOTIFY_OK;
> -
> - drvdata = etmdrvdata[cpu];
> -
> - if (WARN_ON_ONCE(drvdata->cpu != cpu))
> - return NOTIFY_BAD;
> -
> - switch (cmd) {
> - case CPU_PM_ENTER:
> - if (etm4_cpu_save(drvdata))
> - return NOTIFY_BAD;
> - break;
> - case CPU_PM_EXIT:
> - case CPU_PM_ENTER_FAILED:
> - etm4_cpu_restore(drvdata);
> - break;
> - default:
> - return NOTIFY_DONE;
> - }
> -
> - return NOTIFY_OK;
> -}
> -
> -static struct notifier_block etm4_cpu_pm_nb = {
> - .notifier_call = etm4_cpu_pm_notify,
> +static const struct coresight_ops etm4_cs_ops = {
> + .trace_id = coresight_etm_get_trace_id,
> + .pm_save_disable = etm4_cpu_save,
> + .pm_restore_enable = etm4_cpu_restore,
> + .source_ops = &etm4_source_ops,
> };
>
> /* Setup PM. Deals with error conditions and counts */
> @@ -1966,16 +1937,12 @@ static int __init etm4_pm_setup(void)
> {
> int ret;
>
> - ret = cpu_pm_register_notifier(&etm4_cpu_pm_nb);
> - if (ret)
> - return ret;
> -
> ret = cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING,
> "arm/coresight4:starting",
> etm4_starting_cpu, etm4_dying_cpu);
>
> if (ret)
> - goto unregister_notifier;
> + return ret;
>
> ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
> "arm/coresight4:online",
> @@ -1989,15 +1956,11 @@ static int __init etm4_pm_setup(void)
>
> /* failed dyn state - remove others */
> cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
> -
> -unregister_notifier:
> - cpu_pm_unregister_notifier(&etm4_cpu_pm_nb);
> return ret;
> }
>
> static void etm4_pm_clear(void)
> {
> - cpu_pm_unregister_notifier(&etm4_cpu_pm_nb);
> cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
> if (hp_online) {
> cpuhp_remove_state_nocalls(hp_online);
>
next prev parent reply other threads:[~2025-11-10 10:51 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 15:21 [PATCH v4 00/15] CoreSight: Refactor power management for CoreSight path Leo Yan
2025-11-04 15:21 ` [PATCH v4 01/15] coresight: sysfs: Validate CPU online status for per-CPU sources Leo Yan
2025-11-04 15:21 ` [PATCH v4 02/15] coresight: Set per CPU source pointer Leo Yan
2025-11-04 15:21 ` [PATCH v4 03/15] coresight: Register CPU PM notifier in core layer Leo Yan
2025-11-10 10:49 ` James Clark
2025-11-11 12:13 ` Suzuki K Poulose
2025-11-12 18:09 ` Leo Yan
2025-11-04 15:21 ` [PATCH v4 04/15] coresight: etm4x: Hook CPU PM callbacks Leo Yan
2025-11-10 10:50 ` James Clark [this message]
2025-11-04 15:21 ` [PATCH v4 05/15] coresight: Add callback to determine if PM is needed Leo Yan
2025-11-10 10:54 ` James Clark
2025-11-04 15:21 ` [PATCH v4 06/15] coresight: etm4x: Remove redundant condition checks in save and restore Leo Yan
2025-11-04 15:21 ` [PATCH v4 07/15] coresight: syscfg: Use spinlock to protect active variables Leo Yan
2025-11-10 11:09 ` James Clark
2025-11-04 15:21 ` [PATCH v4 08/15] coresight: Introduce coresight_enable_source() helper Leo Yan
2025-11-10 11:09 ` James Clark
2025-11-04 15:21 ` [PATCH v4 09/15] coresight: Save activated path into source device Leo Yan
2025-11-10 11:18 ` James Clark
2025-11-17 14:19 ` Leo Yan
2025-11-10 12:29 ` James Clark
2025-11-11 14:10 ` Suzuki K Poulose
2025-11-17 15:16 ` Leo Yan
2025-11-04 15:21 ` [PATCH v4 10/15] coresight: Add 'in_idle' argument to enable/disable path functions Leo Yan
2025-11-10 11:25 ` James Clark
2025-11-10 11:48 ` James Clark
2025-11-18 9:25 ` Leo Yan
2025-11-04 15:21 ` [PATCH v4 11/15] coresight: Control path during CPU idle Leo Yan
2025-11-10 11:44 ` James Clark
2025-11-04 15:21 ` [PATCH v4 12/15] coresight: Add PM callbacks for percpu sink Leo Yan
2025-11-04 15:21 ` [PATCH v4 13/15] coresight: trbe: Save and restore state across CPU low power state Leo Yan
2025-11-10 12:01 ` James Clark
2025-11-11 14:16 ` Suzuki K Poulose
2025-11-04 15:21 ` [PATCH v4 14/15] coresight: Take hotplug lock in enable_source_store() for Sysfs mode Leo Yan
2025-11-04 15:21 ` [PATCH v4 15/15] coresight: Move CPU hotplug callbacks to core layer Leo Yan
2025-11-10 12:20 ` James Clark
2025-11-19 14:48 ` Leo Yan
2025-11-19 15:19 ` James Clark
2025-11-19 15:36 ` Leo Yan
2025-11-19 15:41 ` James Clark
2025-11-10 15:33 ` [PATCH v4 00/15] CoreSight: Refactor power management for CoreSight path James Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=412d49ea-045c-45ca-bc24-17ae06987e6e@linaro.org \
--to=james.clark@linaro.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=keyz@google.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mike.leach@linaro.org \
--cc=quic_yuanfang@quicinc.com \
--cc=suzuki.poulose@arm.com \
--cc=yabinc@google.com \
--cc=yeoreum.yun@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.