On Mon, Nov 24, 2025 at 05:20:08AM +0100, Philippe Mathieu-Daudé wrote:
> As a 'SD card vendor', QEMU chose to fill blocks with '1'
> during erase operation. Update the DATA_STAT_AFTER_ERASE
> SCR bit appropriately.

Would it be appropiate to let the guest know whether or not the
DATA_STAT_AFTER_ERASE bit is reliable?

Considering, erase-to-zero may become an option with[1] a guest
needs to actually consider this SCR bit.

CID contains a product revision field, maybe that could be
bumped?

Greetings,
Christian

[1] 
https://lore.kernel.org/qemu-devel/[email protected]/

> 
> Fixes: 818a5cdcfcf ("hw/sd: sd: Actually perform the erase operation")
> Reported-by: Christian Speich <[email protected]>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  hw/sd/sd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 40a75a43ffb..d35537702b2 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -446,7 +446,7 @@ static void sd_set_scr(SDState *sd)
>      /* reserved for manufacturer usage */
>      sd->scr[4] = 0x00;
>      sd->scr[5] = 0x00;
> -    sd->scr[6] = 0x00;
> +    sd->scr[6] = 1 << 7;        /* Data after an erase operation is 0xff */
>      sd->scr[7] = 0x00;
>  }
>  
> -- 
> 2.51.0
> 
> 

Reply via email to