summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorNiklas Cassel <niklas.cassel@wdc.com>2022-09-26 20:53:08 +0000
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-10-17 11:31:52 +0900
commit013115d90e007585bb85b45a5dc301ef1be62aab (patch)
treeee49cdfbc192bd042691294f2b2eefa28c7cf5ac /drivers/ata
parent4b89ad8e5e1233bfe642e0185e34ad5e1cefb19e (diff)
downloadlinux-013115d90e007585bb85b45a5dc301ef1be62aab.tar.bz2
ata: libata: fetch sense data for ATA devices supporting sense reporting
Currently, the sense data reporting feature set is enabled for all ATA devices which supports the feature set (ata_id_has_sense_reporting()), see ata_dev_config_sense_reporting(). However, even if sense data reporting is enabled, and the device indicates that sense data is available, the sense data is only fetched for ATA ZAC devices. For regular ATA devices, the available sense data is never fetched, it is simply ignored. Instead, libata will use the ERROR + STATUS fields and map them to a very generic and reduced set of sense data, see ata_gen_ata_sense() and ata_to_sense_error(). When sense data reporting was first implemented, regular ATA devices did fetch the sense data from the device. However, this was restricted to only ATA ZAC devices in commit ca156e006add ("libata: don't request sense data on !ZAC ATA devices"). With recent changes related to sense data and NCQ autosense, we want to, once again, fetch the sense data for all ATA devices supporting sense reporting. ata_gen_ata_sense() should only be used for devices that don't support the sense data reporting feature set. hopefully the features will be more robust this time around. It is not just ZAC, many new ATA features, e.g. Command Duration Limits, relies on working NCQ autosense and sense data. Therefore, it is not really an option to avoid fetching the sense data forever. If we encounter a device that is misbehaving because the sense data is actually fetched, then that device should be quirked such that it never enables the sense data reporting feature set in the first place, since such a device is obviously not compliant with the specification. The order in which we will try to add sense data to a scsi_cmnd: 1) NCQ autosense (if supported) - ata_eh_analyze_ncq_error() 2) REQUEST SENSE DATA EXT (if supported) - ata_eh_request_sense() 3) error + status field translation - ata_gen_ata_sense(), called by ata_scsi_qc_complete() if neither 1) or 2) is supported. Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-eh.c3
-rw-r--r--drivers/ata/libata-sata.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 0444e1c91c43..b08d02afce86 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1576,6 +1576,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc)
}
switch (qc->dev->class) {
+ case ATA_DEV_ATA:
case ATA_DEV_ZAC:
/*
* Fetch the sense data explicitly if:
@@ -1586,8 +1587,6 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc)
*/
if (!(qc->flags & ATA_QCFLAG_SENSE_VALID) && (stat & ATA_SENSE))
ata_eh_request_sense(qc);
- fallthrough;
- case ATA_DEV_ATA:
if (err & ATA_ICRC)
qc->err_mask |= AC_ERR_ATA_BUS;
if (err & (ATA_UNC | ATA_AMNF))
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index d6bbdfe0c455..9d3aee8ffa57 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -1392,8 +1392,7 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
tf->hob_lbah = buf[10];
tf->nsect = buf[12];
tf->hob_nsect = buf[13];
- if (dev->class == ATA_DEV_ZAC && ata_id_has_ncq_autosense(dev->id) &&
- (tf->status & ATA_SENSE))
+ if (ata_id_has_ncq_autosense(dev->id) && (tf->status & ATA_SENSE))
tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16];
return 0;