linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Leger" <cleger@kalrayinc.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Jonathan Corbet <corbet@lwn.net>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	linux-remoteproc <linux-remoteproc@vger.kernel.org>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Andy Gross <agross@kernel.org>,
	Patrice Chotard <patrice.chotard@st.com>,
	linux-doc <linux-doc@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Arnaud Pouliquen <arnaud.pouliquen@st.com>,
	Loic PALLARDY <loic.pallardy@st.com>, s-anna <s-anna@ti.com>
Subject: Re: [PATCH v5 5/8] remoteproc: Rename rproc_elf_sanity_check for elf32
Date: Tue, 10 Mar 2020 16:38:19 +0100 (CET)	[thread overview]
Message-ID: <371773363.9138477.1583854699708.JavaMail.zimbra@kalray.eu> (raw)
In-Reply-To: <20200310152031.GA25781@xps15>

Hi Mathieu,

----- On 10 Mar, 2020, at 16:20, Mathieu Poirier mathieu.poirier@linaro.org wrote:

> On Mon, Mar 09, 2020 at 05:00:05PM -0700, Bjorn Andersson wrote:
>> On Tue 03 Mar 00:02 PST 2020, Cl?ment Leger wrote:
>> 
>> > Hi Bjorn,
>> > 
>> > ----- On 3 Mar, 2020, at 00:13, Bjorn Andersson bjorn.andersson@linaro.org
>> > wrote:
>> > 
>> > > On Mon 02 Mar 01:38 PST 2020, Clement Leger wrote:
>> > > 
>> > >> Since this function will be modified to support both elf32 and elf64,
>> > >> rename the existing one to elf32 (which is the only supported format
>> > >> at the moment). This will allow not to introduce possible side effect
>> > >> when adding elf64 support (ie: all backends will still support only
>> > >> elf32 if not requested explicitely using rproc_elf_sanity_check).
>> > >> 
>> > > 
>> > > Is there a reason for preventing ELF64 binaries be loaded?
>> > 
>> > I decided to go this way to let driver maintainer decide if they want
>> > to support elf64 to avoid problems with 64bits addresses/sizes which do
>> > not fit in their native type (size_t for instance). This is probably
>> > not going to happen and there are additionnal checks before calling
>> > rproc_da_to_va. And addresses should be filtered by rproc_da_to_va.
>> > So, actually it seems there is no reason to forbid supporting elf32/64
>> > for all drivers.
>> > 
>> 
>> I was hoping to hear some additional feedback on this from others.
> 
> I didn't follow up on this one because I agreed with your assesment and didn't
> think it was needed.
> 
> Simply put I would rather see rproc_elf_sanity_check() gain support for elf64
> and let the platform code decide what to do with format they don't support
> rather than spinning a new function.
> 
>> 
>> I've merge the patch as is, but think it would be nice to clean this up
>> and just have the driver ignore if fed a 32 or 64-elf.
> 
> It would be really nice to see this cleaned up in time for the coming merge
> window...

I could have sent a V7, but Bjorn was faster than my comment ;)
Bjorn, Is there any way to revert that or it's already pushed ?
I already have a clean V7.

Thanks,

Clément

> 
> Thanks
> Mathieu
> 
>> 
>> Regards,
>> Bjorn
>> 
>> > Regards,
>> > 
>> > Clément
>> > 
>> > > 
>> > > Regards,
>> > > Bjorn
>> > > 
>> > >> Signed-off-by: Clement Leger <cleger@kalray.eu>
>> > >> ---
>> > >>  drivers/remoteproc/remoteproc_core.c       | 2 +-
>> > >>  drivers/remoteproc/remoteproc_elf_loader.c | 6 +++---
>> > >>  drivers/remoteproc/remoteproc_internal.h   | 2 +-
>> > >>  drivers/remoteproc/st_remoteproc.c         | 2 +-
>> > >>  drivers/remoteproc/st_slim_rproc.c         | 2 +-
>> > >>  drivers/remoteproc/stm32_rproc.c           | 2 +-
>> > >>  6 files changed, 8 insertions(+), 8 deletions(-)
>> > >> 
>> > >> diff --git a/drivers/remoteproc/remoteproc_core.c
>> > >> b/drivers/remoteproc/remoteproc_core.c
>> > >> index 4bfaf4a3c4a3..99f0b796fbc7 100644
>> > >> --- a/drivers/remoteproc/remoteproc_core.c
>> > >> +++ b/drivers/remoteproc/remoteproc_core.c
>> > >> @@ -2055,7 +2055,7 @@ struct rproc *rproc_alloc(struct device *dev, const char
>> > >> *name,
>> > >>  		rproc->ops->load = rproc_elf_load_segments;
>> > >>  		rproc->ops->parse_fw = rproc_elf_load_rsc_table;
>> > >>  		rproc->ops->find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table;
>> > >> -		rproc->ops->sanity_check = rproc_elf_sanity_check;
>> > >> +		rproc->ops->sanity_check = rproc_elf32_sanity_check;
>> > >>  		rproc->ops->get_boot_addr = rproc_elf_get_boot_addr;
>> > >>  	}
>> > >>  
>> > >> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c
>> > >> b/drivers/remoteproc/remoteproc_elf_loader.c
>> > >> index c2a9783cfb9a..5a67745f2638 100644
>> > >> --- a/drivers/remoteproc/remoteproc_elf_loader.c
>> > >> +++ b/drivers/remoteproc/remoteproc_elf_loader.c
>> > >> @@ -25,13 +25,13 @@
>> > >>  #include "remoteproc_internal.h"
>> > >>  
>> > >>  /**
>> > >> - * rproc_elf_sanity_check() - Sanity Check ELF firmware image
>> > >> + * rproc_elf_sanity_check() - Sanity Check ELF32 firmware image
>> > >>   * @rproc: the remote processor handle
>> > >>   * @fw: the ELF firmware image
>> > >>   *
>> > >>   * Make sure this fw image is sane.
>> > >>   */
>> > >> -int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw)
>> > >> +int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw)
>> > >>  {
>> > >>  	const char *name = rproc->firmware;
>> > >>  	struct device *dev = &rproc->dev;
>> > >> @@ -89,7 +89,7 @@ int rproc_elf_sanity_check(struct rproc *rproc, const struct
>> > >> firmware *fw)
>> > >>  
>> > >>  	return 0;
>> > >>  }
>> > >> -EXPORT_SYMBOL(rproc_elf_sanity_check);
>> > >> +EXPORT_SYMBOL(rproc_elf32_sanity_check);
>> > >>  
>> > >>  /**
>> > >>   * rproc_elf_get_boot_addr() - Get rproc's boot address.
>> > >> diff --git a/drivers/remoteproc/remoteproc_internal.h
>> > >> b/drivers/remoteproc/remoteproc_internal.h
>> > >> index 0deae5f237b8..28639c588d58 100644
>> > >> --- a/drivers/remoteproc/remoteproc_internal.h
>> > >> +++ b/drivers/remoteproc/remoteproc_internal.h
>> > >> @@ -54,7 +54,7 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, size_t len);
>> > >>  phys_addr_t rproc_va_to_pa(void *cpu_addr);
>> > >>  int rproc_trigger_recovery(struct rproc *rproc);
>> > >>  
>> > >> -int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw);
>> > >> +int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw);
>> > >>  u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw);
>> > >>  int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
>> > >>  int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw);
>> > >> diff --git a/drivers/remoteproc/st_remoteproc.c
>> > >> b/drivers/remoteproc/st_remoteproc.c
>> > >> index a3268d95a50e..a6cbfa452764 100644
>> > >> --- a/drivers/remoteproc/st_remoteproc.c
>> > >> +++ b/drivers/remoteproc/st_remoteproc.c
>> > >> @@ -233,7 +233,7 @@ static const struct rproc_ops st_rproc_ops = {
>> > >>  	.parse_fw		= st_rproc_parse_fw,
>> > >>  	.load			= rproc_elf_load_segments,
>> > >>  	.find_loaded_rsc_table	= rproc_elf_find_loaded_rsc_table,
>> > >> -	.sanity_check		= rproc_elf_sanity_check,
>> > >> +	.sanity_check		= rproc_elf32_sanity_check,
>> > >>  	.get_boot_addr		= rproc_elf_get_boot_addr,
>> > >>  };
>> > >>  
>> > >> diff --git a/drivers/remoteproc/st_slim_rproc.c
>> > >> b/drivers/remoteproc/st_slim_rproc.c
>> > >> index 09bcb4d8b9e0..3cca8b65a8db 100644
>> > >> --- a/drivers/remoteproc/st_slim_rproc.c
>> > >> +++ b/drivers/remoteproc/st_slim_rproc.c
>> > >> @@ -203,7 +203,7 @@ static const struct rproc_ops slim_rproc_ops = {
>> > >>  	.da_to_va       = slim_rproc_da_to_va,
>> > >>  	.get_boot_addr	= rproc_elf_get_boot_addr,
>> > >>  	.load		= rproc_elf_load_segments,
>> > >> -	.sanity_check	= rproc_elf_sanity_check,
>> > >> +	.sanity_check	= rproc_elf32_sanity_check,
>> > >>  };
>> > >>  
>> > >>  /**
>> > >> diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
>> > >> index a18f88044111..9a8b5f5e2572 100644
>> > >> --- a/drivers/remoteproc/stm32_rproc.c
>> > >> +++ b/drivers/remoteproc/stm32_rproc.c
>> > >> @@ -505,7 +505,7 @@ static struct rproc_ops st_rproc_ops = {
>> > >>  	.load		= rproc_elf_load_segments,
>> > >>  	.parse_fw	= stm32_rproc_parse_fw,
>> > >>  	.find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
>> > >> -	.sanity_check	= rproc_elf_sanity_check,
>> > >> +	.sanity_check	= rproc_elf32_sanity_check,
>> > >>  	.get_boot_addr	= rproc_elf_get_boot_addr,
>> > >>  };
>> > >>  
>> > >> --
> > > >> 2.15.0.276.g89ea799

  reply	other threads:[~2020-03-10 15:38 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200129163013.GA16538@xps15>
2020-02-04 14:33 ` [PATCH v2 1/2] remoteproc: Use u64 len for da_to_va Clement Leger
2020-02-04 14:33   ` [PATCH v2 2/2] remoteproc: Add elf64 support in elf loader Clement Leger
2020-02-04 16:27   ` [PATCH v2 1/2] remoteproc: Use u64 len for da_to_va Arnaud POULIQUEN
2020-02-04 17:10     ` Clément Leger
2020-02-04 17:42       ` Arnaud POULIQUEN
2020-02-04 17:44 ` [PATCH v3 0/2] remoteproc: Add elf64 support to elf loader Clement Leger
2020-02-04 17:44   ` [PATCH v3 1/2] remoteproc: Use u64 len for da_to_va Clement Leger
2020-02-05 21:06     ` Mathieu Poirier
2020-02-04 17:44   ` [PATCH v3 2/2] remoteproc: Add elf64 support in elf loader Clement Leger
2020-02-05 22:49     ` Mathieu Poirier
2020-02-06  8:37       ` Clément Leger
2020-02-06 15:05         ` Clément Leger
2020-02-06 17:48           ` Mathieu Poirier
2020-02-07  7:57             ` Clément Leger
2020-02-10 16:22               ` [PATCH v4 0/5] remoteproc: Add elf64 support Clement Leger
2020-02-10 16:22                 ` [PATCH v4 1/5] remoteproc: Use u64 len for da_to_va Clement Leger
2020-02-11 15:53                   ` Arnaud POULIQUEN
2020-02-11 16:39                     ` Clément Leger
2020-02-11 17:24                       ` Arnaud POULIQUEN
2020-02-11 22:37                       ` Mathieu Poirier
2020-02-12 10:37                         ` Clément Leger
2020-02-12 21:59                           ` Mathieu Poirier
2020-02-18 10:10                             ` Clément Leger
2020-02-18 17:01                               ` Mathieu Poirier
2020-02-10 16:22                 ` [PATCH v4 2/5] remoteproc: Use u64 type for boot_addr Clement Leger
2020-02-10 16:22                 ` [PATCH v4 3/5] remoteproc: Add elf helpers to access elf64 and elf32 fields Clement Leger
2020-02-10 16:22                 ` [PATCH v4 4/5] remoteproc: Add elf64 support in elf loader Clement Leger
2020-02-10 16:22                 ` [PATCH v4 5/5] remoteproc: Adapt coredump to generate correct elf type Clement Leger
2020-02-11 23:11                   ` Mathieu Poirier
2020-02-11 15:57                 ` [PATCH v4 0/5] remoteproc: Add elf64 support Arnaud POULIQUEN
2020-02-11 23:12                   ` Mathieu Poirier
2020-02-12  8:15                     ` Arnaud POULIQUEN
2020-03-02  9:38                 ` [PATCH v5 0/8] " Clement Leger
2020-03-02  9:38                   ` [PATCH v5 1/8] remoteproc: Use size_t type for len in da_to_va Clement Leger
2020-03-02 23:06                     ` Bjorn Andersson
2020-03-09 17:52                     ` Mathieu Poirier
2020-03-27  7:37                     ` Oleksij Rempel
2020-03-02  9:38                   ` [PATCH v5 2/8] remoteproc: Use size_t instead of int for rproc_mem_entry len Clement Leger
2020-03-02 23:07                     ` Bjorn Andersson
2020-03-09 19:21                     ` Mathieu Poirier
2020-03-02  9:38                   ` [PATCH v5 3/8] remoteproc: Use u64 type for boot_addr Clement Leger
2020-03-02 23:08                     ` Bjorn Andersson
2020-03-09 19:52                     ` Mathieu Poirier
2020-03-10  7:59                       ` Clément Leger
2020-03-10 19:32                         ` Bjorn Andersson
2020-03-02  9:38                   ` [PATCH v5 4/8] remoteproc: Add elf helpers to access elf64 and elf32 fields Clement Leger
2020-03-02 23:12                     ` Bjorn Andersson
2020-03-09 19:56                     ` Mathieu Poirier
2020-03-02  9:38                   ` [PATCH v5 5/8] remoteproc: Rename rproc_elf_sanity_check for elf32 Clement Leger
2020-03-02 23:13                     ` Bjorn Andersson
2020-03-03  8:02                       ` Clément Leger
2020-03-10  0:00                         ` Bjorn Andersson
2020-03-10 15:20                           ` Mathieu Poirier
2020-03-10 15:38                             ` Clément Leger [this message]
2020-03-10 19:18                               ` Mathieu Poirier
2020-03-10 19:30                               ` Bjorn Andersson
2020-03-02  9:39                   ` [PATCH v5 6/8] remoteproc: Add elf64 support in elf loader Clement Leger
2020-03-02  9:39                   ` [PATCH v5 7/8] remoteproc: Allow overriding only sanity_check Clement Leger
2020-03-02  9:39                   ` [PATCH v5 8/8] remoteproc: Adapt coredump to generate correct elf type Clement Leger
2020-03-03 22:01                     ` Bjorn Andersson
2020-03-09 20:32                     ` Mathieu Poirier
2020-03-09 23:57                       ` Bjorn Andersson
2020-03-10  8:12                         ` Clément Leger

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=371773363.9138477.1583854699708.JavaMail.zimbra@kalray.eu \
    --to=cleger@kalrayinc.com \
    --cc=agross@kernel.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=corbet@lwn.net \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=loic.pallardy@st.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.com \
    --cc=patrice.chotard@st.com \
    --cc=s-anna@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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;
as well as URLs for NNTP newsgroup(s).