libata-5.15-2021-09-05

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmE1EsEQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgppSqEADAaYVwbrNvdeCVNLiCiQb8u6mOP/y+wgIu
 90aPaNEqpLKEx3hRkN0eOlLymkST2Z9iVXyOdwP0PHXnKygCd/mx9ZocRkO9uGs4
 8vNUOK5eMWKtDg4BbWQDR8UxdL+la9udCZgLXWyoMQVij3apSIQlIWxenTZ0OVuJ
 BOuxZ+T06NADkxMBOpB25TiOJkHSDvLOSfQySpJqJQKdpcOTFOqSEMfM9xjRUrju
 hAxVgjwiovO0AacQ9yie+BgvHySPNggu6Ko63lrujA1JOceWQZXjAP1a3/V6Y0ke
 kJ6cRZbhQLMCVDoEG8H+KxFwxJsfnryL3lEDCzs1wkaEksQiHB6SEetqjVz07M+C
 S7FaENUwFnAcVTVOEK/geqotGOInUnIUcVCBdT8nLpeuco3cr81TYu1FF9Vv1cB9
 O2N1o5dNhl91zbY5SlqjVKpBvJ2N62d4GPF6GcuVxHyqwd9ZtonQ3lB9eqP17Sqb
 a6njGDmgUaPvlAF3xt6nPAm0a3AMgQivltvYyTwpS3AYfI6uRINI7K5kH0g4nL3F
 CnX33dTVS25y4UBejxvzg2G6LDyat7DiMZadV3c6gN4rNatifAo8ySO6RKmbS8M2
 IREF8Hxk81mPqGd1Svmv3E3MgQUngbPrx1zCe7Lh9Hygc65I06hW4gj760po2yVc
 Q/dRtXfMcQ==
 =U7lH
 -----END PGP SIGNATURE-----

Merge tag 'libata-5.15-2021-09-05' of git://git.kernel.dk/linux-block

Pull libata fixes from Jens Axboe:
 "Fixes for queued trim on certain Samsung SSDs, in conjunction with
  certain ATI controllers"

* tag 'libata-5.15-2021-09-05' of git://git.kernel.dk/linux-block:
  libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD.
  libata: add ATA_HORKAGE_NO_NCQ_TRIM for Samsung 860 and 870 SSDs
This commit is contained in:
Linus Torvalds 2021-09-06 09:51:42 -07:00
commit eebb4159a2
2 changed files with 35 additions and 0 deletions

View File

@ -2186,6 +2186,25 @@ not_supported:
dev->flags &= ~ATA_DFLAG_NCQ_PRIO;
}
static bool ata_dev_check_adapter(struct ata_device *dev,
unsigned short vendor_id)
{
struct pci_dev *pcidev = NULL;
struct device *parent_dev = NULL;
for (parent_dev = dev->tdev.parent; parent_dev != NULL;
parent_dev = parent_dev->parent) {
if (dev_is_pci(parent_dev)) {
pcidev = to_pci_dev(parent_dev);
if (pcidev->vendor == vendor_id)
return true;
break;
}
}
return false;
}
static int ata_dev_config_ncq(struct ata_device *dev,
char *desc, size_t desc_sz)
{
@ -2204,6 +2223,13 @@ static int ata_dev_config_ncq(struct ata_device *dev,
snprintf(desc, desc_sz, "NCQ (not used)");
return 0;
}
if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI &&
ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) {
snprintf(desc, desc_sz, "NCQ (not used)");
return 0;
}
if (ap->flags & ATA_FLAG_NCQ) {
hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE);
dev->flags |= ATA_DFLAG_NCQ;
@ -3970,6 +3996,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
ATA_HORKAGE_ZERO_AFTER_TRIM, },
{ "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
ATA_HORKAGE_ZERO_AFTER_TRIM, },
{ "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
ATA_HORKAGE_ZERO_AFTER_TRIM |
ATA_HORKAGE_NO_NCQ_ON_ATI, },
{ "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
ATA_HORKAGE_ZERO_AFTER_TRIM |
ATA_HORKAGE_NO_NCQ_ON_ATI, },
{ "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
ATA_HORKAGE_ZERO_AFTER_TRIM, },
@ -6124,6 +6156,8 @@ static int __init ata_parse_force_one(char **cur,
{ "ncq", .horkage_off = ATA_HORKAGE_NONCQ },
{ "noncqtrim", .horkage_on = ATA_HORKAGE_NO_NCQ_TRIM },
{ "ncqtrim", .horkage_off = ATA_HORKAGE_NO_NCQ_TRIM },
{ "noncqati", .horkage_on = ATA_HORKAGE_NO_NCQ_ON_ATI },
{ "ncqati", .horkage_off = ATA_HORKAGE_NO_NCQ_ON_ATI },
{ "dump_id", .horkage_on = ATA_HORKAGE_DUMP_ID },
{ "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) },
{ "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) },

View File

@ -426,6 +426,7 @@ enum {
ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */
ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */
ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */
ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */
/* DMA mask for user DMA control: User visible values; DO NOT
renumber */