libata-scsi: Set CmdQue=1 when NCQ is enabled
PATCH 1/3 libata-scsi: Set CmdQue=1 when NCQ is enabled
From: Tom Yan <[email protected]>
https://bugzilla.kernel.org/show_bug.cgi?id=105931
This might look trivial at first sight. However, it can be important to have the bit set accordingly when the device/SATL is SCSI-passthrough'd to a virtual machine with scsi-block in qemu:
https://github.com/YanVugenfirer/kvm-guest-drivers-windows/issues/63#issuecomment-216199929
drivers/ata/libata-scsi.c +7 -1
@@ -2007,7 +2007,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)0 ,0x5 ,/* claim SPC-3 version compatibility */ 2 , - 95 - 4 +95 -4 , +0 , +0 , + 0 };VPRINTK ("ENTER\n" );
@@ -2024,6 +2027,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) hdr[2 ] =0x6 ;/* ZBC is defined in SPC-4 */ } +if (ata_ncq_enabled (args->dev)) + hdr[7 ] |= (1 <<1 ); +memcpy (rbuf, hdr,sizeof (hdr));memcpy (&rbuf[8 ],"ATA " ,8 );ata_id_string (args->id, &rbuf[16 ],ATA_ID_PROD ,16 );
Signature · 1 line
2.8.2
Btw I wonder if the CmdQue bit should be statically set to 1 instead. It is not specified in the SAT standard (as of SAT-4 Rev. 05a) that the bit should be correlated to ATA NCQ. Neither does the kernel care about the bit (or the 'queue_type' sysfs file), apparently. However, it seems that there is still an advantage to have the bit set to 1 even when we, for example, need libata.force=noncq for some reason:
https://github.com/YanVugenfirer/kvm-guest-drivers-windows/issues/63#issuecomment-216480833
What do you guys think? Is there any concern (with rigid reasoning) over setting the bit statically to 1?
Quoted 40 lines · On 3 May 2016 at 04:13, <[email protected]> wrote:
From: Tom Yan <[email protected]>
https://bugzilla.kernel.org/show_bug.cgi?id=105931
This might look trivial at first sight. However, it can be important to have the bit set accordingly when the device/SATL is SCSI-passthrough'd to a virtual machine with scsi-block in qemu:
https://github.com/YanVugenfirer/kvm-guest-drivers-windows/issues/63#issuecomment-216199929
Signed-off-by Tom Yan <[email protected]>drivers/ata/libata-scsi.c +7
-2@@ -2007,7 +2007,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)0 ,0x5 ,/* claim SPC-3 version compatibility */ 2 , - 95 - 4 +95 -4 , +0 , +0 , + 0 };VPRINTK ("ENTER\n" );@@ -2024,6 +2027,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) hdr[2 ] =0x6 ;/* ZBC is defined in SPC-4 */ } +if (ata_ncq_enabled (args->dev)) + hdr[7 ] |= (1 <<1 ); +memcpy (rbuf, hdr,sizeof (hdr));memcpy (&rbuf[8 ],"ATA " ,8 );ata_id_string (args->id, &rbuf[16 ],ATA_ID_PROD ,16 ); --2.8.2