From: Paolo Bonzini <pbonzini@redhat.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] scsi-bus: fix endianness bug in store_lun()
Date: Sat, 16 Mar 2013 14:09:59 +0100 [thread overview]
Message-ID: <51446F27.8060909@redhat.com> (raw)
In-Reply-To: <1363438887.1244.27.camel@pasglop>
Il 16/03/2013 14:01, Benjamin Herrenschmidt ha scritto:
> On Sat, 2013-03-16 at 23:11 +1100, Alexey Kardashevskiy wrote:
>>> No, LUNs are composed of four 2-byte big-endian values.
>>
>> I cannot find it in "SCSI Commands References Manual"
>> (for example here -
>> http://www.seagate.com/staticfiles/support/disc/manuals/Interface%
>> 20manuals/100293068c.pdf
>> ). It just says that it is 8 bytes per
>> LUN and SCSI itself is big endian. Could you please point me to
>> the correct spec?
Look at section 4.7 of SAM-5. Most of it is useless, because the last
six bytes are almost never used. Still, what matters for QEMU is 4.7.5
Single level LUN structure, 4.7.7 Peripheral device addressing method,
4.7.8 Flat space addressing method.
In particular, you can see the reference to four two-byte fields in
Table 11 — "Single level LUN structure using peripheral device
addressing method" and Table 12 — "Single level LUN structure using flat
space addressing method".
> The confusion comes from the old SCSI protocol LUN as a 2 bytes number
> identifying a unit for a given bus/device and the "new style" LUN as a
> more generic concept such as used in SRP (ie vscsi is SRP) which
> encompass the bus, ID and LUN in one big number.
>
> The actual type of LUN returned by REPORT_LUN depends on the
> SELECT_REPORT field (I don't remember the details, but the doco you
> point to say to see what's in SAM-4) and the result is *variable* in
> size, so it should be kosher for qemu to just return 2 bytes as long as
> the LUN_LIST_LENGTH field of the reply is correct.
No, that's wrong. Each LUN returned by REPORT LUNS is always 8 bytes.
The field tells you if you are reporting all LUNs, only well-known LUNs,
etc.
Paolo
next prev parent reply other threads:[~2013-03-16 13:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 7:16 [Qemu-devel] [PATCH] scsi-bus: fix endianness bug in store_lun() Alexey Kardashevskiy
2013-03-16 8:13 ` Paolo Bonzini
2013-03-16 12:11 ` Alexey Kardashevskiy
2013-03-16 13:01 ` Benjamin Herrenschmidt
2013-03-16 13:09 ` Paolo Bonzini [this message]
2013-03-17 1:32 ` Benjamin Herrenschmidt
2013-03-16 14:10 ` Alexey Kardashevskiy
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=51446F27.8060909@redhat.com \
--to=pbonzini@redhat.com \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).