Skip to content

Commit 84ded2f

Browse files
committed
Revert "libata: Implement support for sense data reporting"
This reverts commit fe7173c. As implemented, ACS-4 sense reporting for ATA devices bypasses error diagnosis and handling in libata degrading EH behavior significantly. Revert the related changes for now. ATA_ID_COMMAND_SET_3/4 constants are not reverted as they're used by later changes. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Hannes Reinecke <hare@suse.de> Cc: stable@vger.kernel.org #v4.1+
1 parent fe16d4f commit 84ded2f

3 files changed

Lines changed: 4 additions & 118 deletions

File tree

‎drivers/ata/libata-core.c‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,24 +2147,6 @@ static int ata_dev_config_ncq(struct ata_device *dev,
21472147
return 0;
21482148
}
21492149

2150-
static void ata_dev_config_sense_reporting(struct ata_device *dev)
2151-
{
2152-
unsigned int err_mask;
2153-
2154-
if (!ata_id_has_sense_reporting(dev->id))
2155-
return;
2156-
2157-
if (ata_id_sense_reporting_enabled(dev->id))
2158-
return;
2159-
2160-
err_mask = ata_dev_set_feature(dev, SETFEATURE_SENSE_DATA, 0x1);
2161-
if (err_mask) {
2162-
ata_dev_dbg(dev,
2163-
"failed to enable Sense Data Reporting, Emask 0x%x\n",
2164-
err_mask);
2165-
}
2166-
}
2167-
21682150
/**
21692151
* ata_dev_configure - Configure the specified ATA/ATAPI device
21702152
* @dev: Target device to configure
@@ -2387,7 +2369,7 @@ int ata_dev_configure(struct ata_device *dev)
23872369
dev->devslp_timing[i] = sata_setting[j];
23882370
}
23892371
}
2390-
ata_dev_config_sense_reporting(dev);
2372+
23912373
dev->cdb_len = 16;
23922374
}
23932375

‎drivers/ata/libata-eh.c‎

Lines changed: 3 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,70 +1629,6 @@ unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key)
16291629
return err_mask;
16301630
}
16311631

1632-
/**
1633-
* ata_eh_request_sense - perform REQUEST_SENSE_DATA_EXT
1634-
* @dev: device to perform REQUEST_SENSE_SENSE_DATA_EXT to
1635-
* @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
1636-
* @dfl_sense_key: default sense key to use
1637-
*
1638-
* Perform REQUEST_SENSE_DATA_EXT after the device reported CHECK
1639-
* SENSE. This function is EH helper.
1640-
*
1641-
* LOCKING:
1642-
* Kernel thread context (may sleep).
1643-
*
1644-
* RETURNS:
1645-
* encoded sense data on success, 0 on failure or if sense data
1646-
* is not available.
1647-
*/
1648-
static u32 ata_eh_request_sense(struct ata_queued_cmd *qc,
1649-
struct scsi_cmnd *cmd)
1650-
{
1651-
struct ata_device *dev = qc->dev;
1652-
struct ata_taskfile tf;
1653-
unsigned int err_mask;
1654-
1655-
if (!cmd)
1656-
return 0;
1657-
1658-
DPRINTK("ATA request sense\n");
1659-
ata_dev_warn(dev, "request sense\n");
1660-
if (!ata_id_sense_reporting_enabled(dev->id)) {
1661-
ata_dev_warn(qc->dev, "sense data reporting disabled\n");
1662-
return 0;
1663-
}
1664-
ata_tf_init(dev, &tf);
1665-
1666-
tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1667-
tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
1668-
tf.command = ATA_CMD_REQ_SENSE_DATA;
1669-
tf.protocol = ATA_PROT_NODATA;
1670-
1671-
err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1672-
/*
1673-
* ACS-4 states:
1674-
* The device may set the SENSE DATA AVAILABLE bit to one in the
1675-
* STATUS field and clear the ERROR bit to zero in the STATUS field
1676-
* to indicate that the command returned completion without an error
1677-
* and the sense data described in table 306 is available.
1678-
*
1679-
* IOW the 'ATA_SENSE' bit might not be set even though valid
1680-
* sense data is available.
1681-
* So check for both.
1682-
*/
1683-
if ((tf.command & ATA_SENSE) ||
1684-
tf.lbah != 0 || tf.lbam != 0 || tf.lbal != 0) {
1685-
ata_scsi_set_sense(cmd, tf.lbah, tf.lbam, tf.lbal);
1686-
qc->flags |= ATA_QCFLAG_SENSE_VALID;
1687-
ata_dev_warn(dev, "sense data %02x/%02x/%02x\n",
1688-
tf.lbah, tf.lbam, tf.lbal);
1689-
} else {
1690-
ata_dev_warn(dev, "request sense failed stat %02x emask %x\n",
1691-
tf.command, err_mask);
1692-
}
1693-
return err_mask;
1694-
}
1695-
16961632
/**
16971633
* atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
16981634
* @dev: device to perform REQUEST_SENSE to
@@ -1896,22 +1832,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
18961832
return ATA_EH_RESET;
18971833
}
18981834

1899-
/*
1900-
* Sense data reporting does not work if the
1901-
* device fault bit is set.
1902-
*/
1903-
if ((stat & ATA_SENSE) && !(stat & ATA_DF) &&
1904-
!(qc->flags & ATA_QCFLAG_SENSE_VALID)) {
1905-
if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
1906-
tmp = ata_eh_request_sense(qc, qc->scsicmd);
1907-
if (tmp)
1908-
qc->err_mask |= tmp;
1909-
} else {
1910-
ata_dev_warn(qc->dev, "sense data available but port frozen\n");
1911-
}
1912-
}
1913-
1914-
/* Set by NCQ autosense or request sense above */
1835+
/* Set by NCQ autosense */
19151836
if (qc->flags & ATA_QCFLAG_SENSE_VALID)
19161837
return 0;
19171838

@@ -2658,15 +2579,14 @@ static void ata_eh_link_report(struct ata_link *link)
26582579

26592580
#ifdef CONFIG_ATA_VERBOSE_ERROR
26602581
if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ |
2661-
ATA_SENSE | ATA_ERR)) {
2582+
ATA_ERR)) {
26622583
if (res->command & ATA_BUSY)
26632584
ata_dev_err(qc->dev, "status: { Busy }\n");
26642585
else
2665-
ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n",
2586+
ata_dev_err(qc->dev, "status: { %s%s%s%s}\n",
26662587
res->command & ATA_DRDY ? "DRDY " : "",
26672588
res->command & ATA_DF ? "DF " : "",
26682589
res->command & ATA_DRQ ? "DRQ " : "",
2669-
res->command & ATA_SENSE ? "SENSE " : "",
26702590
res->command & ATA_ERR ? "ERR " : "");
26712591
}
26722592

‎include/linux/ata.h‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ enum {
385385
SATA_SSP = 0x06, /* Software Settings Preservation */
386386
SATA_DEVSLP = 0x09, /* Device Sleep */
387387

388-
SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */
389-
390388
/* feature values for SET_MAX */
391389
ATA_SET_MAX_ADDR = 0x00,
392390
ATA_SET_MAX_PASSWD = 0x01,
@@ -720,20 +718,6 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
720718
return false;
721719
}
722720

723-
static inline bool ata_id_has_sense_reporting(const u16 *id)
724-
{
725-
if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
726-
return false;
727-
return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
728-
}
729-
730-
static inline bool ata_id_sense_reporting_enabled(const u16 *id)
731-
{
732-
if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
733-
return false;
734-
return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
735-
}
736-
737721
/**
738722
* ata_id_major_version - get ATA level of drive
739723
* @id: Identify data

0 commit comments

Comments
 (0)