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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 46D70C2B9F4 for ; Tue, 22 Jun 2021 07:50:42 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A8BB611AF for ; Tue, 22 Jun 2021 07:50:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A8BB611AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 04A4C82976; Tue, 22 Jun 2021 09:50:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="KXQZ/uw/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4FAFA8296A; Tue, 22 Jun 2021 09:50:37 +0200 (CEST) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 72D658296A for ; Tue, 22 Jun 2021 09:50:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jh80.chung@samsung.com Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210622075028epoutp024c0ab27a641d8b2b6dc16a83e1a0f322~K2BumwDcV2273922739epoutp02F for ; Tue, 22 Jun 2021 07:50:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210622075028epoutp024c0ab27a641d8b2b6dc16a83e1a0f322~K2BumwDcV2273922739epoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1624348228; bh=ApVj6bcstDBsr3WeZcZ0daLnakZrns2IvIVSrtnORW0=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=KXQZ/uw//7BnNf8GzCzH4dcPR/Kadfffv57nkqtogFOoEOvBDVDT0F07KJ8SRnakH 8Ftn7IQoS6Hg/unhwsDWEg/eueH/mS3N1KIBpeH5R2s14YF5f8dbg2zzGe/PHf+BBc Ce+qJu0LQfJhKLkmeDEtacWL1H6NxZIfoMFtPfIU= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20210622075028epcas1p37040181614428fa9a992f7c044345e82~K2BuVvcy90770707707epcas1p3L; Tue, 22 Jun 2021 07:50:28 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.40.152]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4G8JTt2QWzz4x9Pw; Tue, 22 Jun 2021 07:50:26 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 20.AB.09468.24691D06; Tue, 22 Jun 2021 16:50:26 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210622075025epcas1p165866b814f05e3172c619d3de455b0e5~K2BrjlIKY3083030830epcas1p1S; Tue, 22 Jun 2021 07:50:25 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210622075025epsmtrp1b28672c58e53d4b22bd2a4deb5f9f111~K2BrigfqW2980429804epsmtrp1i; Tue, 22 Jun 2021 07:50:25 +0000 (GMT) X-AuditID: b6c32a37-0c7ff700000024fc-6e-60d19642ba42 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2E.8B.08394.14691D06; Tue, 22 Jun 2021 16:50:25 +0900 (KST) Received: from [10.113.113.235] (unknown [10.113.113.235]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210622075025epsmtip236ea8cf11b6dd01a4ae5d8e8c2c19761~K2BrUpguW2322323223epsmtip2d; Tue, 22 Jun 2021 07:50:25 +0000 (GMT) Subject: Re: [PATCH] mmc: rpmb: Fix driver routing memory alignment with tmp buffer To: "litchi.pi" , u-boot@lists.denx.de Cc: Peng Fan , Jens Wiklander , "xypron.glpk@gmx.de" From: Jaehoon Chung Message-ID: <324d47a9-ff6b-b73e-1b05-37d6c126884f@samsung.com> Date: Tue, 22 Jun 2021 16:51:20 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphk+LIzCtJLcpLzFFi42LZdlhTV9dp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AObT6q7+AgAA X-CMS-MailID: 20210622075025epcas1p165866b814f05e3172c619d3de455b0e5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210622072448epcas1p3e8e6a18b3389eecabed6df44c2984bbb References: <20210615085255.24899-1-litchi.pi@protonmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi, On 6/22/21 4:24 PM, litchi.pi wrote: > Hello, > Does anyone have a feedback on that fix ? > I think the location of the fix is important to be discussed too as it needs to be generic but not overlap with existing checks. > Have a nice day, Reviewed-by: Jaehoon Chung Best Regards, Jaehoon Chung > Timothée Cercueil > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > > On Tuesday, June 15th, 2021 at 10:53 AM, Timothée Cercueil wrote: > >> From: litchipi litchi.pi@protonmail.com >> >> Fix mmc_rpmb_route_frames() implementation to comply with most MMC >> >> drivers that expect some alignment of MMC data frames in memory. >> >> When called from drivers/tee/optee/rpmb.c, the address passed is not >> >> aligned properly. OP-TEE OS inserts a 6-byte header before a raw RPMB >> >> frame which makes RPMB data buffer not 32bit aligned. To prevent breaking >> >> ABI with OPTEE-OS RPC memrefs, allocate a temporary buffer to copy the >> >> data into an aligned memory. >> >> Many RPMB drivers implicitly expect 32bit alignment of the eMMC frame >> >> including arm_pl180_mmci.c, sandbox_mmc.c and stm32_sdmmc2.c >> >> Signed-off-by: Timothée Cercueil timothee.cercueil@st.com >> >> Signed-off-by: Timothée Cercueil litchi.pi@protonmail.com >> >> drivers/mmc/rpmb.c | 18 ++++++++++++++++-- >> >> 1 file changed, 16 insertions(+), 2 deletions(-) >> >> Changes since v1: >> >> - Fixed the Signed-off-by errors from previous patch. >> >> - This patch follows the subject discussed at: https://protect2.fireeye.com/v1/url?k=f4826206-ab195acc-f483e949-0cc47a31bee8-fbfde87d1c121f8b&q=1&e=4fb97df5-13bf-4f21-9dd7-ad6f5a6ed028&u=https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2021-June%2F451687.html >> >> - Changed the commit log 1st line >> >> diff --git a/drivers/mmc/rpmb.c b/drivers/mmc/rpmb.c >> >> index ea7e506666..b68d98573c 100644 >> >> --- a/drivers/mmc/rpmb.c >> >> +++ b/drivers/mmc/rpmb.c >> >> @@ -480,10 +480,24 @@ int mmc_rpmb_route_frames(struct mmc *mmc, void *req, unsigned long reqlen, >> >> * and possibly just delay an eventual error which will be harder >> >> * to track down. >> >> */ >> >> - void *rpmb_data = NULL; >> - int ret; >> >> if (reqlen % sizeof(struct s_rpmb) || rsplen % sizeof(struct s_rpmb)) >> >> return -EINVAL; >> >> - return rpmb_route_frames(mmc, req, reqlen / sizeof(struct s_rpmb), >> - rsp, rsplen / sizeof(struct s_rpmb)); >> >> >> >> - if (!IS_ALIGNED((uintptr_t)req, ARCH_DMA_MINALIGN)) { >> - /* Memory alignment is required by MMC driver */ >> >> >> - rpmb_data = malloc(reqlen); >> >> >> - if (!rpmb_data) >> >> >> - return -ENOMEM; >> >> >> >> - memcpy(rpmb_data, req, reqlen); >> >> >> - req = rpmb_data; >> >> >> - } >> >> - ret = rpmb_route_frames(mmc, req, reqlen / sizeof(struct s_rpmb), >> - rsp, rsplen / sizeof(struct s_rpmb)); >> >> >> - free(rpmb_data); >> - return ret; >> >> } >> >> -- >> >> 2.17.1 >