Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp269075ybz; Tue, 21 Apr 2020 08:41:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKABBEziwDlH1uMRzRh9WgiAxQM6B/5ReBYRGDLHlnWxGLPyUcYksbng1s2NO430QNfnIka X-Received: by 2002:a17:906:af59:: with SMTP id ly25mr21778063ejb.65.1587483711088; Tue, 21 Apr 2020 08:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587483711; cv=none; d=google.com; s=arc-20160816; b=OzzxcLAxKJfT+FG/pcHxoDMXl7dggP5mZj1t0Ns/+ZIwET7i9LC1ZkMVW3kZCXnLDz 909hn84KIXh4b81V4CxYVRKyDEfE/agavZBqS/4cuJJv236+qWmki/o3VW261iI2j6W/ OfkPmbBmM68DpOEAdGxXUE2Lsx7/5qSZzxJ4VuIOlROFCgWXba79krDDdGDSGTHGbqnN aNaqrsbuRfSEDiUXEoymB9B78AR0ciUzqK8VNzI5mskv5YWGGKO8QalYUn4QTxE2zeE0 2Lo+nnPhRMT1wnZu4hvOh29fQA0tHTJORuQvcTpk+VlQnCzSiRqrc55zCCtf9fQgKsrZ wFWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=E8Ef7Y9juD0L2yAlkBR135rMMoMAmO27lR7T+Rur6Qs=; b=tg6tkVeKDMtaxTVO1uEfBZA14F0FHRJqhgQNn7yHTcBSTY0FG92DVtznRlcxKVRyYE Lu/tISSrFGJiTJwWQHcN9oxVBRQ0E+PZCyluykX8g9AmTy2ni+u3rJgb9tBC+oLPZ28l CIYyhBc7Kn4Nlhd4QowwsTY1CvRfD3XBy9pTF5I5iEj5BZKdesASBfEO/EdxtoW9+NBJ XDSUgPGwNz4ehGeGCDGs9F1OyOl+6YRIDHI5bQp0J/HFhIZdrZqSGgmqgyt0eiqwxpXk lKsd0bHL/3pMD+MCpgiigyE/0qcbKgdXO4zKgOOZKpLgfl6ngwJcWsxdjbWow9Yr0maX qM0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=WG5rI4ns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s25si1718230edw.441.2020.04.21.08.41.27; Tue, 21 Apr 2020 08:41:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=WG5rI4ns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726398AbgDUPiK (ORCPT + 99 others); Tue, 21 Apr 2020 11:38:10 -0400 Received: from zimbra2.kalray.eu ([92.103.151.219]:59044 "EHLO zimbra2.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbgDUPiJ (ORCPT ); Tue, 21 Apr 2020 11:38:09 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 49B5427E02FA; Tue, 21 Apr 2020 17:38:07 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id NFeVXngl6t0K; Tue, 21 Apr 2020 17:38:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 56BCA27E0A7E; Tue, 21 Apr 2020 17:38:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 56BCA27E0A7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1587483486; bh=E8Ef7Y9juD0L2yAlkBR135rMMoMAmO27lR7T+Rur6Qs=; h=Date:From:To:Message-ID:MIME-Version; b=WG5rI4nsdyZ/n6I/DKusgV+iXVV+IPnkZ25CsrFG8CMWbSpcqpA2APdPsmewJfxSS nHHhSmAIOVf+JEYh4cIqTM9KOfJcvgywN2R19TyeC6boSRDVpK26QVhmTbB6ncy//v ebHQOSRZAuUEmg41DPI6+pDzXKq/NaViizxTWJkI= X-Virus-Scanned: amavisd-new at zimbra2.kalray.eu Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UhMRJdWpDRmw; Tue, 21 Apr 2020 17:38:06 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 3765427E02FA; Tue, 21 Apr 2020 17:38:06 +0200 (CEST) Date: Tue, 21 Apr 2020 17:38:06 +0200 (CEST) From: =?utf-8?Q?Cl=C3=A9ment?= Leger To: s-anna Cc: Ohad Ben-Cohen , Bjorn Andersson , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , linux-remoteproc , linux-kernel , linux-arm-kernel , linux-stm32 Message-ID: <777435415.16656480.1587483486065.JavaMail.zimbra@kalray.eu> In-Reply-To: References: <20200331083336.7459-1-cleger@kalray.eu> <0fc07250-c62c-cb10-58e5-04ccdd6ee176@ti.com> Subject: Re: [PATCH v2] remoteproc: remove rproc_elf32_sanity_check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.40.202] X-Mailer: Zimbra 8.8.15_GA_3895 (ZimbraWebClient - GC81 (Linux)/8.8.15_GA_3895) Thread-Topic: remoteproc: remove rproc_elf32_sanity_check Thread-Index: u5IOaZRLFAz0NztRXGyHwYidGzKInw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anna, ----- On 21 Apr, 2020, at 17:30, s-anna s-anna@ti.com wrote: > Hi Clement, >=20 > On 3/31/20 10:13 AM, Suman Anna wrote: >> On 3/31/20 3:33 AM, Clement Leger wrote: >>> Since checks are present in the remoteproc elf loader before calling >>> da_to_va, loading a elf64 will work on 32bits flavors of kernel. >>> Indeed, if a segment size is larger than what size_t can hold, the >>> loader will return an error so the functionality is equivalent to >>> what exists today. >>> >>> Signed-off-by: Clement Leger >>=20 >> Acked-by: Suman Anna >=20 > Can you repost this after rebasing on top of the rproc-next branch > which has the rproc_alloc refactoring changes pushed now? Yes, I will do that. Regards, Cl=C3=A9ment >=20 > regards > Suman >=20 >>=20 >> regards >> Suman >>=20 >>> --- >>> Changes from v1 -> v2: >>> - Remove possibity to override sanity_check operation >>> >>> drivers/remoteproc/remoteproc_core.c | 3 +-- >>> drivers/remoteproc/remoteproc_elf_loader.c | 21 --------------------- >>> drivers/remoteproc/remoteproc_internal.h | 1 - >>> drivers/remoteproc/st_remoteproc.c | 2 +- >>> drivers/remoteproc/st_slim_rproc.c | 2 +- >>> drivers/remoteproc/stm32_rproc.c | 2 +- >>> 6 files changed, 4 insertions(+), 27 deletions(-) >>> >>> diff --git a/drivers/remoteproc/remoteproc_core.c >>> b/drivers/remoteproc/remoteproc_core.c >>> index a9ac1d01e09b..191560048c1a 100644 >>> --- a/drivers/remoteproc/remoteproc_core.c >>> +++ b/drivers/remoteproc/remoteproc_core.c >>> @@ -2068,8 +2068,7 @@ struct rproc *rproc_alloc(struct device *dev, con= st char >>> *name, >>> =09=09rproc->ops->load =3D rproc_elf_load_segments; >>> =09=09rproc->ops->parse_fw =3D rproc_elf_load_rsc_table; >>> =09=09rproc->ops->find_loaded_rsc_table =3D rproc_elf_find_loaded_rsc= _table; >>> -=09=09if (!rproc->ops->sanity_check) >>> -=09=09=09rproc->ops->sanity_check =3D rproc_elf32_sanity_check; >>> +=09=09rproc->ops->sanity_check =3D rproc_elf_sanity_check; >>> =09=09rproc->ops->get_boot_addr =3D rproc_elf_get_boot_addr; >>> =09} >>> =20 >>> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c >>> b/drivers/remoteproc/remoteproc_elf_loader.c >>> index 16e2c496fd45..29034f99898d 100644 >>> --- a/drivers/remoteproc/remoteproc_elf_loader.c >>> +++ b/drivers/remoteproc/remoteproc_elf_loader.c >>> @@ -112,27 +112,6 @@ int rproc_elf_sanity_check(struct rproc *rproc, co= nst >>> struct firmware *fw) >>> } >>> EXPORT_SYMBOL(rproc_elf_sanity_check); >>> =20 >>> -/** >>> - * rproc_elf_sanity_check() - Sanity Check ELF32 firmware image >>> - * @rproc: the remote processor handle >>> - * @fw: the ELF32 firmware image >>> - * >>> - * Make sure this fw image is sane. >>> - */ >>> -int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmwar= e *fw) >>> -{ >>> -=09int ret =3D rproc_elf_sanity_check(rproc, fw); >>> - >>> -=09if (ret) >>> -=09=09return ret; >>> - >>> -=09if (fw_elf_get_class(fw) =3D=3D ELFCLASS32) >>> -=09=09return 0; >>> - >>> -=09return -EINVAL; >>> -} >>> -EXPORT_SYMBOL(rproc_elf32_sanity_check); >>> - >>> /** >>> * rproc_elf_get_boot_addr() - Get rproc's boot address. >>> * @rproc: the remote processor handle >>> diff --git a/drivers/remoteproc/remoteproc_internal.h >>> b/drivers/remoteproc/remoteproc_internal.h >>> index b389dc79da81..31994715fd43 100644 >>> --- a/drivers/remoteproc/remoteproc_internal.h >>> +++ b/drivers/remoteproc/remoteproc_internal.h >>> @@ -54,7 +54,6 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, siz= e_t len); >>> phys_addr_t rproc_va_to_pa(void *cpu_addr); >>> int rproc_trigger_recovery(struct rproc *rproc); >>> =20 >>> -int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmwar= e *fw); >>> int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware= *fw); >>> u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmwar= e *fw); >>> int rproc_elf_load_segments(struct rproc *rproc, const struct firmwar= e *fw); >>> diff --git a/drivers/remoteproc/st_remoteproc.c >>> b/drivers/remoteproc/st_remoteproc.c >>> index a6cbfa452764..a3268d95a50e 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 =3D { >>> =09.parse_fw=09=09=3D st_rproc_parse_fw, >>> =09.load=09=09=09=3D rproc_elf_load_segments, >>> =09.find_loaded_rsc_table=09=3D rproc_elf_find_loaded_rsc_table, >>> -=09.sanity_check=09=09=3D rproc_elf32_sanity_check, >>> +=09.sanity_check=09=09=3D rproc_elf_sanity_check, >>> =09.get_boot_addr=09=09=3D rproc_elf_get_boot_addr, >>> }; >>> =20 >>> diff --git a/drivers/remoteproc/st_slim_rproc.c >>> b/drivers/remoteproc/st_slim_rproc.c >>> index 3cca8b65a8db..09bcb4d8b9e0 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 =3D { >>> =09.da_to_va =3D slim_rproc_da_to_va, >>> =09.get_boot_addr=09=3D rproc_elf_get_boot_addr, >>> =09.load=09=09=3D rproc_elf_load_segments, >>> -=09.sanity_check=09=3D rproc_elf32_sanity_check, >>> +=09.sanity_check=09=3D rproc_elf_sanity_check, >>> }; >>> =20 >>> /** >>> diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm3= 2_rproc.c >>> index 6a66dbf2df40..2e07a95439c8 100644 >>> --- a/drivers/remoteproc/stm32_rproc.c >>> +++ b/drivers/remoteproc/stm32_rproc.c >>> @@ -505,7 +505,7 @@ static struct rproc_ops st_rproc_ops =3D { >>> =09.load=09=09=3D rproc_elf_load_segments, >>> =09.parse_fw=09=3D stm32_rproc_parse_fw, >>> =09.find_loaded_rsc_table =3D rproc_elf_find_loaded_rsc_table, >>> -=09.sanity_check=09=3D rproc_elf32_sanity_check, >>> +=09.sanity_check=09=3D rproc_elf_sanity_check, >>> =09.get_boot_addr=09=3D rproc_elf_get_boot_addr, >>> }; >>> =20 >>>