[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a947829-7eed-d60d-3198-874b90472c1d@foss.st.com>
Date: Fri, 26 Feb 2021 17:15:13 +0100
From: Arnaud POULIQUEN <arnaud.pouliquen@...s.st.com>
To: Mathieu Poirier <mathieu.poirier@...aro.org>, <ohad@...ery.com>,
<bjorn.andersson@...aro.org>, <arnaud.pouliquen@...com>
CC: <mcoquelin.stm32@...il.com>, <alexandre.torgue@...com>,
<linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v6 09/16] remoteproc: Introduce function __rproc_detach()
On 2/24/21 12:35 AM, Mathieu Poirier wrote:
> Introduce function __rproc_detach() to perform the same kind of
> operation as rproc_stop(), but instead of switching off the
> remote processor using rproc->ops->stop(), it uses
> rproc->ops->detach(). That way it is possible for the core
> to release the resources associated with a remote processor while
> the latter is kept operating.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@...aro.org>
> Reviewed-by: Peng Fan <peng.fan@....com>
Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@...com>
Thanks,
Arnaud
> ---
> drivers/remoteproc/remoteproc_core.c | 30 ++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 86572880c726..0f680b7ff8f1 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -1706,6 +1706,36 @@ static int rproc_stop(struct rproc *rproc, bool crashed)
> return 0;
> }
>
> +/*
> + * __rproc_detach(): Does the opposite of __rproc_attach()
> + */
> +static int __maybe_unused __rproc_detach(struct rproc *rproc)
> +{
> + struct device *dev = &rproc->dev;
> + int ret;
> +
> + /* No need to continue if a detach() operation has not been provided */
> + if (!rproc->ops->detach)
> + return -EINVAL;
> +
> + /* Stop any subdevices for the remote processor */
> + rproc_stop_subdevices(rproc, false);
> +
> + /* Tell the remote processor the core isn't available anymore */
> + ret = rproc->ops->detach(rproc);
> + if (ret) {
> + dev_err(dev, "can't detach from rproc: %d\n", ret);
> + return ret;
> + }
> +
> + rproc_unprepare_subdevices(rproc);
> +
> + rproc->state = RPROC_DETACHED;
> +
> + dev_info(dev, "detached remote processor %s\n", rproc->name);
> +
> + return 0;
> +}
>
> /**
> * rproc_trigger_recovery() - recover a remoteproc
>
Powered by blists - more mailing lists