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=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 D8F44C2D0A8 for ; Wed, 23 Sep 2020 13:07:40 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 9EE3420708 for ; Wed, 23 Sep 2020 13:07:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EE3420708 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BxJPN6njkzDqXM for ; Wed, 23 Sep 2020 23:07:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BxJLk4cjszDqB0 for ; Wed, 23 Sep 2020 23:05:09 +1000 (AEST) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4BxJLQ45sYz9v2Yp; Wed, 23 Sep 2020 15:05:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id QkybPVvzKyzl; Wed, 23 Sep 2020 15:05:02 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4BxJLQ39P9z9v2Yn; Wed, 23 Sep 2020 15:05:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AE6D08B76B; Wed, 23 Sep 2020 15:05:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id EuY-BO8pFxEx; Wed, 23 Sep 2020 15:05:03 +0200 (CEST) Received: from [10.25.210.27] (unknown [10.25.210.27]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 070048B7FC; Wed, 23 Sep 2020 15:05:03 +0200 (CEST) Subject: Re: [PATCH] i2c: cpm: Fix i2c_ram structure To: Vincent Nicolas , "jochen@scram.de" References: <20200922090400.6282-1-nicolas.vincent@vossloh.com> <956c4b63-f859-df0c-2836-80a988ee6aa9@csgroup.eu> <2ecfe18a-61f6-bb0e-22c5-b7ab79a77d03@csgroup.eu> From: Christophe Leroy Message-ID: <644cc2e3-367b-2982-61ef-c057033216e3@csgroup.eu> Date: Wed, 23 Sep 2020 15:04:55 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linuxppc-dev@lists.ozlabs.org" , "linux-i2c@vger.kernel.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le 23/09/2020 à 14:55, Vincent Nicolas a écrit : > > >> ________________________________________ >> From: Christophe Leroy >> Sent: Wednesday, 23 September 2020 10:01 >> To: Vincent Nicolas; jochen@scram.de >> Cc: linuxppc-dev@lists.ozlabs.org; linux-i2c@vger.kernel.org >> Subject: Re: [PATCH] i2c: cpm: Fix i2c_ram structure >> >> >> >> Le 23/09/2020 à 09:18, Vincent Nicolas a écrit : >>> >>> >>> >>> From: Christophe Leroy >>> Sent: Tuesday, 22 September 2020 14:38 >>> To: Vincent Nicolas ; jochen@scram.de >>> Cc: linuxppc-dev@lists.ozlabs.org ; linux-i2c@vger.kernel.org >>> Subject: Re: [PATCH] i2c: cpm: Fix i2c_ram structure >>> >>> >>> >>> Le 22/09/2020 à 11:04, nico.vince@gmail.com a écrit : >>>> From: Nicolas VINCENT >>>> >>>> the i2c_ram structure is missing the sdmatmp field mentionned in >>>> datasheet for MPC8272 at paragraph 36.5. With this field missing, the >>>> hardware would write past the allocated memory done through >>>> cpm_muram_alloc for the i2c_ram structure and land in memory allocated >>>> for the buffers descriptors corrupting the cbd_bufaddr field. Since this >>>> field is only set during setup(), the first i2c transaction would work >>>> and the following would send data read from an arbitrary memory >>>> location. >>>> >>>> Signed-off-by: Nicolas VINCENT >>>> --- >>>> drivers/i2c/busses/i2c-cpm.c | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c >>>> index 1213e1932ccb..c5700addbf65 100644 >>>> --- a/drivers/i2c/busses/i2c-cpm.c >>>> +++ b/drivers/i2c/busses/i2c-cpm.c >>>> @@ -64,7 +64,8 @@ struct i2c_ram { >>>> uint txtmp; /* Internal */ >>>> char res1[4]; /* Reserved */ >>>> ushort rpbase; /* Relocation pointer */ >>>> - char res2[2]; /* Reserved */ >>>> + char res2[6]; /* Reserved */ >>>> + uint sdmatmp; /* Internal */ >>> >>> On CPM1, I2C param RAM has size 0x30 (offset 0x1c80-0x1caf) >>> >>> Your change overlaps the miscellaneous area that contains CP Microcode >>> Revision Number, ref MPC885 Reference Manual §18.7.3 >>> >>> As far as I understand the mpc885 contains in the dts the compatible=fsl,cpm1-i2c which is used in cpm-i2c.c to either determine the address of the i2c_ram structure (cpm1), or dynamically allocate it with cpm_muram_alloc (cpm2). >>> In the first case the structure will indeed overlaps with the miscellaneous section but since the sdmatmp is only used by cpm2 hardware it shall not be an issue. >>> >>> Please, let me know if I am mistaken. If the patch cannot be accepted as is, I would gladly accept pointers on how to address this kind of issue. >> >> >> Please use a mail client that properly sets the > in front of >> original/answered text. Here your mailer has mixed you text and mine, >> that's unusable on the long term. > > I changed my configuration, please let me know if there are still issues Yes it is OK now. Christophe