mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
libata: implement ATA_HORKAGE_NO_NCQ_TRIM and apply it to Micro M500 SSDs
Certain drives cannot handle queued TRIM commands properly, even
though support is indicated in the IDENTIFY DEVICE buffer. This patch
allows for disabling the commands for the affected drives and apply it
to the Micron/Crucial M500 SSDs which exhibit incorrect protocol
behavior when issued queued TRIM commands, which could lead to silent
data corruption.
tj: Merged two unnecessarily split patches and made minor edits
including shortening horkage name.
Signed-off-by: Marc Carino <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Link: http://lkml.kernel.org/g/[email protected]
Cc: [email protected] # 3.12+
This commit is contained in:
parent
b8bd6dc361
commit
f78dea064c
2 changed files with 14 additions and 2 deletions
|
|
@ -2149,9 +2149,16 @@ static int ata_dev_config_ncq(struct ata_device *dev,
|
|||
"failed to get NCQ Send/Recv Log Emask 0x%x\n",
|
||||
err_mask);
|
||||
} else {
|
||||
u8 *cmds = dev->ncq_send_recv_cmds;
|
||||
|
||||
dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
|
||||
memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
|
||||
ATA_LOG_NCQ_SEND_RECV_SIZE);
|
||||
memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE);
|
||||
|
||||
if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) {
|
||||
ata_dev_dbg(dev, "disabling queued TRIM support\n");
|
||||
cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &=
|
||||
~ATA_LOG_NCQ_SEND_RECV_DSM_TRIM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4205,6 +4212,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
|
|||
{ "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
|
||||
{ "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
|
||||
|
||||
/* devices that don't properly handle queued TRIM commands */
|
||||
{ "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
|
||||
{ "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
|
||||
|
||||
/* End Marker */
|
||||
{ }
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue