Skip to content

Commit 831d83a

Browse files
committed
Merge remote-tracking branch 'libata/for-6.10-fixes' into for-6.11
Pull in bug fixes.
2 parents 816be86 + eeb25a0 commit 831d83a

File tree

7 files changed

+61
-30
lines changed

7 files changed

+61
-30
lines changed

drivers/ata/ahci.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ static const struct pci_device_id ahci_pci_tbl[] = {
429429
{ PCI_VDEVICE(INTEL, 0x02d7), board_ahci_pcs_quirk }, /* Comet Lake PCH RAID */
430430
/* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */
431431
{ PCI_VDEVICE(INTEL, 0x4b63), board_ahci_pcs_quirk }, /* Elkhart Lake AHCI */
432-
{ PCI_VDEVICE(INTEL, 0x7ae2), board_ahci_pcs_quirk }, /* Alder Lake-P AHCI */
433432

434433
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
435434
{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -1736,6 +1735,14 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
17361735
if (ap->pflags & ATA_PFLAG_EXTERNAL)
17371736
return;
17381737

1738+
/* If no LPM states are supported by the HBA, do not bother with LPM */
1739+
if ((ap->host->flags & ATA_HOST_NO_PART) &&
1740+
(ap->host->flags & ATA_HOST_NO_SSC) &&
1741+
(ap->host->flags & ATA_HOST_NO_DEVSLP)) {
1742+
ata_port_dbg(ap, "no LPM states supported, not enabling LPM\n");
1743+
return;
1744+
}
1745+
17391746
/* user modified policy via module param */
17401747
if (mobile_lpm_policy != -1) {
17411748
policy = mobile_lpm_policy;
@@ -1968,8 +1975,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
19681975
n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map));
19691976

19701977
host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
1971-
if (!host)
1972-
return -ENOMEM;
1978+
if (!host) {
1979+
rc = -ENOMEM;
1980+
goto err_rm_sysfs_file;
1981+
}
19731982
host->private_data = hpriv;
19741983

19751984
if (ahci_init_msi(pdev, n_ports, hpriv) < 0) {
@@ -2024,11 +2033,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
20242033
/* initialize adapter */
20252034
rc = ahci_configure_dma_masks(pdev, hpriv);
20262035
if (rc)
2027-
return rc;
2036+
goto err_rm_sysfs_file;
20282037

20292038
rc = ahci_pci_reset_controller(host);
20302039
if (rc)
2031-
return rc;
2040+
goto err_rm_sysfs_file;
20322041

20332042
ahci_pci_init_controller(host);
20342043
ahci_pci_print_info(host);
@@ -2037,10 +2046,15 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
20372046

20382047
rc = ahci_host_activate(host, &ahci_sht);
20392048
if (rc)
2040-
return rc;
2049+
goto err_rm_sysfs_file;
20412050

20422051
pm_runtime_put_noidle(&pdev->dev);
20432052
return 0;
2053+
2054+
err_rm_sysfs_file:
2055+
sysfs_remove_file_from_group(&pdev->dev.kobj,
2056+
&dev_attr_remapped_nvme.attr, NULL);
2057+
return rc;
20442058
}
20452059

20462060
static void ahci_shutdown_one(struct pci_dev *pdev)

drivers/ata/libata-core.c

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,8 +4136,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
41364136
{ "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM },
41374137
{ "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM },
41384138

4139-
/* Crucial BX100 SSD 500GB has broken LPM support */
4140-
{ "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM },
4139+
/* Crucial devices with broken LPM support */
4140+
{ "CT*0BX*00SSD1", NULL, ATA_HORKAGE_NOLPM },
41414141

41424142
/* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
41434143
{ "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
@@ -4155,6 +4155,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
41554155
ATA_HORKAGE_ZERO_AFTER_TRIM |
41564156
ATA_HORKAGE_NOLPM },
41574157

4158+
/* AMD Radeon devices with broken LPM support */
4159+
{ "R3SL240G", NULL, ATA_HORKAGE_NOLPM },
4160+
4161+
/* Apacer models with LPM issues */
4162+
{ "Apacer AS340*", NULL, ATA_HORKAGE_NOLPM },
4163+
41584164
/* These specific Samsung models/firmware-revs do not handle LPM well */
41594165
{ "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
41604166
{ "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM },
@@ -5491,6 +5497,18 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
54915497
return ap;
54925498
}
54935499

5500+
void ata_port_free(struct ata_port *ap)
5501+
{
5502+
if (!ap)
5503+
return;
5504+
5505+
kfree(ap->pmp_link);
5506+
kfree(ap->slave_link);
5507+
kfree(ap->ncq_sense_buf);
5508+
kfree(ap);
5509+
}
5510+
EXPORT_SYMBOL_GPL(ata_port_free);
5511+
54945512
static void ata_devres_release(struct device *gendev, void *res)
54955513
{
54965514
struct ata_host *host = dev_get_drvdata(gendev);
@@ -5517,12 +5535,7 @@ static void ata_host_release(struct kref *kref)
55175535
int i;
55185536

55195537
for (i = 0; i < host->n_ports; i++) {
5520-
struct ata_port *ap = host->ports[i];
5521-
5522-
kfree(ap->pmp_link);
5523-
kfree(ap->slave_link);
5524-
kfree(ap->ncq_sense_buf);
5525-
kfree(ap);
5538+
ata_port_free(host->ports[i]);
55265539
host->ports[i] = NULL;
55275540
}
55285541
kfree(host);
@@ -5572,8 +5585,10 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports)
55725585
if (!host)
55735586
return NULL;
55745587

5575-
if (!devres_open_group(dev, NULL, GFP_KERNEL))
5576-
goto err_free;
5588+
if (!devres_open_group(dev, NULL, GFP_KERNEL)) {
5589+
kfree(host);
5590+
return NULL;
5591+
}
55775592

55785593
dr = devres_alloc(ata_devres_release, 0, GFP_KERNEL);
55795594
if (!dr)
@@ -5605,8 +5620,6 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports)
56055620

56065621
err_out:
56075622
devres_release_group(dev, NULL);
5608-
err_free:
5609-
kfree(host);
56105623
return NULL;
56115624
}
56125625
EXPORT_SYMBOL_GPL(ata_host_alloc);
@@ -5905,7 +5918,7 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh
59055918
* allocation time.
59065919
*/
59075920
for (i = host->n_ports; host->ports[i]; i++)
5908-
kfree(host->ports[i]);
5921+
ata_port_free(host->ports[i]);
59095922

59105923
/* give ports names and add SCSI hosts */
59115924
for (i = 0; i < host->n_ports; i++) {

drivers/ata/libata-scsi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,11 +1864,11 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
18641864
2
18651865
};
18661866

1867-
/* set scsi removable (RMB) bit per ata bit, or if the
1868-
* AHCI port says it's external (Hotplug-capable, eSATA).
1867+
/*
1868+
* Set the SCSI Removable Media Bit (RMB) if the ATA removable media
1869+
* device bit (obsolete since ATA-8 ACS) is set.
18691870
*/
1870-
if (ata_id_removable(args->id) ||
1871-
(args->dev->link->ap->pflags & ATA_PFLAG_EXTERNAL))
1871+
if (ata_id_removable(args->id))
18721872
hdr[1] |= (1 << 7);
18731873

18741874
if (args->dev->class == ATA_DEV_ZAC) {

drivers/ata/pata_macio.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,13 @@ static const struct scsi_host_template pata_macio_sht = {
915915
.sg_tablesize = MAX_DCMDS,
916916
/* We may not need that strict one */
917917
.dma_boundary = ATA_DMA_BOUNDARY,
918-
/* Not sure what the real max is but we know it's less than 64K, let's
919-
* use 64K minus 256
918+
/*
919+
* The SCSI core requires the segment size to cover at least a page, so
920+
* for 64K page size kernels this must be at least 64K. However the
921+
* hardware can't handle 64K, so pata_macio_qc_prep() will split large
922+
* requests.
920923
*/
921-
.max_segment_size = MAX_DBDMA_SEG,
924+
.max_segment_size = SZ_64K,
922925
.device_configure = pata_macio_device_configure,
923926
.sdev_groups = ata_common_sdev_groups,
924927
.can_queue = ATA_DEF_QUEUE,

drivers/scsi/libsas/sas_ata.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,15 @@ int sas_ata_init(struct domain_device *found_dev)
610610

611611
rc = ata_sas_tport_add(ata_host->dev, ap);
612612
if (rc)
613-
goto destroy_port;
613+
goto free_port;
614614

615615
found_dev->sata_dev.ata_host = ata_host;
616616
found_dev->sata_dev.ap = ap;
617617

618618
return 0;
619619

620-
destroy_port:
621-
kfree(ap);
620+
free_port:
621+
ata_port_free(ap);
622622
free_host:
623623
ata_host_put(ata_host);
624624
return rc;

drivers/scsi/libsas/sas_discover.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ void sas_free_device(struct kref *kref)
301301

302302
if (dev_is_sata(dev) && dev->sata_dev.ap) {
303303
ata_sas_tport_delete(dev->sata_dev.ap);
304-
kfree(dev->sata_dev.ap);
304+
ata_port_free(dev->sata_dev.ap);
305305
ata_host_put(dev->sata_dev.ata_host);
306306
dev->sata_dev.ata_host = NULL;
307307
dev->sata_dev.ap = NULL;

include/linux/libata.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,7 @@ extern int ata_slave_link_init(struct ata_port *ap);
12491249
extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
12501250
struct ata_port_info *, struct Scsi_Host *);
12511251
extern void ata_port_probe(struct ata_port *ap);
1252+
extern void ata_port_free(struct ata_port *ap);
12521253
extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap);
12531254
extern void ata_sas_tport_delete(struct ata_port *ap);
12541255
int ata_sas_device_configure(struct scsi_device *sdev, struct queue_limits *lim,

0 commit comments

Comments
 (0)