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.5 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 0FA7EC433E1 for ; Tue, 21 Jul 2020 17:38:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 D76DF206C1 for ; Tue, 21 Jul 2020 17:38:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D76DF206C1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxwDW-00006c-7e for qemu-devel@archiver.kernel.org; Tue, 21 Jul 2020 13:38:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxwCc-0007jU-J0 for qemu-devel@nongnu.org; Tue, 21 Jul 2020 13:37:18 -0400 Received: from 2.mo68.mail-out.ovh.net ([46.105.52.162]:60626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxwCa-0000Kl-6Z for qemu-devel@nongnu.org; Tue, 21 Jul 2020 13:37:18 -0400 Received: from player788.ha.ovh.net (unknown [10.110.208.120]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id AABB0173901 for ; Tue, 21 Jul 2020 19:37:05 +0200 (CEST) Received: from kaod.org (bad36-1-78-202-132-1.fbx.proxad.net [78.202.132.1]) (Authenticated sender: clg@kaod.org) by player788.ha.ovh.net (Postfix) with ESMTPSA id 927871490F6D1; Tue, 21 Jul 2020 17:36:48 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-95G001ccd963cd-f319-4ddd-b0b3-80e0a7efa07f,622D537D4FED1CEB9E006CC2F7D967EDAF2A62E4) smtp.auth=clg@kaod.org Subject: Re: [PATCH v2 2/4] m25p80: Improve command handling for Jedec commands To: Guenter Roeck , Alistair Francis , Kevin Wolf References: <20200206183219.3756-1-linux@roeck-us.net> <20200206183219.3756-2-linux@roeck-us.net> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Tue, 21 Jul 2020 19:36:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200206183219.3756-2-linux@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 2864570841254169491 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrgeeigdduuddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomhepveorughrihgtpgfnvggpifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehfeejgfeuueeutefgudevfedtvdduvdeiffekudefueduveefjeefheelgffgvdenucffohhmrghinhepshhuphgvrhhmihgtrhhordgtohhmnecukfhppedtrddtrddtrddtpdejkedrvddtvddrudefvddrudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejkeekrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrgh Received-SPF: pass client-ip=46.105.52.162; envelope-from=clg@kaod.org; helo=2.mo68.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 13:37:05 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, Andrew Jeffery , qemu-devel@nongnu.org, Max Reitz , Erik Smit , qemu-arm@nongnu.org, Joel Stanley , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hello, On 2/6/20 7:32 PM, Guenter Roeck wrote: > When requesting JEDEC data using the JEDEC_READ command, the Linux kernel > always requests 6 bytes. The current implementation only returns three > bytes, and interprets the remaining three bytes as new commands. > While this does not matter most of the time, it is at the very least > confusing. To avoid the problem, always report up to 6 bytes of JEDEC > data. Fill remaining data with 0. > > Signed-off-by: Guenter Roeck > --- > v2: Split patch into two parts; improved decription > > hw/block/m25p80.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c > index 5ff8d270c4..53bf63856f 100644 > --- a/hw/block/m25p80.c > +++ b/hw/block/m25p80.c > @@ -1040,8 +1040,11 @@ static void decode_new_cmd(Flash *s, uint32_t value) > for (i = 0; i < s->pi->id_len; i++) { > s->data[i] = s->pi->id[i]; > } > + for (; i < SPI_NOR_MAX_ID_LEN; i++) { > + s->data[i] = 0; > + } This is breaking an old firmware (Linux version 2.6.28.9) for a SuperMicro board : https://www.supermicro.com/en/products/motherboard/X11SSL-F which expects the flash ID to repeat. Erik solved the problem with the patch below and I think it makes sense to wrap around. Anyone knows what should be the expected behavior ? Thanks, C. diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 8227088441..5000930800 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -1041,7 +1041,7 @@ static void decode_new_cmd(Flash *s, uint32_t value) s->data[i] = s->pi->id[i]; } for (; i < SPI_NOR_MAX_ID_LEN; i++) { - s->data[i] = 0; + s->data[i] = s->pi->id[i % s->pi->id_len]; } s->len = SPI_NOR_MAX_ID_LEN;