mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
	"ohad@wizery.com" <ohad@wizery.com>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>
Cc: "linux-remoteproc@vger.kernel.org"
	<linux-remoteproc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 5/9] remoteproc: Introducing function rproc_validate()
Date: Thu, 9 Jul 2020 10:32:51 +0200	[thread overview]
Message-ID: <5f81f8cb-bf29-40cb-57e1-918e0d997431@st.com> (raw)
In-Reply-To: <20200707210014.927691-6-mathieu.poirier@linaro.org>



On 7/7/20 11:00 PM, Mathieu Poirier wrote:
> Add a new function to assert the general health of the remote
> processor before handing it to the remoteproc core.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>

Thanks,
Arnaud

> ---
>  drivers/remoteproc/remoteproc_core.c | 41 ++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index fd424662801f..ad500c291d5f 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2040,6 +2040,43 @@ struct rproc *rproc_get_by_phandle(phandle phandle)
>  #endif
>  EXPORT_SYMBOL(rproc_get_by_phandle);
>  
> +static int rproc_validate(struct rproc *rproc)
> +{
> +	switch (rproc->state) {
> +	case RPROC_OFFLINE:
> +		/*
> +		 * An offline processor without a start()
> +		 * function makes no sense.
> +		 */
> +		if (!rproc->ops->start)
> +			return -EINVAL;
> +		break;
> +	case RPROC_DETACHED:
> +		/*
> +		 * A remote processor in a detached state without an
> +		 * attach() function makes not sense.
> +		 */
> +		if (!rproc->ops->attach)
> +			return -EINVAL;
> +		/*
> +		 * When attaching to a remote processor the device memory
> +		 * is already available and as such there is no need to have a
> +		 * cached table.
> +		 */
> +		if (rproc->cached_table)
> +			return -EINVAL;
> +		break;
> +	default:
> +		/*
> +		 * When adding a remote processor, the state of the device
> +		 * can be offline or detached, nothing else.
> +		 */
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
>  /**
>   * rproc_add() - register a remote processor
>   * @rproc: the remote processor handle to register
> @@ -2069,6 +2106,10 @@ int rproc_add(struct rproc *rproc)
>  	if (ret < 0)
>  		return ret;
>  
> +	ret = rproc_validate(rproc);
> +	if (ret < 0)
> +		return ret;
> +
>  	dev_info(dev, "%s is available\n", rproc->name);
>  
>  	/* create debugfs entries */
> 

  reply	other threads:[~2020-07-09  8:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 21:00 [PATCH v5 0/9] remoteproc: Add support for attaching with rproc Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 1/9] remoteproc: Add new RPROC_DETACHED state Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 2/9] remoteproc: Add new attach() remoteproc operation Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 3/9] remoteproc: Introducing function rproc_attach() Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 4/9] remoteproc: Introducing function rproc_actuate() Mathieu Poirier
2020-07-09  8:29   ` Arnaud POULIQUEN
2020-07-07 21:00 ` [PATCH v5 5/9] remoteproc: Introducing function rproc_validate() Mathieu Poirier
2020-07-09  8:32   ` Arnaud POULIQUEN [this message]
2020-07-07 21:00 ` [PATCH v5 6/9] remoteproc: Refactor function rproc_boot() Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 7/9] remoteproc: Refactor function rproc_trigger_auto_boot() Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 8/9] remoteproc: Refactor function rproc_free_vring() Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 9/9] remoteproc: Properly handle firmware name when attaching Mathieu Poirier
2020-07-09  8:58   ` Arnaud POULIQUEN
2020-07-09 16:23 ` [PATCH v5 0/9] remoteproc: Add support for attaching with rproc Arnaud POULIQUEN

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=5f81f8cb-bf29-40cb-57e1-918e0d997431@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.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®