From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6D56C2B9F4 for ; Mon, 28 Jun 2021 16:16:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA68D61C65 for ; Mon, 28 Jun 2021 16:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232530AbhF1QTR (ORCPT ); Mon, 28 Jun 2021 12:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbhF1QTQ (ORCPT ); Mon, 28 Jun 2021 12:19:16 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07F77C061574 for ; Mon, 28 Jun 2021 09:16:50 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id h24-20020a9d64180000b029036edcf8f9a6so19331058otl.3 for ; Mon, 28 Jun 2021 09:16:50 -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:in-reply-to; bh=sS3AX7gjw8RzAmQQDxkf4nTKNQiXmQsIziEYwVLXXqE=; b=Crom6oqZjvmuQ7HTaOKYr32eQUnC7kJJFa1OaRR9nkFkMV75RlDZZiMu8ASZsZdh5m LkmEy47LSUq9GavP19ZREQyvyHIb97qXa2i1enG90hWxB/VdZrMJJaXhDasTX6PrGx75 O23nDYNFsALK4H/zzkolf3zHUHHSoFkxofhGt8cdj0FTt91R4IZ7Y3BZAQy0YpMWgFsm aLxoXBUwc0LGOk0f2uEKuLdpZQg+Im/Blo3YmWfunsA7/GJTQn2SaOgYFA+ObtZ1KNOJ rsF93vOJGguV5ZirT5cn5AQ7sCMO5untNYCe4nLHwduwGPALV9+nP27vUFnKBVWek82F MXow== 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:in-reply-to; bh=sS3AX7gjw8RzAmQQDxkf4nTKNQiXmQsIziEYwVLXXqE=; b=dKp/CFij89CtjDh3hthnwGWTEe27XJeLZLitbsOXhBWCOrb6faGptRPZxBkd0NR9Gl 96E8qC0AiIlCvYzSNE6TtVkZE4C++zQjFQs4YZ81+fCClqT2zlkWzrreXHbnEJ4q4c/Y 2W3D2OLGOL97WY2GEis78Rx3FxB0mI8NLXWABSr5AqCl2I9YHtIUzxP/M0lAZ3mamtLG BOTeWGC9cFsSLZuNPBb5sk4/+kfyUc7vsxBUVLiuZv6HMPLamGXVRNbKVZg5+uIWA5yg oWw+AWVNFaZbSEzxx53eICUws7FtCL08vt+zAf1jlwXE/ivkW+LYCkQaJN6WAWgcovG+ WDgw== X-Gm-Message-State: AOAM532mxIpwW0suIR9y1Gve4TU2aLbFOlOTEWb3WVmDEG/PWFFCoqeP daqxScVi6+yLY2rq4ZgHiisuqg== X-Google-Smtp-Source: ABdhPJwZz+jLXv5MDMWYEBw2K8nW1xownzeKeRVGw7taqDhESdaLxCJsIE1l4K6aIdQkx2sKI3yW3A== X-Received: by 2002:a9d:5e17:: with SMTP id d23mr307765oti.330.1624897009316; Mon, 28 Jun 2021 09:16:49 -0700 (PDT) Received: from yoga (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id p10sm3682896otf.45.2021.06.28.09.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 09:16:48 -0700 (PDT) Date: Mon, 28 Jun 2021 11:16:46 -0500 From: Bjorn Andersson To: "Peng Fan (OSS)" Cc: ohad@wizery.com, mathieu.poirier@linaro.org, o.rempel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, aisheng.dong@nxp.com, Peng Fan Subject: Re: [PATCH] remoteproc: elf_loader: fix loading segment when is_iomem true Message-ID: References: <20210628070657.7669-1-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210628070657.7669-1-peng.fan@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org On Mon 28 Jun 02:06 CDT 2021, Peng Fan (OSS) wrote: > From: Peng Fan > > It seems luckliy work on i.MX platform, but it is wrong. > Need use memcpy_toio, not memcpy_fromio. > > Fixes: 40df0a91b2a52 ("remoteproc: add is_iomem to da_to_va") > Tested-by: Dong Aisheng (i.MX8MQ) > Reported-by: Dong Aisheng > Signed-off-by: Peng Fan > --- > drivers/remoteproc/remoteproc_elf_loader.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c > index 469c52e62faf..e8078efb3dec 100644 > --- a/drivers/remoteproc/remoteproc_elf_loader.c > +++ b/drivers/remoteproc/remoteproc_elf_loader.c > @@ -220,7 +220,7 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) > /* put the segment where the remote processor expects it */ > if (filesz) { > if (is_iomem) > - memcpy_fromio(ptr, (void __iomem *)(elf_data + offset), filesz); > + memcpy_toio(ptr, (void __iomem *)(elf_data + offset), filesz); Ouch, we should have caught that during the review, thanks for spotting and fixing this. That said, it's the ptr that's __iomem, so the cast should be on the first parameter, not the second. Regards, Bjorn > else > memcpy(ptr, elf_data + offset, filesz); > } > -- > 2.30.0 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BF07C2B9F4 for ; Mon, 28 Jun 2021 16:18:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5456161C65 for ; Mon, 28 Jun 2021 16:18:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5456161C65 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9JW/m7VgPJUXMtsQ54PCsQzZ8ldghJYjSkiT9IrqY5Y=; b=MZN7HnwRWto0j9 PvTqPXmAvTZYtCHPb8T3SDpxfo0KBfwD7iPB5sZ/hRIUpiABg8ym6Hxz9LWd86vW3CGPGfdTD+6+n k57Nqef9yOTO1hciJ0dX/Bf808mUoI63y+t3wVlhbeZGyAbosYTd4FKWW7hyRvhMVBsR7O49m7/hm OFK1Snh0E5EYXwzM+fPp47iPehnfJXnT1r51Znl65QQ9cQDoTefwzzqpl+LaYfjmBZW6R4wDnMAbl PVmFPNaoanNU+OLtzizCPNM4S0Fj1ZaxVYb+smOZVBOvyO4/lzsIB1wtuR282K/BpMcm8yOpj4NTX uwGNDDSwizgkQYYEAb3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lxtwN-008Ynn-3Z; Mon, 28 Jun 2021 16:16:55 +0000 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lxtwJ-008YmZ-9M for linux-arm-kernel@lists.infradead.org; Mon, 28 Jun 2021 16:16:52 +0000 Received: by mail-ot1-x32f.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso19325889otu.10 for ; Mon, 28 Jun 2021 09:16:49 -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:in-reply-to; bh=sS3AX7gjw8RzAmQQDxkf4nTKNQiXmQsIziEYwVLXXqE=; b=Crom6oqZjvmuQ7HTaOKYr32eQUnC7kJJFa1OaRR9nkFkMV75RlDZZiMu8ASZsZdh5m LkmEy47LSUq9GavP19ZREQyvyHIb97qXa2i1enG90hWxB/VdZrMJJaXhDasTX6PrGx75 O23nDYNFsALK4H/zzkolf3zHUHHSoFkxofhGt8cdj0FTt91R4IZ7Y3BZAQy0YpMWgFsm aLxoXBUwc0LGOk0f2uEKuLdpZQg+Im/Blo3YmWfunsA7/GJTQn2SaOgYFA+ObtZ1KNOJ rsF93vOJGguV5ZirT5cn5AQ7sCMO5untNYCe4nLHwduwGPALV9+nP27vUFnKBVWek82F MXow== 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:in-reply-to; bh=sS3AX7gjw8RzAmQQDxkf4nTKNQiXmQsIziEYwVLXXqE=; b=d3opsuHoFgcAoY/uYtxX/EVpGCr+nTbUuiRZLMBOChDnbqcjoISm3herNKFcN8jLvI DUG7bqE3rixr9YYMJQNkS1hugred5Ri9LGkRhfeNTX8/Omk1kITd4e4JEsbj+8FCH3rq 7yeUndzZDK2DEI3UHGyf82GdtttN8XL6XAOjqYbeTCpTGdTwAker4j4/cIPVmdWfgPsR mAjgQNFLqv/6j2gEKvkA7RL27mDGY58RX7E0JDMthxrkvZn224hCGA/5ceANUDwOYodG 9FcMh1SpbQoJvJ6WJntxTsvEKl4qiNeAnaKtXXqBbzex3MY3CwR7gc/xwuipYUFM0jIo YXLQ== X-Gm-Message-State: AOAM533S5FHLho/08kuK9w9GuYOLfCbIwEATnuwM1rqrLnAOvA2xMTFf /thmhSnPK2OwlyhDJR/mMKvkaw== X-Google-Smtp-Source: ABdhPJwZz+jLXv5MDMWYEBw2K8nW1xownzeKeRVGw7taqDhESdaLxCJsIE1l4K6aIdQkx2sKI3yW3A== X-Received: by 2002:a9d:5e17:: with SMTP id d23mr307765oti.330.1624897009316; Mon, 28 Jun 2021 09:16:49 -0700 (PDT) Received: from yoga (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id p10sm3682896otf.45.2021.06.28.09.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 09:16:48 -0700 (PDT) Date: Mon, 28 Jun 2021 11:16:46 -0500 From: Bjorn Andersson To: "Peng Fan (OSS)" Cc: ohad@wizery.com, mathieu.poirier@linaro.org, o.rempel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, aisheng.dong@nxp.com, Peng Fan Subject: Re: [PATCH] remoteproc: elf_loader: fix loading segment when is_iomem true Message-ID: References: <20210628070657.7669-1-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210628070657.7669-1-peng.fan@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210628_091651_400392_314C881F X-CRM114-Status: GOOD ( 18.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon 28 Jun 02:06 CDT 2021, Peng Fan (OSS) wrote: > From: Peng Fan > > It seems luckliy work on i.MX platform, but it is wrong. > Need use memcpy_toio, not memcpy_fromio. > > Fixes: 40df0a91b2a52 ("remoteproc: add is_iomem to da_to_va") > Tested-by: Dong Aisheng (i.MX8MQ) > Reported-by: Dong Aisheng > Signed-off-by: Peng Fan > --- > drivers/remoteproc/remoteproc_elf_loader.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c > index 469c52e62faf..e8078efb3dec 100644 > --- a/drivers/remoteproc/remoteproc_elf_loader.c > +++ b/drivers/remoteproc/remoteproc_elf_loader.c > @@ -220,7 +220,7 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) > /* put the segment where the remote processor expects it */ > if (filesz) { > if (is_iomem) > - memcpy_fromio(ptr, (void __iomem *)(elf_data + offset), filesz); > + memcpy_toio(ptr, (void __iomem *)(elf_data + offset), filesz); Ouch, we should have caught that during the review, thanks for spotting and fixing this. That said, it's the ptr that's __iomem, so the cast should be on the first parameter, not the second. Regards, Bjorn > else > memcpy(ptr, elf_data + offset, filesz); > } > -- > 2.30.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel