Skip to contentSkip to conversation

libata-scsi: Fix SCSI INQUIRY version descriptor

PATCH In review [email protected] 2 participants 4 messages May 2, 2016 – May 7, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1462220001-2566-1-git-send-email-me

#1 lore raw

PATCH 2/3 libata-scsi: Fix SCSI INQUIRY version descriptor

From: Tom Yan <[email protected]>

https://bugzilla.kernel.org/show_bug.cgi?id=106931

drivers/ata/libata-scsi.c +2 -2
index cd30f11..0295c38 100644
@@ -1985,8 +1985,8 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 		0x03,
 		0x20,	/* SBC-2 (no version claimed) */
 
-		0x02,
-		0x60	/* SPC-3 (no version claimed) */
+		0x03,
+		0x00	/* SPC-3 (no version claimed) */
 	};
 	const u8 versions_zbc[] = {
 		0x00,
Signature · 1 line
2.8.2
#2 lore raw
Quoted 11 lines · On 2016-05-02 04:13 PM, [email protected] wrote:

From: Tom Yan <[email protected]>

https://bugzilla.kernel.org/show_bug.cgi?id=106931

drivers/ata/libata-scsi.c +0 -0
index cd30f11..0295c38 100644

drivers/ata/libata-scsi.c static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · line 1992

Quoted 10 lines
drivers/ata/libata-scsi.c +2 -2
@@ -1985,8 +1985,8 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
  		0x03,
  		0x20,	/* SBC-2 (no version claimed) */
 
-		0x02,
-		0x60	/* SPC-3 (no version claimed) */
+		0x03,
+		0x00	/* SPC-3 (no version claimed) */
  	};
  	const u8 versions_zbc[] = {
  		0x00,

SPC-3 was standardized in 2005 (ANSI INCITS 408-2005) and there is a more recent standard: SPC-4 (ANSI INCITS 513-2015). And my guess is that libata-scsi supports many things introduced in SPC-4 . If you switch to SPC-4 then the "version" field in the standard INQUIRY response (byte 2) should be changed to 6.

Also SBC-2 is old (ANSI INCITS 405-2005) and should be updated to SBC-3 (ANSI INCITS 514-2014). Again many features supported by libata-scsi didn't exist in SBC-2.

And libata-scsi is a SCSI to ATA Translation (SAT) layer and there are standards for that, take your pick: SAT (ANSI INCITS 431-2007), SAT-2 (ANSI INCITS 465-2010) or SAT-3 (ANSI INCITS 517-2015).

Suggestion:
Version descriptors value
----------------------------------------

    SAM-5 (no version claimed)    0x00a0
    SPC-4 (no version claimed)    0x0460
    SBC-3 (no version claimed)    0x04c0
    SAT-3 (no version claimed)    0x1ee0

Plus byte 2 of INQUIRY response: 0x6

Doug Gilbert

BTW in lk 4.6.0-rc5 I see this for a directly connected SATA SSD:

# sg_inq -d /dev/sg0
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  LU_CONG=0  version=0x05  [SPC-3]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=2
  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=0  [BQue=0]
  EncServ=0  MultiP=0  [MChngr=0]  [ACKREQQ=0]  Addr16=0
  [RelAdr=0]  WBus16=0  Sync=0  [Linked=0]  [TranDis=0]  CmdQue=0
  [SPI: Clocking=0x0  QAS=0  IUS=0]
    length=96 (0x60)   Peripheral device type: disk
 Vendor identification: ATA
 Product identification: INTEL SSDSC2BW18
 Product revision level: DC32
 Unit serial number:

Version descriptors:
SAM-3 (no version claimed)
SBC-2 (no version claimed)
SPC-2 (no version claimed)

author
#3 lore raw

FWIW, the version descriptors you suggested (and the "compatibility version") is updated for ZAC drives in:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/ata/libata-scsi.c?id=f9ca5ab832e7ac5bc2b6fe0e82ad46d536f436f9
I have no idea why the versions for other devices are held back.

Certainly it seems right to have them updated as well. But my goal was just to fix the typo, at least.

Not sure about the SAT version descriptor. FYR I have a few SATA/UASP adapters (from ASMedia and JMicron), they only have the SPC-4, SBC-3 and UAS descriptor, but not a SAT one.
However unlike libata, neither of them have the "ai" VPD:
[tom@localhost ~]$ sudo sg_vpd -p ai /dev/sda
ATA information VPD page:
SAT Vendor identification: linux
SAT Product identification: libata
SAT Product revision level: 3.00
Device signature indicates SATA transport
ATA command IDENTIFY DEVICE response summary:
model: INTEL SSDSC2BW240A4
serial number: CVDA339603M02403GN
firmware revision: DC32

Quoted 76 lines · Douglas Gilbert
Quoted 21 lines · On 2016-05-02 04:13 PM, [email protected] wrote:

From: Tom Yan <[email protected]>

https://bugzilla.kernel.org/show_bug.cgi?id=106931

drivers/ata/libata-scsi.c +2 -2
index cd30f11..0295c38 100644
@@ -1985,8 +1985,8 @@ static unsigned int ata_scsiop_inq_std(struct
 ata_scsi_args *args, u8 *rbuf)
                0x03,
                0x20,   /* SBC-2 (no version claimed) */
 
-               0x02,
-               0x60    /* SPC-3 (no version claimed) */
+               0x03,
+               0x00    /* SPC-3 (no version claimed) */
        };
        const u8 versions_zbc[] = {
Quoted 2 lines
                0x00,

SPC-3 was standardized in 2005 (ANSI INCITS 408-2005) and there is a more recent standard: SPC-4 (ANSI INCITS 513-2015). And my guess is that libata-scsi supports many things introduced in SPC-4 . If you switch to SPC-4 then the "version" field in the standard INQUIRY response (byte 2) should be changed to 6.

Also SBC-2 is old (ANSI INCITS 405-2005) and should be updated to SBC-3 (ANSI INCITS 514-2014). Again many features supported by libata-scsi didn't exist in SBC-2.

And libata-scsi is a SCSI to ATA Translation (SAT) layer and there are standards for that, take your pick: SAT (ANSI INCITS 431-2007), SAT-2 (ANSI INCITS 465-2010) or SAT-3 (ANSI INCITS 517-2015).

Suggestion:
Version descriptors value
----------------------------------------

    SAM-5 (no version claimed)    0x00a0
    SPC-4 (no version claimed)    0x0460
    SBC-3 (no version claimed)    0x04c0
    SAT-3 (no version claimed)    0x1ee0

Plus byte 2 of INQUIRY response: 0x6

Doug Gilbert

BTW in lk 4.6.0-rc5 I see this for a directly connected SATA SSD:

# sg_inq -d /dev/sg0
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  LU_CONG=0  version=0x05  [SPC-3]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=2
  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=0  [BQue=0]
  EncServ=0  MultiP=0  [MChngr=0]  [ACKREQQ=0]  Addr16=0
  [RelAdr=0]  WBus16=0  Sync=0  [Linked=0]  [TranDis=0]  CmdQue=0
  [SPI: Clocking=0x0  QAS=0  IUS=0]
    length=96 (0x60)   Peripheral device type: disk
 Vendor identification: ATA
 Product identification: INTEL SSDSC2BW18
 Product revision level: DC32
 Unit serial number:

Version descriptors:
SAM-3 (no version claimed)
SBC-2 (no version claimed)
SPC-2 (no version claimed)

#4 lore raw

PATCH 3/3 libata-scsi: Do not partially report ATA read look-ahead

In reply to a message not in the archive

From: Tom Yan <[email protected]>

Nothing in the kernel actually makes use of the DRA bit in SCSI MODE SENSE. Neither is there a sysfs file (like 'cache_type' for WCE) that allows users to change the bit nor SCSI-ATA Translation that can toggle the ATA feature.

Hence removing the MODE SENSE SCSI-ATA Translation that is only triggered by the change of WCE to avoid silliness like this:
https://bugzilla.kernel.org/show_bug.cgi?id=105861#c2

drivers/ata/libata-scsi.c +0 -2
index 0295c38..8c07db8 100644
@@ -2316,8 +2316,6 @@ static unsigned int ata_msense_caching(u16 *id, u8 *buf, bool changeable)
 	modecpy(buf, def_cache_mpage, sizeof(def_cache_mpage), changeable);
 	if (changeable || ata_id_wcache_enabled(id))
 		buf[2] |= (1 << 2);	/* write cache enable */
-	if (!changeable && !ata_id_rahead_enabled(id))
-		buf[12] |= (1 << 5);	/* disable read ahead */
 	return sizeof(def_cache_mpage);
 }
 
Signature · 1 line
2.8.2