Linux Remote Processor Subsystem development
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: ohad@wizery.com, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org, loic.pallardy@st.com,
	arnaud.pouliquen@st.com, s-anna@ti.com
Subject: Re: [PATCH v4 3/9] remoteproc: Introducing function rproc_attach()
Date: Tue, 23 Jun 2020 13:37:25 -0600	[thread overview]
Message-ID: <20200623193725.GA1908098@xps15> (raw)
In-Reply-To: <20200622071804.GE149351@builder.lan>

Hi,

On Mon, Jun 22, 2020 at 12:18:04AM -0700, Bjorn Andersson wrote:
> On Mon 22 Jun 00:07 PDT 2020, Bjorn Andersson wrote:
> 
> > On Mon 01 Jun 10:51 PDT 2020, Mathieu Poirier wrote:
> > 
> > > Introducing function rproc_attach() to enact the same actions as
> > > rproc_start(), but without the steps related to the handling of
> > > a firmware image.  That way we can properly deal with scenarios
> > > where the remoteproc core needs to attach with a remote processsor
> > > that has been booted by another entity.
> > > 
> > > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > ---
> > >  drivers/remoteproc/remoteproc_core.c | 42 ++++++++++++++++++++++++++++
> > >  1 file changed, 42 insertions(+)
> > > 
> > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> > > index 9f04c30c4aaf..0b323f6b554b 100644
> > > --- a/drivers/remoteproc/remoteproc_core.c
> > > +++ b/drivers/remoteproc/remoteproc_core.c
> > > @@ -1370,6 +1370,48 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw)
> > >  	return ret;
> > >  }
> > >  
> > > +static int __maybe_unused rproc_attach(struct rproc *rproc)
> > > +{
> > > +	struct device *dev = &rproc->dev;
> > > +	int ret;
> > > +
> > 
> > For the case where we're going DETACHED -> RUNNING - > OFFLINE we
> > need to consider the pm_runtime (and prepare/unprepare) state of the
> > device as well...
> > 
> 
> Missed that you do indeed pm_runtime_get() in the calling function, so I
> think we're good on that part. Still need how to actually implement
> that (and the prepare/unprepare), in particular if we're moving into
> detaching a remoteproc.

I had planned to look at the interaction between the PM runtime and prepare/unprepare
callbacks later today.  Depending on what I find I may end up modifying this
patch... 

> 
> > 
> > Apart from that I think this looks good.
> > 
> 
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> Regards,
> Bjorn
> 
> > Regards,
> > Bjorn
> > 
> > > +	ret = rproc_prepare_subdevices(rproc);
> > > +	if (ret) {
> > > +		dev_err(dev, "failed to prepare subdevices for %s: %d\n",
> > > +			rproc->name, ret);
> > > +		goto out;
> > > +	}
> > > +
> > > +	/* Attach to the remote processor */
> > > +	ret = rproc_attach_device(rproc);
> > > +	if (ret) {
> > > +		dev_err(dev, "can't attach to rproc %s: %d\n",
> > > +			rproc->name, ret);
> > > +		goto unprepare_subdevices;
> > > +	}
> > > +
> > > +	/* Start any subdevices for the remote processor */
> > > +	ret = rproc_start_subdevices(rproc);
> > > +	if (ret) {
> > > +		dev_err(dev, "failed to probe subdevices for %s: %d\n",
> > > +			rproc->name, ret);
> > > +		goto stop_rproc;
> > > +	}
> > > +
> > > +	rproc->state = RPROC_RUNNING;
> > > +
> > > +	dev_info(dev, "remote processor %s is now attached\n", rproc->name);
> > > +
> > > +	return 0;
> > > +
> > > +stop_rproc:
> > > +	rproc->ops->stop(rproc);
> > > +unprepare_subdevices:
> > > +	rproc_unprepare_subdevices(rproc);
> > > +out:
> > > +	return ret;
> > > +}
> > > +
> > >  /*
> > >   * take a firmware and boot a remote processor with it.
> > >   */
> > > -- 
> > > 2.20.1
> > > 

  reply	other threads:[~2020-06-23 19:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 17:51 [PATCH v4 0/9] remoteproc: Add support for attaching with rproc Mathieu Poirier
2020-06-01 17:51 ` [PATCH v4 1/9] remoteproc: Add new RPROC_DETACHED state Mathieu Poirier
2020-06-22  6:25   ` Bjorn Andersson
2020-06-01 17:51 ` [PATCH v4 2/9] remoteproc: Add new attach() remoteproc operation Mathieu Poirier
2020-06-22  6:36   ` Bjorn Andersson
2020-06-01 17:51 ` [PATCH v4 3/9] remoteproc: Introducing function rproc_attach() Mathieu Poirier
2020-06-22  7:07   ` Bjorn Andersson
2020-06-22  7:18     ` Bjorn Andersson
2020-06-23 19:37       ` Mathieu Poirier [this message]
2020-06-01 17:51 ` [PATCH v4 4/9] remoteproc: Introducing function rproc_actuate() Mathieu Poirier
2020-06-22  7:18   ` Bjorn Andersson
2020-06-01 17:51 ` [PATCH v4 5/9] remoteproc: Introducing function rproc_validate() Mathieu Poirier
2020-06-22  7:25   ` Bjorn Andersson
2020-06-23 19:38     ` Mathieu Poirier
2020-06-01 17:51 ` [PATCH v4 6/9] remoteproc: Refactor function rproc_boot() Mathieu Poirier
2020-06-22  7:25   ` Bjorn Andersson
2020-06-01 17:51 ` [PATCH v4 7/9] remoteproc: Refactor function rproc_trigger_auto_boot() Mathieu Poirier
2020-06-22  7:25   ` Bjorn Andersson
2020-06-01 17:51 ` [PATCH v4 8/9] remoteproc: Refactor function rproc_free_vring() Mathieu Poirier
2020-06-22  7:27   ` Bjorn Andersson
2020-06-01 17:51 ` [PATCH v4 9/9] remoteproc: Properly handle firmware name when attaching Mathieu Poirier
2020-06-04 14:16   ` Arnaud POULIQUEN
2020-06-04 20:14     ` Mathieu Poirier
2020-06-22  7:33   ` Bjorn Andersson
2020-06-23 19:48     ` Mathieu Poirier
2020-06-23 20:09       ` Bjorn Andersson
2020-06-04 14:24 ` [PATCH v4 0/9] remoteproc: Add support for attaching with rproc Arnaud POULIQUEN
2020-06-04 20:27   ` 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=20200623193725.GA1908098@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=loic.pallardy@st.com \
    --cc=ohad@wizery.com \
    --cc=s-anna@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