public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v15 5/8] remoteproc: Make load_segments and load_fw ops exclusive and optional
Date: Wed, 4 Dec 2024 10:53:25 -0700	[thread overview]
Message-ID: <Z1CXFfXnSKkTPKU+@p14s> (raw)
In-Reply-To: <20241128084219.2159197-6-arnaud.pouliquen@foss.st.com>

On Thu, Nov 28, 2024 at 09:42:12AM +0100, Arnaud Pouliquen wrote:
> The two methods to load the firmware to memory should be exclusive.
> 
> - make load_segments optional returning 0 if not set in
>   rproc_load_segments(),
> - ensure that load_segments() and load_fw() are not both set,
> - do not set default rproc::ops fields if load_fw() is set.

This changelog is describing "what" the patch does rather than "why".  I have
commented on that before.

> 
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
> ---
>  drivers/remoteproc/remoteproc_core.c     | 4 ++++
>  drivers/remoteproc/remoteproc_internal.h | 2 +-
>  include/linux/remoteproc.h               | 7 +++++--
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index e4ad024efcda..deadec0f3474 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2477,6 +2477,10 @@ static int rproc_alloc_firmware(struct rproc *rproc,
>  
>  static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops)
>  {
> +	/* A processor with a load_segments() and a load_fw() functions makes no sense. */
> +	if (ops->load_segments && ops->load_fw)
> +		return -EINVAL;
> +

It is only a matter of time before someone needs both ->load_segments() and
->load_fw().


>  	rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
>  	if (!rproc->ops)
>  		return -ENOMEM;
> diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
> index b898494600cf..3a4161eaf291 100644
> --- a/drivers/remoteproc/remoteproc_internal.h
> +++ b/drivers/remoteproc/remoteproc_internal.h
> @@ -170,7 +170,7 @@ int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
>  	if (rproc->ops->load_segments)
>  		return rproc->ops->load_segments(rproc, fw);
>  
> -	return -EINVAL;
> +	return 0;

Other than this hunk I would drop this patch completely.

>  }
>  
>  static inline int rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
> index 55c20424a99f..4f4c65ce74af 100644
> --- a/include/linux/remoteproc.h
> +++ b/include/linux/remoteproc.h
> @@ -374,8 +374,9 @@ enum rsc_handling_status {
>   * @find_loaded_rsc_table: find the loaded resource table from firmware image
>   * @get_loaded_rsc_table: get resource table installed in memory
>   *			  by external entity
> - * @load_segments:	load firmware ELF segment to memory, where the remote processor
> - *			expects to find it
> + * @load_segments:	optional load firmware ELF segments to memory, where the remote processor
> + *			expects to find it.
> + *			This operation is exclusive with the load_fw()
>   * @sanity_check:	sanity check the fw image
>   * @get_boot_addr:	get boot address to entry point specified in firmware
>   * @panic:	optional callback to react to system panic, core will delay
> @@ -383,8 +384,10 @@ enum rsc_handling_status {
>   * @coredump:	  collect firmware dump after the subsystem is shutdown
>   * @load_fw:	optional function to load non-ELF firmware image to memory, where the remote
>   *		processor expects to find it.
> + *		This operation is exclusive with the load_segments()
>   * @release_fw:	optional function to release the firmware image from memories.
>   *		This function is called after stopping the remote processor or in case of error
> + *
>   */
>  struct rproc_ops {
>  	int (*prepare)(struct rproc *rproc);
> -- 
> 2.25.1
> 

  reply	other threads:[~2024-12-04 17:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28  8:42 [PATCH v15 0/8] Introduction of a remoteproc tee to load signed firmware Arnaud Pouliquen
2024-11-28  8:42 ` [PATCH v15 1/8] remoteproc: core: Introduce rproc_pa_to_va helper Arnaud Pouliquen
2024-11-28  8:42 ` [PATCH v15 2/8] remoteproc: Add TEE support Arnaud Pouliquen
2024-12-03 17:04   ` Mathieu Poirier
2024-12-06 22:07   ` Bjorn Andersson
2024-12-10  8:57     ` Arnaud POULIQUEN
2025-01-10  8:51       ` Arnaud POULIQUEN
2025-02-12  3:18       ` Bjorn Andersson
2025-02-12 13:42         ` Arnaud POULIQUEN
2025-03-04 15:58           ` Bjorn Andersson
2025-03-05 12:48             ` Arnaud POULIQUEN
2025-03-25 11:05     ` Arnaud POULIQUEN
2024-11-28  8:42 ` [PATCH v15 3/8] remoteproc: Introduce load_fw and release_fw optional operation Arnaud Pouliquen
2024-12-03 17:22   ` Mathieu Poirier
2024-12-05 18:20     ` Arnaud POULIQUEN
2024-12-06 17:05       ` Mathieu Poirier
2024-12-06 17:07         ` Mathieu Poirier
2024-12-06 18:09           ` Arnaud POULIQUEN
2024-12-04 17:39   ` Mathieu Poirier
2024-12-09 23:14   ` Bjorn Andersson
2024-12-10 10:33     ` Arnaud POULIQUEN
2025-02-12  3:54       ` Bjorn Andersson
2025-02-12 13:48         ` Arnaud POULIQUEN
2025-03-04 15:23           ` Bjorn Andersson
2025-03-05 12:50             ` Arnaud POULIQUEN
2024-11-28  8:42 ` [PATCH v15 4/8] remoteproc: Rename load() operation to load_segments() in rproc_ops struct Arnaud Pouliquen
2024-12-04 18:02   ` Mathieu Poirier
2024-11-28  8:42 ` [PATCH v15 5/8] remoteproc: Make load_segments and load_fw ops exclusive and optional Arnaud Pouliquen
2024-12-04 17:53   ` Mathieu Poirier [this message]
2024-11-28  8:42 ` [PATCH v15 6/8] dt-bindings: remoteproc: Add compatibility for TEE support Arnaud Pouliquen
2024-11-28  8:42 ` [PATCH v15 7/8] remoteproc: stm32: Create sub-functions to request shutdown and release Arnaud Pouliquen
2024-11-28  8:42 ` [PATCH v15 8/8] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware 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=Z1CXFfXnSKkTPKU+@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=andersson@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    /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