qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Kevin Wolf" <kwolf@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-block@nongnu.org, Andrew Jeffery <andrew@aj.id.au>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Erik Smit <erik.lucas.smit@gmail.com>,
	qemu-arm@nongnu.org, Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH v2 2/4] m25p80: Improve command handling for Jedec commands
Date: Wed, 22 Jul 2020 12:19:44 +0200	[thread overview]
Message-ID: <ad6b4998-a201-fd88-6558-261e641a5322@amsat.org> (raw)
In-Reply-To: <83f26c3b-cc7e-585a-1eae-2d7d9adb30af@kaod.org>

On 7/22/20 10:02 AM, Cédric Le Goater wrote:
> On 7/21/20 9:57 PM, Guenter Roeck wrote:
>> On 7/21/20 10:36 AM, Cédric Le Goater wrote:
>>> 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 <linux@roeck-us.net>
>>>> ---
>>>> 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 ? 
>>>
>>
>> No idea what the expected behavior is, but I am fine with the code below
>> if it works.
> 
> I checked on a few real systems and indeed the mx25l25635e behaves
> differently.
> 
> AST2400
> 
> [    5.594176] aspeed-smc 1e620000.spi: reading JEDEC ID 20:BA:19:10:00:00
> [    5.602226] aspeed-smc 1e620000.spi: n25q256a (32768 Kbytes)
> ...
> [    6.174052] aspeed-smc 1e630000.spi: reading JEDEC ID C2:20:19:C2:20:19
> [    6.181682] aspeed-smc 1e630000.spi: mx25l25635e (32768 Kbytes)
> 
> AST2500
> 
> [    1.641317] aspeed-smc 1e620000.spi: reading JEDEC ID EF:40:19:00:00:00
> [    1.648174] aspeed-smc 1e620000.spi: w25q256 (32768 Kbytes)
> ...
> [    1.179214] aspeed-smc 1e630000.spi: reading JEDEC ID EF:40:19:00:00:00
> [    1.186737] aspeed-smc 1e630000.spi: w25q256 (32768 Kbytes)
> 
> AST2600
> 
> [    1.020255] aspeed-smc 1e620000.spi: reading JEDEC ID EF:40:20:00:00:00
> [    1.027830] aspeed-smc 1e620000.spi: w25q512jv (65536 Kbytes)
> ...
> [    1.884171] aspeed-smc 1e630000.spi: reading JEDEC ID EF:40:19:00:00:00
> [    1.890937] aspeed-smc 1e630000.spi: w25q256 (32768 Kbytes)

FWIW QEMU models this one as 64KiB.

> 
> 
> I think we need a special case for it.
> 
> C. 
> 



  reply	other threads:[~2020-07-22 10:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 18:32 [PATCH v2 1/4] m25p80: Convert to support tracing Guenter Roeck
2020-02-06 18:32 ` [PATCH v2 2/4] m25p80: Improve command handling for Jedec commands Guenter Roeck
2020-02-06 18:36   ` Philippe Mathieu-Daudé
2020-02-06 22:26   ` Alistair Francis
2020-02-07  7:22   ` Cédric Le Goater
2020-07-21 17:36   ` Cédric Le Goater
2020-07-21 19:57     ` Guenter Roeck
2020-07-22  8:02       ` Cédric Le Goater
2020-07-22 10:19         ` Philippe Mathieu-Daudé [this message]
2020-02-06 18:32 ` [PATCH v2 3/4] m25p80: Improve command handling for unsupported commands Guenter Roeck
2020-02-07  0:21   ` Philippe Mathieu-Daudé
2020-02-07  7:22   ` Cédric Le Goater
2020-02-06 18:32 ` [PATCH v2 4/4] aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command Guenter Roeck
2020-02-06 18:39   ` Philippe Mathieu-Daudé
2020-02-06 18:40 ` [PATCH v2 1/4] m25p80: Convert to support tracing Philippe Mathieu-Daudé
2020-02-06 22:19 ` Alistair Francis
2020-02-07  7:22 ` Cédric Le Goater
2020-02-17 15:47 ` Cédric Le Goater
2020-03-16 14:13   ` Cédric Le Goater
2020-03-16 14:58     ` Peter Maydell
2020-03-16 15:11       ` Cédric Le Goater
2020-03-16 15:29         ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad6b4998-a201-fd88-6558-261e641a5322@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alistair@alistair23.me \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=erik.lucas.smit@gmail.com \
    --cc=joel@jms.id.au \
    --cc=kwolf@redhat.com \
    --cc=linux@roeck-us.net \
    --cc=mreitz@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).