[Top][All Lists]

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

Re: [Qemu-ppc] [PATCH] scsi-bus: fix endianness bug in store_lun()

From: Paolo Bonzini
Subject: Re: [Qemu-ppc] [PATCH] scsi-bus: fix endianness bug in store_lun()
Date: Sat, 16 Mar 2013 14:09:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3

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,


reply via email to

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