mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Beleswar Padhi <b-padhi@ti.com>, andersson@kernel.org
Cc: mathieu.poirier@linaro.org, s-anna@ti.com,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	u-kumar1@ti.com, nm@ti.com, devarsht@ti.com, hnagalla@ti.com
Subject: Re: [PATCH v3 2/2] remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
Date: Sat, 18 May 2024 12:44:50 +0200	[thread overview]
Message-ID: <954f974f-8b97-4ff6-bb57-35501fa9ceb9@wanadoo.fr> (raw)
In-Reply-To: <20240430105307.1190615-3-b-padhi@ti.com>

Le 30/04/2024 à 12:53, Beleswar Padhi a écrit :
> PSC controller has a limitation that it can only power-up the second
> core when the first core is in ON state. Power-state for core0 should be
> equal to or higher than core1.
> 
> Therefore, prevent core1 from powering up before core0 during the start
> process from sysfs. Similarly, prevent core0 from shutting down before
> core1 has been shut down from sysfs.
> 
> Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
> 
> Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
> ---
>   drivers/remoteproc/ti_k3_r5_remoteproc.c | 23 +++++++++++++++++++++--
>   1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
> index 6d6afd6beb3a..1799b4f6d11e 100644
> --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
> +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
> @@ -548,7 +548,7 @@ static int k3_r5_rproc_start(struct rproc *rproc)
>   	struct k3_r5_rproc *kproc = rproc->priv;
>   	struct k3_r5_cluster *cluster = kproc->cluster;
>   	struct device *dev = kproc->dev;
> -	struct k3_r5_core *core;
> +	struct k3_r5_core *core0, *core;
>   	u32 boot_addr;
>   	int ret;
>   
> @@ -574,6 +574,15 @@ static int k3_r5_rproc_start(struct rproc *rproc)
>   				goto unroll_core_run;
>   		}
>   	} else {
> +		/* do not allow core 1 to start before core 0 */
> +		core0 = list_first_entry(&cluster->cores, struct k3_r5_core,
> +					 elem);
> +		if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
> +			dev_err(dev, "%s: can not start core 1 before core 0\n",
> +				__func__);
> +			return -EPERM;
> +		}
> +
>   		ret = k3_r5_core_run(core);
>   		if (ret)
>   			goto put_mbox;
> @@ -619,7 +628,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
>   {
>   	struct k3_r5_rproc *kproc = rproc->priv;
>   	struct k3_r5_cluster *cluster = kproc->cluster;
> -	struct k3_r5_core *core = kproc->core;
> +	struct device *dev = kproc->dev;
> +	struct k3_r5_core *core1, *core = kproc->core;
>   	int ret;
>   
>   	/* halt all applicable cores */
> @@ -632,6 +642,15 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
>   			}
>   		}
>   	} else {
> +		/* do not allow core 0 to stop before core 1 */
> +		core1 = list_last_entry(&cluster->cores, struct k3_r5_core,
> +					elem);
> +		if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
> +			dev_err(dev, "%s: can not stop core 0 before core 1\n",
> +				__func__);
> +			return -EPERM;

Hi,

this patch has already reached -next, but should this "return -EPERM;" be :
	ret = -EPERM;
	goto put_mbox;

instead?

CJ

> +		}
> +
>   		ret = k3_r5_core_halt(core);
>   		if (ret)
>   			goto out;


  reply	other threads:[~2024-05-18 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 10:53 [PATCH v3 0/2] remoteproc: k3-r5: Wait for core0 power-up before powering up core1 Beleswar Padhi
2024-04-30 10:53 ` [PATCH v3 1/2] " Beleswar Padhi
2024-04-30 10:53 ` [PATCH v3 2/2] remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs Beleswar Padhi
2024-05-18 10:44   ` Christophe JAILLET [this message]
2024-05-20 15:14     ` Mathieu Poirier
2024-04-30 16:59 ` [PATCH v3 0/2] remoteproc: k3-r5: Wait for core0 power-up before powering up core1 Mathieu Poirier

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=954f974f-8b97-4ff6-bb57-35501fa9ceb9@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=andersson@kernel.org \
    --cc=b-padhi@ti.com \
    --cc=devarsht@ti.com \
    --cc=hnagalla@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=nm@ti.com \
    --cc=s-anna@ti.com \
    --cc=u-kumar1@ti.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

all inboxes | Powered by JetHome®