public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: James Clark <james.clark@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] coresight: etm4x: Refactor pm_save_enable handling
Date: Thu, 30 Apr 2026 18:24:10 +0100	[thread overview]
Message-ID: <20260430172410.GG16537@e132581.arm.com> (raw)
In-Reply-To: <20260428-james-cs-ete-pm_save_enable-v1-2-c7a90ca6f43b@linaro.org>

On Tue, Apr 28, 2026 at 01:18:12PM +0100, James Clark wrote:

[...]

>  static int etm4_init_pm_save(struct device *dev, struct etmv4_drvdata *drvdata)
>  {
>  	if (etm4x_is_ete(drvdata)) {
> +		if (pm_save_enable)
> +			dev_warn_once(dev, "pm_save_enable module option is only for ETM4\n");
> +
>  		/*
>  		 * Always do PM save for ETE. It always uses system registers
>  		 * which will be lost on CPU power down.
>  		 */
> -		pm_save_enable = PARAM_PM_SAVE_SELF_HOSTED;
> +		drvdata->pm_save = true;
>  	} else if (pm_save_enable == PARAM_PM_SAVE_FIRMWARE) {
> -		pm_save_enable = coresight_loses_context_with_cpu(dev) ?
> -			PARAM_PM_SAVE_SELF_HOSTED : PARAM_PM_SAVE_NEVER;
> +		drvdata->pm_save = coresight_loses_context_with_cpu(dev);
> +	} else if (pm_save_enable == PARAM_PM_SAVE_SELF_HOSTED) {
> +		drvdata->pm_save = true;
> +	} else {
> +		drvdata->pm_save = false;
>  	}

Could we separate ETE and ETM a bit?

        int cpu_pm;

        cpu_pm = coresight_loses_context_with_cpu(dev) ?
                PARAM_PM_SAVE_SELF_HOSTED : PARAM_PM_SAVE_NEVER;

        if (etm4x_is_ete(drvdata))
                goto alloc_out;

        /* Now this is only for ETM case */

        /* Do consistency check */
        if ((cpu_fw_pm == PARAM_PM_SAVE_SELF_HOSTED &&
             pm_save_enable == PARAM_PM_SAVE_NEVER) ||
            (cpu_fw_pm == PARAM_PM_SAVE_NEVER &&
             pm_save_enable == PARAM_PM_SAVE_SELF_HOSTED))
                dev_warn(dev, "inconsistent setting ...\n");

        /* Force to use the global setting */
        if (pm_save_enable != PARAM_PM_SAVE_FIRMWARE)
            cpu_pm = pm_save_enable;
>  
> -	if (pm_save_enable != PARAM_PM_SAVE_NEVER) {
> +	if (drvdata->pm_save) {

would be:

        if (cpu_pm == PARAM_PM_SAVE_SELF_HOSTED)

>  		drvdata->save_state = devm_kmalloc(dev,
>  						   sizeof(struct etmv4_save_state),
>  						   GFP_KERNEL);
> @@ -2037,7 +2047,7 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
>  {
>  	int ret = 0;
>  
> -	if (pm_save_enable != PARAM_PM_SAVE_SELF_HOSTED)
> +	if (!drvdata->pm_save)

Drop "pm_save" and directly use drvdata->save_state ?

We don't need "pm_save" anyway after we apply the patch [1].

[1] http://listhost.cambridge.arm.com/pipermail/linux-eng/2026-April/030289.html

      reply	other threads:[~2026-04-30 17:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 12:18 [PATCH 0/2] coresight: ete: Always save state on power down James Clark
2026-04-28 12:18 ` [PATCH 1/2] " James Clark
2026-04-30 16:54   ` Leo Yan
2026-05-01  8:24   ` Suzuki K Poulose
2026-05-01  9:43     ` James Clark
2026-05-01 13:50       ` Leo Yan
2026-05-01 16:44         ` James Clark
2026-04-28 12:18 ` [PATCH 2/2] coresight: etm4x: Refactor pm_save_enable handling James Clark
2026-04-30 17:24   ` Leo Yan [this message]

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=20260430172410.GG16537@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=suzuki.poulose@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox