Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp794091ybh; Tue, 10 Mar 2020 08:22:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu1gRimMy7oK08ktp3J6nLy4yM+YIO3fhg/F9Iv3AnusZ64AFXiAjPLTpUY+L/7r1EWAvYs X-Received: by 2002:a05:6808:b17:: with SMTP id s23mr1612976oij.166.1583853746062; Tue, 10 Mar 2020 08:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583853746; cv=none; d=google.com; s=arc-20160816; b=TYKnRZzz1CbZLjjwlwwA+0RvhPcP2fHCM4AG7/d9U19ar67VZgPe1fzHtqyBWTOsCc pC7D7iJoYeAWqI+yfA3aC6wJbJj+YPk8E1+iVGHDB1WZaBSjOnijZofLv1pn+umxq0Eo YosxfaZUwCICbJTs3suDnNPaRly9cZOQGuzFMbFt2zJzhe/IB7uMlRmkd8yGHO2NSDMc GGN0e23yIr9lokKzOM7rcnlinSu4d31xBjMYcP1LrBdOq7m9PqgIUPn0U/YBc7iMQMIE irqgAMgE4dGSNx1OcdUltGgucKn3zAIzfDH+vtPE4PksZQHRMdtbMawORNj0LvQwBadP S7xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6MhFgIdze8CFf2DOrBawMYLjN6c8ytgEy4KTgM5UsKI=; b=I27KChV2PauzCt+R1QY5BaUsLxDHDI0tfK/mzhBT6DhzZIeVZVw4In6s2aHOf1xH1+ aTEAgq7DnQEkaSu+UrAczXI1Ms4+geBIKMa0MgIM3S/SWN6v0q5zN4HRXw1ElqbPfn0E TTHg7dwOJqrv46P0qFIOtxFUSYfkhIYBukwR9L73PviEiCQzwg/smnR8dpTapRjq8be2 DLq92svihX78lvV6NGwuqu/K0OiMANkVVuVkZFAAmUWEn4/RB5PB46OKTjgzVie8H8gC aIKQqY16fdE/9UdZRxCMHRZOr+EjXXnNWp5rvEx/tfMvlZG6Dn/M2SZ2QePIKj+DWHO2 yoXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/zNCZ70"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si5342929oic.57.2020.03.10.08.22.10; Tue, 10 Mar 2020 08:22:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/zNCZ70"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727816AbgCJPUf (ORCPT + 99 others); Tue, 10 Mar 2020 11:20:35 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41700 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727806AbgCJPUf (ORCPT ); Tue, 10 Mar 2020 11:20:35 -0400 Received: by mail-pf1-f194.google.com with SMTP id z65so6613911pfz.8 for ; Tue, 10 Mar 2020 08:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=6MhFgIdze8CFf2DOrBawMYLjN6c8ytgEy4KTgM5UsKI=; b=m/zNCZ70DcHzitOz0JSTs00aicOWLVtUPobgMC2juOgSuvBdRUs2ULP0Ups4xAIQ4+ GkiAoRRV7UEuj9/HSK3R8iaYqmCTarzCPhjS+DlYPrfcEvSBosUBkj+izKK2cQjS8BjW GFq1ZXcm0Cgr3caOvqgwfypDmqe3jbdjn018IQLTmBYACIgMYqij/5lRoPNNCUMhGdhX gTfK86J+0GkyCRD62BYej6x5QSHQ4y6zPt7H+6m6gOtGalne8wVoFc0jlhTdYfolU+Qu Ng3TUPVBRljKkoRg3ffG8G99Z61/jah0DJbo9NMGFbjDtP1dnbj6HzePS3abQQ81/6bp UdNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=6MhFgIdze8CFf2DOrBawMYLjN6c8ytgEy4KTgM5UsKI=; b=LCnEhNuIZ0pVokJUchhPaAfFtdxY12YvvmLNxLGtmuImnJ+ZQia6IwCBKbgfSG292J R+rsuxRPO1tSiad/Ub9MSTk2juK74n1IYCa3N31wtYuiovNkNmtBi9/gGX4oP0pF9vmh Bc2N3pvviCkxxTNNd7fzBWiu7Ezlw0PTzkJGKFQBPrdiDgk2jlqdR6kuGmyUsRM9iLbs EioYlIXo+nO6ftrZ9BHqMyzcXT+ZOKG1NeDVwWdKV3heEDo46ft18kpKcwuBc9VGBr47 1HQyu300bhQbIeIK4sd/+8UyW5DrqBWDUo6vZS1WCW7VGUISsDYxthStPfYx3DBYraDl V2CA== X-Gm-Message-State: ANhLgQ0e5ukBt/YrZgpX3LwOBB8267mEQJBS++zYhQr27MSTlHVQhX9p +0Yvh0xUFWLYiNW5605bvqmtGQ== X-Received: by 2002:a62:ce48:: with SMTP id y69mr10163479pfg.178.1583853634107; Tue, 10 Mar 2020 08:20:34 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id dw19sm2662207pjb.16.2020.03.10.08.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:20:33 -0700 (PDT) Date: Tue, 10 Mar 2020 09:20:31 -0600 From: Mathieu Poirier To: Bjorn Andersson Cc: Cl?ment Leger , Ohad Ben-Cohen , Jonathan Corbet , Shawn Guo , Sascha Hauer , linux-remoteproc , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andy Gross , Patrice Chotard , linux-doc , linux-kernel , linux-arm-kernel , linux-arm-msm , Arnaud Pouliquen , Loic PALLARDY , s-anna Subject: Re: [PATCH v5 5/8] remoteproc: Rename rproc_elf_sanity_check for elf32 Message-ID: <20200310152031.GA25781@xps15> References: <20200210162209.23149-1-cleger@kalray.eu> <20200302093902.27849-1-cleger@kalray.eu> <20200302093902.27849-6-cleger@kalray.eu> <20200302231342.GE262924@yoga> <482678048.7666348.1583222551942.JavaMail.zimbra@kalray.eu> <20200310000005.GF14744@builder> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200310000005.GF14744@builder> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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... Thanks Mathieu > > Regards, > Bjorn > > > Regards, > > > > Cl?ment > > > > > > > > Regards, > > > Bjorn > > > > > >> Signed-off-by: Clement Leger > > >> --- > > >> 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