All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] m25p80: Improve error when the backend file size does not match the device
@ 2022-11-15 15:10 Cédric Le Goater
  2022-11-15 15:30 ` Peter Maydell
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Cédric Le Goater @ 2022-11-15 15:10 UTC (permalink / raw)
  To: Alistair Francis
  Cc: Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel,
	Cédric Le Goater

Currently, when a block backend is attached to a m25p80 device and the
associated file size does not match the flash model, QEMU complains
with the error message "failed to read the initial flash content".
This is confusing for the user.

Use blk_check_size_and_read_all() instead of blk_pread() to improve
the reported error.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/block/m25p80.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 02adc87527..68a757abf3 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -24,6 +24,7 @@
 #include "qemu/osdep.h"
 #include "qemu/units.h"
 #include "sysemu/block-backend.h"
+#include "hw/block/block.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
 #include "hw/ssi/ssi.h"
@@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
         trace_m25p80_binding(s);
         s->storage = blk_blockalign(s->blk, s->size);
 
-        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
-            error_setg(errp, "failed to read the initial flash content");
+        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
             return;
         }
     } else {
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-15 15:10 [PATCH v2] m25p80: Improve error when the backend file size does not match the device Cédric Le Goater
@ 2022-11-15 15:30 ` Peter Maydell
  2022-11-15 15:50 ` Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2022-11-15 15:30 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Alistair Francis, Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Delevoryas, qemu-block, qemu-devel

On Tue, 15 Nov 2022 at 15:10, Cédric Le Goater <clg@kaod.org> wrote:
>
> Currently, when a block backend is attached to a m25p80 device and the
> associated file size does not match the flash model, QEMU complains
> with the error message "failed to read the initial flash content".
> This is confusing for the user.
>
> Use blk_check_size_and_read_all() instead of blk_pread() to improve
> the reported error.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/block/m25p80.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 02adc87527..68a757abf3 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -24,6 +24,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
>  #include "sysemu/block-backend.h"
> +#include "hw/block/block.h"
>  #include "hw/qdev-properties.h"
>  #include "hw/qdev-properties-system.h"
>  #include "hw/ssi/ssi.h"
> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>          trace_m25p80_binding(s);
>          s->storage = blk_blockalign(s->blk, s->size);
>
> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
> -            error_setg(errp, "failed to read the initial flash content");
> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>              return;
>          }
>      } else {
> --
> 2.38.1

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-15 15:10 [PATCH v2] m25p80: Improve error when the backend file size does not match the device Cédric Le Goater
  2022-11-15 15:30 ` Peter Maydell
@ 2022-11-15 15:50 ` Philippe Mathieu-Daudé
  2022-11-15 20:08   ` Peter Delevoryas
  2022-11-16  1:58 ` Alistair Francis
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-15 15:50 UTC (permalink / raw)
  To: Cédric Le Goater, Alistair Francis
  Cc: Francisco Iglesias, Kevin Wolf, Hanna Reitz, Peter Maydell,
	Peter Delevoryas, qemu-block, qemu-devel

On 15/11/22 16:10, Cédric Le Goater wrote:
> Currently, when a block backend is attached to a m25p80 device and the
> associated file size does not match the flash model, QEMU complains
> with the error message "failed to read the initial flash content".
> This is confusing for the user.
> 
> Use blk_check_size_and_read_all() instead of blk_pread() to improve
> the reported error.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>   hw/block/m25p80.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-15 15:50 ` Philippe Mathieu-Daudé
@ 2022-11-15 20:08   ` Peter Delevoryas
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Delevoryas @ 2022-11-15 20:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Cédric Le Goater, Alistair Francis, Francisco Iglesias,
	Kevin Wolf, Hanna Reitz, Peter Maydell, qemu-block, qemu-devel

On Tue, Nov 15, 2022 at 04:50:11PM +0100, Philippe Mathieu-Daudé wrote:
> On 15/11/22 16:10, Cédric Le Goater wrote:
> > Currently, when a block backend is attached to a m25p80 device and the
> > associated file size does not match the flash model, QEMU complains
> > with the error message "failed to read the initial flash content".
> > This is confusing for the user.
> > 
> > Use blk_check_size_and_read_all() instead of blk_pread() to improve
> > the reported error.
> > 
> > Signed-off-by: Cédric Le Goater <clg@kaod.org>
> > ---
> >   hw/block/m25p80.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 

Thanks Cedric!

Reviewed-by: Peter Delevoryas <peter@pjd.dev>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-15 15:10 [PATCH v2] m25p80: Improve error when the backend file size does not match the device Cédric Le Goater
  2022-11-15 15:30 ` Peter Maydell
  2022-11-15 15:50 ` Philippe Mathieu-Daudé
@ 2022-11-16  1:58 ` Alistair Francis
  2022-11-16  6:56 ` Markus Armbruster
  2022-11-16 11:16 ` Francisco Iglesias
  4 siblings, 0 replies; 10+ messages in thread
From: Alistair Francis @ 2022-11-16  1:58 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Alistair Francis, Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel

On Wed, Nov 16, 2022 at 1:13 AM Cédric Le Goater <clg@kaod.org> wrote:
>
> Currently, when a block backend is attached to a m25p80 device and the
> associated file size does not match the flash model, QEMU complains
> with the error message "failed to read the initial flash content".
> This is confusing for the user.
>
> Use blk_check_size_and_read_all() instead of blk_pread() to improve
> the reported error.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/block/m25p80.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 02adc87527..68a757abf3 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -24,6 +24,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
>  #include "sysemu/block-backend.h"
> +#include "hw/block/block.h"
>  #include "hw/qdev-properties.h"
>  #include "hw/qdev-properties-system.h"
>  #include "hw/ssi/ssi.h"
> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>          trace_m25p80_binding(s);
>          s->storage = blk_blockalign(s->blk, s->size);
>
> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
> -            error_setg(errp, "failed to read the initial flash content");
> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>              return;
>          }
>      } else {
> --
> 2.38.1
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-15 15:10 [PATCH v2] m25p80: Improve error when the backend file size does not match the device Cédric Le Goater
                   ` (2 preceding siblings ...)
  2022-11-16  1:58 ` Alistair Francis
@ 2022-11-16  6:56 ` Markus Armbruster
  2022-11-16  7:12   ` Cédric Le Goater
  2022-11-16 11:16 ` Francisco Iglesias
  4 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2022-11-16  6:56 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Alistair Francis, Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel

Cédric Le Goater <clg@kaod.org> writes:

> Currently, when a block backend is attached to a m25p80 device and the
> associated file size does not match the flash model, QEMU complains
> with the error message "failed to read the initial flash content".
> This is confusing for the user.
>
> Use blk_check_size_and_read_all() instead of blk_pread() to improve
> the reported error.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/block/m25p80.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 02adc87527..68a757abf3 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -24,6 +24,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
>  #include "sysemu/block-backend.h"
> +#include "hw/block/block.h"
>  #include "hw/qdev-properties.h"
>  #include "hw/qdev-properties-system.h"
>  #include "hw/ssi/ssi.h"
> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>          trace_m25p80_binding(s);
>          s->storage = blk_blockalign(s->blk, s->size);
>  
> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
> -            error_setg(errp, "failed to read the initial flash content");
> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>              return;
>          }
>      } else {

Ignorant question: what does blk_pread() on short read?  Does it fail?
Or does it succeed, returning how much it read?  I tried to find an
answer in function comments, no luck.

Are there more instances of "we fill some fixed-size memory (such as a
ROM or flash) from a block backend?"



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-16  6:56 ` Markus Armbruster
@ 2022-11-16  7:12   ` Cédric Le Goater
  2022-11-16  8:28     ` Markus Armbruster
  0 siblings, 1 reply; 10+ messages in thread
From: Cédric Le Goater @ 2022-11-16  7:12 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Alistair Francis, Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel

On 11/16/22 07:56, Markus Armbruster wrote:
> Cédric Le Goater <clg@kaod.org> writes:
> 
>> Currently, when a block backend is attached to a m25p80 device and the
>> associated file size does not match the flash model, QEMU complains
>> with the error message "failed to read the initial flash content".
>> This is confusing for the user.
>>
>> Use blk_check_size_and_read_all() instead of blk_pread() to improve
>> the reported error.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>   hw/block/m25p80.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
>> index 02adc87527..68a757abf3 100644
>> --- a/hw/block/m25p80.c
>> +++ b/hw/block/m25p80.c
>> @@ -24,6 +24,7 @@
>>   #include "qemu/osdep.h"
>>   #include "qemu/units.h"
>>   #include "sysemu/block-backend.h"
>> +#include "hw/block/block.h"
>>   #include "hw/qdev-properties.h"
>>   #include "hw/qdev-properties-system.h"
>>   #include "hw/ssi/ssi.h"
>> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>>           trace_m25p80_binding(s);
>>           s->storage = blk_blockalign(s->blk, s->size);
>>   
>> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
>> -            error_setg(errp, "failed to read the initial flash content");
>> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>>               return;
>>           }
>>       } else {
> 
> Ignorant question: what does blk_pread() on short read?  Does it fail?

an underlying call to blk_check_byte_request() makes it fail.

> Or does it succeed, returning how much it read?  I tried to find an
> answer in function comments, no luck.
> 
> Are there more instances of "we fill some fixed-size memory (such as a
> ROM or flash) from a block backend?"

Yes. There are other similar devices :  nand, nvram, pnv_pnor, etc.

C.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-16  7:12   ` Cédric Le Goater
@ 2022-11-16  8:28     ` Markus Armbruster
  2022-11-16  8:38       ` Cédric Le Goater
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2022-11-16  8:28 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Alistair Francis, Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel

Cédric Le Goater <clg@kaod.org> writes:

> On 11/16/22 07:56, Markus Armbruster wrote:
>> Cédric Le Goater <clg@kaod.org> writes:
>> 
>>> Currently, when a block backend is attached to a m25p80 device and the
>>> associated file size does not match the flash model, QEMU complains
>>> with the error message "failed to read the initial flash content".
>>> This is confusing for the user.
>>>
>>> Use blk_check_size_and_read_all() instead of blk_pread() to improve
>>> the reported error.
>>>
>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>> ---
>>>   hw/block/m25p80.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
>>> index 02adc87527..68a757abf3 100644
>>> --- a/hw/block/m25p80.c
>>> +++ b/hw/block/m25p80.c
>>> @@ -24,6 +24,7 @@
>>>  #include "qemu/osdep.h"
>>>  #include "qemu/units.h"
>>>  #include "sysemu/block-backend.h"
>>> +#include "hw/block/block.h"
>>>  #include "hw/qdev-properties.h"
>>>  #include "hw/qdev-properties-system.h"
>>>  #include "hw/ssi/ssi.h"
>>> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>>>          trace_m25p80_binding(s);
>>>          s->storage = blk_blockalign(s->blk, s->size);
>>>  
>>> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
>>> -            error_setg(errp, "failed to read the initial flash content");
>>> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>>>              return;
>>>          }
>>>      } else {
>> 
>> Ignorant question: what does blk_pread() on short read?  Does it fail?
>
> an underlying call to blk_check_byte_request() makes it fail.

Thanks!

>> Or does it succeed, returning how much it read?  I tried to find an
>> answer in function comments, no luck.
>> 
>> Are there more instances of "we fill some fixed-size memory (such as a
>> ROM or flash) from a block backend?"
>
> Yes. There are other similar devices :  nand, nvram, pnv_pnor, etc.

I think they should all be converted to blk_check_size_and_read_all().
Not a prerequisite for getting this patch merged.  Volunteers?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-16  8:28     ` Markus Armbruster
@ 2022-11-16  8:38       ` Cédric Le Goater
  0 siblings, 0 replies; 10+ messages in thread
From: Cédric Le Goater @ 2022-11-16  8:38 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Alistair Francis, Francisco Iglesias, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel

On 11/16/22 09:28, Markus Armbruster wrote:
> Cédric Le Goater <clg@kaod.org> writes:
> 
>> On 11/16/22 07:56, Markus Armbruster wrote:
>>> Cédric Le Goater <clg@kaod.org> writes:
>>>
>>>> Currently, when a block backend is attached to a m25p80 device and the
>>>> associated file size does not match the flash model, QEMU complains
>>>> with the error message "failed to read the initial flash content".
>>>> This is confusing for the user.
>>>>
>>>> Use blk_check_size_and_read_all() instead of blk_pread() to improve
>>>> the reported error.
>>>>
>>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>>> ---
>>>>    hw/block/m25p80.c | 4 ++--
>>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
>>>> index 02adc87527..68a757abf3 100644
>>>> --- a/hw/block/m25p80.c
>>>> +++ b/hw/block/m25p80.c
>>>> @@ -24,6 +24,7 @@
>>>>   #include "qemu/osdep.h"
>>>>   #include "qemu/units.h"
>>>>   #include "sysemu/block-backend.h"
>>>> +#include "hw/block/block.h"
>>>>   #include "hw/qdev-properties.h"
>>>>   #include "hw/qdev-properties-system.h"
>>>>   #include "hw/ssi/ssi.h"
>>>> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>>>>           trace_m25p80_binding(s);
>>>>           s->storage = blk_blockalign(s->blk, s->size);
>>>>   
>>>> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
>>>> -            error_setg(errp, "failed to read the initial flash content");
>>>> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>>>>               return;
>>>>           }
>>>>       } else {
>>>
>>> Ignorant question: what does blk_pread() on short read?  Does it fail?
>>
>> an underlying call to blk_check_byte_request() makes it fail.
> 
> Thanks!

I tried to understand how  blk_set_allow_write_beyond_eof() worked but
I lack knowledge on the block area.
  
>>> Or does it succeed, returning how much it read?  I tried to find an
>>> answer in function comments, no luck.
>>>
>>> Are there more instances of "we fill some fixed-size memory (such as a
>>> ROM or flash) from a block backend?"
>>
>> Yes. There are other similar devices :  nand, nvram, pnv_pnor, etc.
> 
> I think they should all be converted to blk_check_size_and_read_all().
> Not a prerequisite for getting this patch merged.  Volunteers?

I can do the ones I introduced for the Aspeed and PPC machines.

Or we find a way to allow the underlying backend file to grow when
accessed beyond EOF but *not* beyond the flash device size. This might
be the complex part. The device model does some checks but the block
backend as no idea of the upper layer limitations.

Thanks,

C.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] m25p80: Improve error when the backend file size does not match the device
  2022-11-15 15:10 [PATCH v2] m25p80: Improve error when the backend file size does not match the device Cédric Le Goater
                   ` (3 preceding siblings ...)
  2022-11-16  6:56 ` Markus Armbruster
@ 2022-11-16 11:16 ` Francisco Iglesias
  4 siblings, 0 replies; 10+ messages in thread
From: Francisco Iglesias @ 2022-11-16 11:16 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Alistair Francis, Kevin Wolf, Hanna Reitz,
	Philippe Mathieu-Daudé,
	Peter Maydell, Peter Delevoryas, qemu-block, qemu-devel

On [2022 Nov 15] Tue 16:10:00, Cédric Le Goater wrote:
> Currently, when a block backend is attached to a m25p80 device and the
> associated file size does not match the flash model, QEMU complains
> with the error message "failed to read the initial flash content".
> This is confusing for the user.
> 
> Use blk_check_size_and_read_all() instead of blk_pread() to improve
> the reported error.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>

> ---
>  hw/block/m25p80.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 02adc87527..68a757abf3 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -24,6 +24,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
>  #include "sysemu/block-backend.h"
> +#include "hw/block/block.h"
>  #include "hw/qdev-properties.h"
>  #include "hw/qdev-properties-system.h"
>  #include "hw/ssi/ssi.h"
> @@ -1614,8 +1615,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp)
>          trace_m25p80_binding(s);
>          s->storage = blk_blockalign(s->blk, s->size);
>  
> -        if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
> -            error_setg(errp, "failed to read the initial flash content");
> +        if (!blk_check_size_and_read_all(s->blk, s->storage, s->size, errp)) {
>              return;
>          }
>      } else {
> -- 
> 2.38.1
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-16 11:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 15:10 [PATCH v2] m25p80: Improve error when the backend file size does not match the device Cédric Le Goater
2022-11-15 15:30 ` Peter Maydell
2022-11-15 15:50 ` Philippe Mathieu-Daudé
2022-11-15 20:08   ` Peter Delevoryas
2022-11-16  1:58 ` Alistair Francis
2022-11-16  6:56 ` Markus Armbruster
2022-11-16  7:12   ` Cédric Le Goater
2022-11-16  8:28     ` Markus Armbruster
2022-11-16  8:38       ` Cédric Le Goater
2022-11-16 11:16 ` Francisco Iglesias

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.