Re: [PATCH v3 1/6] ata: libata-scsi: Fix offsets for the fixed format sense data

Niklas Cassel
2024-06-28T18:25:45Z

On Fri, Jun 28, 2024 at 05:49:22PM +0200, Niklas Cassel wrote:
> On Fri, Jun 28, 2024 at 08:47:03AM +0200, Hannes Reinecke wrote:
> > On 6/27/24 14:08, Niklas Cassel wrote:
>
> In SAT-6 there is no mention of compliance with ANSI INCITS 431-2007 should
> ignore D_SENSE bit and unconditionally return sense data in descriptor format.
>
> Anyway, considering that:
> 1) I'm not sure how a SAT would expose that it is compliant with ANSI INCITS
> 431-2007.
> 2) This text has been removed from SAT-6.
> 3) We currently honour the D_SENSE bit when creating the sense buffer with the
> SK/ASC/ASCQ that we get from the device.
>
> I think that it makes sense to honour the D_SENSE bit also when generating
> sense data for successful ATA PASS-THROUGH commands (from ATA registers).

Igor, I think you should add a new patch in your series that does:

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d5874d4b9253..5b211551ac10 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -949,11 +949,8 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
&sense_key, &asc, &ascq);
ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq);
} else {
- /*
- * ATA PASS-THROUGH INFORMATION AVAILABLE
- * Always in descriptor format sense.
- */
- scsi_build_sense(cmd, 1, RECOVERED_ERROR, 0, 0x1D);
+ /* ATA PASS-THROUGH INFORMATION AVAILABLE */
+ ata_scsi_set_sense(qc->dev, cmd, RECOVERED_ERROR, 0, 0x1D);
}
}

Feel free to copy my arguments above.

I also checked VPD page 89h (ATA Information VPD page), and there are
no bits there either to claim certain SAT version compliance.

And since this text is not in SAT-6, I can only imagine that they decided
that is was not a good idea to not always honor D_SENSE...

(It does seem simpler to just always honor it...)

Kind regards,
Niklas