qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] ide: Implement VPD response for ATAPI


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2] ide: Implement VPD response for ATAPI
Date: Wed, 7 Jan 2015 15:32:51 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Dec 10, 2014 at 01:17:07PM -0500, John Snow wrote:
> SCSI devices have multiple kinds of queries they need to respond
> to, as defined in the "cmd inquiry" section in MMC-6 and SPC-3.
> 
> Relevent sections:
> MMC-6 revision 2g:
>       Non-VPD response data and pointer to SPC-3;
>       Section 6.8 "Inquiry Command"
> SPC-3 revision 23:
>       Inquiry command and error handling:
>       Section 6.4 "INQUIRY command"
>       VPD data pages format:
>       Section 7.6 "Vital product data parameters"
> 
> We implement these Vital Product Data queries for SCSI, but not for
> ATAPI through IDE. The result is that if you are looking for the WWN
> identifier via tools such as sg3_utils, you will be unable to query
> our CD/DVD rom device to obtain it.
> 
> This patch adds the minimum number of mandatory responses as defined
> by SPC-3, which include the "supported pages" response (page 0x00)
> and the "Device Identification" response (page 0x83). It also correctly
> responds when it receives a request for an illegal page to improve
> error output from related tools.
> 
> The Device ID page contains an arbitrary list of identification
> strings of various formats; the ID strings included in this patch
> were chosen to mimic those provided by the libata driver when
> emulating this SCSI query (model, serial, and wwn when present.)
> 
> Example:
> 
> # libata emulated response
> address@hidden ~]# sg_inq --id /dev/sda
> VPD INQUIRY: Device Identification page
>   Designation descriptor number 1, descriptor length: 24
>     designator_type: vendor specific [0x0],  code_set: ASCII
>     associated with the addressed logical unit
>       vendor specific: QM00001
>   Designation descriptor number 2, descriptor length: 72
>     designator_type: T10 vendor identification,  code_set: ASCII
>     associated with the addressed logical unit
>       vendor id: ATA
>       vendor specific: QEMU HARDDISK                           QM00001
> 
> # QEMU generated ATAPI response, with WWN
> address@hidden ~]# sg_inq --id /dev/sr0
> VPD INQUIRY: Device Identification page
>   Designation descriptor number 1, descriptor length: 24
>     designator_type: vendor specific [0x0],  code_set: ASCII
>     associated with the addressed logical unit
>       vendor specific: QM00005
>   Designation descriptor number 2, descriptor length: 72
>     designator_type: T10 vendor identification,  code_set: ASCII
>     associated with the addressed logical unit
>       vendor id: ATA
>       vendor specific: QEMU DVD-ROM                            QM00005
>   Designation descriptor number 3, descriptor length: 12
>     designator_type: NAA,  code_set: Binary
>     associated with the addressed logical unit
>       NAA 5, IEEE Company_id: 0xc50
>       Vendor Specific Identifier: 0x15ea71bb
>       [0x5000c50015ea71bb]
> 
> See also: hw/scsi/scsi-disk.c, scsi_disk_emulate_inquiry()
> 
> Signed-off-by: John Snow <address@hidden>
> ---
> 
> v2:
>  - Fixed failure to return after error
>  - Factor out some redundancy
>  - Make sure we always fill in the length for early return cases
> 
>  hw/ide/atapi.c    | 111 
> ++++++++++++++++++++++++++++++++++++++++++++++++------
>  hw/ide/internal.h |   1 +
>  2 files changed, 100 insertions(+), 12 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Attachment: pgpDPKKV6BAsH.pgp
Description: PGP signature


reply via email to

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