qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v42 06/98] hw/sd/sdcard: Do not store vendor data on block dr


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v42 06/98] hw/sd/sdcard: Do not store vendor data on block drive (CMD56)
Date: Tue, 2 Jul 2024 18:04:05 +0200
User-agent: Mozilla Thunderbird

On 1/7/24 10:01, Luc Michel wrote:
On 09:00 Fri 28 Jun     , Philippe Mathieu-Daudé wrote:
Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


"General command" (GEN_CMD, CMD56) is described as:

   GEN_CMD is the same as the single block read or write
   commands (CMD24 or CMD17). The difference is that [...]
   the data block is not a memory payload data but has a
   vendor specific format and meaning.

Thus this block must not be stored overwriting data block
on underlying storage drive. Keep it in a dedicated
'vendor_data[]' array.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
---
RFC: Is it safe to reuse VMSTATE_UNUSED_V() (which happens
to be the same size)?

Cc: Peter Xu <peterx@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>

I'm not sure about this migration question.

But IMHO you can simplify your implementation to avoid having to store
and migrate this vendor_data array. After some research on this command,
I came to the conclusion that it's used by manufacturers to return
device health related vendor-specific data. (E.g.,
https://images-na.ssl-images-amazon.com/images/I/91tTtUMDM3L.pdf Section
1.6.1). So I guess you can simply discard writes and return 0s on reads
(or "QEMU" in ASCII or... :)).

Thanks, very interesting datasheet! Note the argument filter:

  To query the Health Status register, CMD56 with
  argument of [00 00 00 01] is used.

Since we can program this array, I'll simply add it as R/W (KISS).


---
  hw/sd/sd.c | 17 +++++++++--------
  1 file changed, 9 insertions(+), 8 deletions(-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]