From: Stefan Hajnoczi <stefanha@gmail.com>
To: John Snow <jsnow@redhat.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] ide: Implement VPD response for ATAPI
Date: Wed, 7 Jan 2015 15:32:51 +0000 [thread overview]
Message-ID: <20150107153251.GG22440@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1418235427-1081-1-git-send-email-jsnow@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3444 bytes --]
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
> [root@localhost ~]# 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
> [root@localhost ~]# 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 <jsnow@redhat.com>
> ---
>
> 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 #2: Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2015-01-07 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 18:17 [Qemu-devel] [PATCH v2] ide: Implement VPD response for ATAPI John Snow
2015-01-07 15:32 ` Stefan Hajnoczi [this message]
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=20150107153251.GG22440@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).