Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1205167ybz; Wed, 22 Apr 2020 15:51:38 -0700 (PDT) X-Google-Smtp-Source: APiQypJJBeGiUyFrNnJc3U/0a5f01V/TZtA3epQa47euGod4PLeXhNyJOqlq+VnfNxBa6gABTeyl X-Received: by 2002:a05:6402:688:: with SMTP id f8mr661107edy.233.1587595898823; Wed, 22 Apr 2020 15:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587595898; cv=none; d=google.com; s=arc-20160816; b=UnUl1ggMqKJShhKu8sEwXsIk9UuIFTfsV7xraTfujkQ2yf96dgYXm1n7EY6KVyWHvH Hs/SifbzbrVksRq6eDAwGCfu7L1R3eh0Z4Filyux9PQCKmJPw3sokc8ElqO0JYSQJ2SL ZoJ9t8UDvL68dFQTTMs3eDxewbmARjxIg6Z2MYArQ49h6O1MS2nvi7w5iG+9mfy17cSV BHebYOTOa7l9uLyKSkTbi57+53Mhp9hfPmbKmkwLOBd8HQRCPfz6KETQxSc1DAkhkWyo 6BrF40f2dBAR/dX/5/6fpI27rAvUBjAgobJ7C5dVyOmo0iBQHmzSUdcYiVg2FtoIpSrm 9P5g== 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=jsrBvyKjoBsK7Qmp/aFfEnqPrRNBCyW5gwbg2tXfVtw=; b=cLQR9rmUVJVefumDmEg2V6WiL+LEvYMnZVxhufEvmBjDFeaq+PQCS4L4NrTIGYwgud yJEokA6zuTnl7vbOFqbBTSc/VacY2Socvtm9YET6I8gAb1FSR6D60IiDD5ol8OCaH5ot ZO4bpoC/DNUp1SXW5SprqgiP0Xd7ljv6iz/w05UQd88F8qZtA47jGP1pg2g7s8GzjlMf kBK+ZTafz8F3oJ0kPKp8ahiq//Cq2lpSnY1eKiJoZXX4A68/cAwbKKKIkPaMzeIVSerj wZD67T/3cD82YMEd6dxmShqn3yfA+PJkckwHr9dyku7JoDt9j+GBeUL5FdAL9N/nzCPY KWeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=W1EAICsv; 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=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si300330edd.313.2020.04.22.15.51.14; Wed, 22 Apr 2020 15:51:38 -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=@ti.com header.s=ti-com-17Q1 header.b=W1EAICsv; 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=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbgDVWtP (ORCPT + 99 others); Wed, 22 Apr 2020 18:49:15 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:33276 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbgDVWtP (ORCPT ); Wed, 22 Apr 2020 18:49:15 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 03MMmoTS102812; Wed, 22 Apr 2020 17:48:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1587595730; bh=jsrBvyKjoBsK7Qmp/aFfEnqPrRNBCyW5gwbg2tXfVtw=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=W1EAICsvSyxyQObunoinLfIA3bqsed6uzNJ0heuA2Qy/rNtJUNbVN2fp/VOgz2Vag tpaVjNepeJ8cvBBife5/tLswhLfzeRqqhBmEMNChsOzzPz6EnPgdVuK8NsdP+a20FC LL7s26/UnBkUgdIkgI5cC4RGc5BjJ6BL+KNPkgX0= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 03MMmoQx040209; Wed, 22 Apr 2020 17:48:50 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Wed, 22 Apr 2020 17:48:50 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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.1979.3 via Frontend Transport; Wed, 22 Apr 2020 17:48:50 -0500 Received: from [10.250.70.56] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 03MMmn2S080922; Wed, 22 Apr 2020 17:48:49 -0500 Subject: Re: [PATCH v3] remoteproc: remove rproc_elf32_sanity_check To: Clement Leger , Ohad Ben-Cohen , Bjorn Andersson , Patrice Chotard , Maxime Coquelin , Alexandre Torgue CC: , , , References: <20200422093017.10985-1-cleger@kalray.eu> From: Suman Anna Message-ID: Date: Wed, 22 Apr 2020 17:48:49 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200422093017.10985-1-cleger@kalray.eu> Content-Type: text/plain; charset="utf-8"; format=flowed 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 4/22/20 4:30 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 With this patch, I can drop the specific assignment in my 64-bit C71 DSP remoteproc driver. regards Suman > --- > Changes from v2 -> v3: > - Rebase on rproc-next branch > > 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 448262470fc7..206363723071 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -2069,8 +2069,7 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops) > 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; > > return 0; > diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c > index 4869fb7d8fe4..df68d87752e4 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 0f9d02ca4f5a..f45b8d597da0 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, > }; > >