Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3592720ybb; Tue, 31 Mar 2020 08:14:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvQRfst/b8YZXwXh9Oorf3TdKRo72lpaRvoGfFE67UgnkjB2cX2Sl8iVBS+mV+QdhGHTias X-Received: by 2002:a9d:2002:: with SMTP id n2mr1677576ota.127.1585667656452; Tue, 31 Mar 2020 08:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585667656; cv=none; d=google.com; s=arc-20160816; b=gn+HU15OQKbMesamVSb+m1GlQChf8jIh0anzn3LKofA2FMF5tsRi5XJxFAC7snlqEc C/Wn8JMXkhDslHfv4iWOD6NOVaMRiD5kX2PgbWgTjRa6A++ICmaSA9swGlZiJClwxmmt VDqn9RIGhqMd0InwfQaBzacpKPKMsPWzICZmMn8S/gqWOL/MMjL/Zfrzi65hzNvKXFeB SVPI8yjzE3cIX4E6HU9un28YW9A9YFXvC09MOZgPwZsiMYt4vfH1BhD3IboxdeFU3MMl nXiOe43MujpEieU63TqbJlSx/1W6BJrME0vrFb8520mX3Y00uhIQv6ihOXwcjd7bQQNu B5+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=RoMDzKc2+/VDiXGdwwD1RSQ05yOF2jkqG94nB8oDMZA=; b=eFYqhuOxw/bt3+n46EAu9jsbBIR5lsX+rj2UtNcYnO7hJruhbvhMJUjMRmVjElqUV/ APeZDcfSMgFaspymAXhlVrH2u4/hz8q2ErEXMDqVHPom5RJ3vF5oTH4EtsQrYIbGxbDO e9ltnVSJN/NhfjHHB3ccwWjlZKn1pfCTdpUwasen/m8qsikq5tSpmYSn7YUntFGr5qmj yobQVou3qPOhtUIQWDfkyBAEAXfbVVUVpjaM2W9UWv00L6FBQilTFUDS2OC/TJjjtwLt PhVwnzc9Z6wO+rTeI6Kv5ei+UrqcYjjjkAgTmKUsIT8uIKQIqiNs67JW2KDVt8G1ISxL VdTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kGU35WNa; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w129si6577157oia.232.2020.03.31.08.14.03; Tue, 31 Mar 2020 08:14:16 -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=@ti.com header.s=ti-com-17Q1 header.b=kGU35WNa; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730715AbgCaPNk (ORCPT + 99 others); Tue, 31 Mar 2020 11:13:40 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:41200 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730466AbgCaPNj (ORCPT ); Tue, 31 Mar 2020 11:13:39 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 02VFD8g4118835; Tue, 31 Mar 2020 10:13:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1585667588; bh=RoMDzKc2+/VDiXGdwwD1RSQ05yOF2jkqG94nB8oDMZA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=kGU35WNa8EiKD9S5xaTn9wze6HFMz8Tx6CalzVqgXZLBb2NA4QGYAi/OuczfoMpXw yOI6HIi/hULN0UjaXSW1Vki00b+6oishY8WVMzr1YeUm/SMkYInTbR3S17NV1vCt5q 6LF/ebqoo3LNiqLbkbhmzPfC8GQEgNlJZsYbE3Ms= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 02VFD8W4014945 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 31 Mar 2020 10:13:08 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 31 Mar 2020 10:13:08 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 31 Mar 2020 10:13:08 -0500 Received: from [10.250.86.212] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 02VFD7C7005470; Tue, 31 Mar 2020 10:13:07 -0500 Subject: Re: [PATCH v2] remoteproc: remove rproc_elf32_sanity_check To: Clement Leger , Ohad Ben-Cohen , Bjorn Andersson , Patrice Chotard , Maxime Coquelin , Alexandre Torgue CC: , , , References: <20200331083336.7459-1-cleger@kalray.eu> From: Suman Anna Message-ID: <0fc07250-c62c-cb10-58e5-04ccdd6ee176@ti.com> Date: Tue, 31 Mar 2020 10:13:07 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20200331083336.7459-1-cleger@kalray.eu> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Suman Anna regards Suman > --- > 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, 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; > - if (!rproc->ops->sanity_check) > - rproc->ops->sanity_check = rproc_elf32_sanity_check; > + rproc->ops->sanity_check = rproc_elf_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 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, const struct firmware *fw) > } > EXPORT_SYMBOL(rproc_elf_sanity_check); > > -/** > - * 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 firmware *fw) > -{ > - int ret = rproc_elf_sanity_check(rproc, fw); > - > - if (ret) > - return ret; > - > - if (fw_elf_get_class(fw) == ELFCLASS32) > - return 0; > - > - return -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, size_t len); > phys_addr_t rproc_va_to_pa(void *cpu_addr); > int rproc_trigger_recovery(struct rproc *rproc); > > -int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw); > int rproc_elf_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); > 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 = { > .parse_fw = st_rproc_parse_fw, > .load = rproc_elf_load_segments, > .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, > - .sanity_check = rproc_elf32_sanity_check, > + .sanity_check = rproc_elf_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 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 = { > .da_to_va = slim_rproc_da_to_va, > .get_boot_addr = rproc_elf_get_boot_addr, > .load = rproc_elf_load_segments, > - .sanity_check = rproc_elf32_sanity_check, > + .sanity_check = rproc_elf_sanity_check, > }; > > /** > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_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 = { > .load = rproc_elf_load_segments, > .parse_fw = stm32_rproc_parse_fw, > .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, > - .sanity_check = rproc_elf32_sanity_check, > + .sanity_check = rproc_elf_sanity_check, > .get_boot_addr = rproc_elf_get_boot_addr, > }; > >