Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata

Pull libata fixes from Tejun Heo:
"Dan updated tag allocation to accomodate devices which choke when tags
jump back and forth. Quite a few ahci MSI related fixes. A couple
config dependency fixes and other misc fixes"

* 'for-3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
libata/ahci: accommodate tag ordered controllers
ahci: Do not receive interrupts sent by dummy ports
ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range()
ahci: Ensure "MSI Revert to Single Message" mode is not enforced
ahci: do not request irq for dummy port
pata_samsung_cf: fix ata_host_activate() failure handling
pata_arasan_cf: fix ata_host_activate() failure handling
ata: fix i.MX AHCI driver dependencies
pata_at91: fix ata_host_activate() failure handling
libata: Update queued trim blacklist for M5x0 drives
libata: make AHCI_XGENE depend on PHY_XGENE

+60 -37
+2 -3
drivers/ata/Kconfig
··· 116 116 117 117 config AHCI_IMX 118 118 tristate "Freescale i.MX AHCI SATA support" 119 - depends on MFD_SYSCON 119 + depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST) 120 120 help 121 121 This option enables support for the Freescale i.MX SoC's 122 122 onboard AHCI SATA. ··· 134 134 135 135 config AHCI_XGENE 136 136 tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support" 137 - depends on ARM64 || COMPILE_TEST 138 - select PHY_XGENE 137 + depends on PHY_XGENE 139 138 help 140 139 This option enables support for APM X-Gene SoC SATA host controller. 141 140
+21 -14
drivers/ata/ahci.c
··· 1164 1164 #endif 1165 1165 1166 1166 static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, 1167 - struct ahci_host_priv *hpriv) 1167 + struct ahci_host_priv *hpriv) 1168 1168 { 1169 - int nvec; 1169 + int rc, nvec; 1170 1170 1171 1171 if (hpriv->flags & AHCI_HFLAG_NO_MSI) 1172 1172 goto intx; ··· 1183 1183 if (nvec < n_ports) 1184 1184 goto single_msi; 1185 1185 1186 - nvec = pci_enable_msi_range(pdev, nvec, nvec); 1187 - if (nvec == -ENOSPC) 1186 + rc = pci_enable_msi_exact(pdev, nvec); 1187 + if (rc == -ENOSPC) 1188 1188 goto single_msi; 1189 - else if (nvec < 0) 1189 + else if (rc < 0) 1190 1190 goto intx; 1191 + 1192 + /* fallback to single MSI mode if the controller enforced MRSM mode */ 1193 + if (readl(hpriv->mmio + HOST_CTL) & HOST_MRSM) { 1194 + pci_disable_msi(pdev); 1195 + printk(KERN_INFO "ahci: MRSM is on, fallback to single MSI\n"); 1196 + goto single_msi; 1197 + } 1191 1198 1192 1199 return nvec; 1193 1200 ··· 1239 1232 return rc; 1240 1233 1241 1234 for (i = 0; i < host->n_ports; i++) { 1242 - const char* desc; 1243 1235 struct ahci_port_priv *pp = host->ports[i]->private_data; 1244 1236 1245 - /* pp is NULL for dummy ports */ 1246 - if (pp) 1247 - desc = pp->irq_desc; 1248 - else 1249 - desc = dev_driver_string(host->dev); 1237 + /* Do not receive interrupts sent by dummy ports */ 1238 + if (!pp) { 1239 + disable_irq(irq + i); 1240 + continue; 1241 + } 1250 1242 1251 - rc = devm_request_threaded_irq(host->dev, 1252 - irq + i, ahci_hw_interrupt, ahci_thread_fn, IRQF_SHARED, 1253 - desc, host->ports[i]); 1243 + rc = devm_request_threaded_irq(host->dev, irq + i, 1244 + ahci_hw_interrupt, 1245 + ahci_thread_fn, IRQF_SHARED, 1246 + pp->irq_desc, host->ports[i]); 1254 1247 if (rc) 1255 1248 goto out_free_irqs; 1256 1249 }
+1
drivers/ata/ahci.h
··· 94 94 /* HOST_CTL bits */ 95 95 HOST_RESET = (1 << 0), /* reset controller; self-clear */ 96 96 HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ 97 + HOST_MRSM = (1 << 2), /* MSI Revert to Single Message */ 97 98 HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ 98 99 99 100 /* HOST_CAP bits */
+17 -10
drivers/ata/libata-core.c
··· 4224 4224 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, 4225 4225 4226 4226 /* devices that don't properly handle queued TRIM commands */ 4227 - { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4228 - { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4227 + { "Micron_M500*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, 4228 + { "Crucial_CT???M500SSD*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, 4229 + { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4230 + { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, 4229 4231 4230 4232 /* 4231 4233 * Some WD SATA-I drives spin up and down erratically when the link ··· 4794 4792 static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) 4795 4793 { 4796 4794 struct ata_queued_cmd *qc = NULL; 4797 - unsigned int i; 4795 + unsigned int i, tag; 4798 4796 4799 4797 /* no command while frozen */ 4800 4798 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) 4801 4799 return NULL; 4802 4800 4803 - /* the last tag is reserved for internal command. */ 4804 - for (i = 0; i < ATA_MAX_QUEUE - 1; i++) 4805 - if (!test_and_set_bit(i, &ap->qc_allocated)) { 4806 - qc = __ata_qc_from_tag(ap, i); 4801 + for (i = 0; i < ATA_MAX_QUEUE; i++) { 4802 + tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; 4803 + 4804 + /* the last tag is reserved for internal command. */ 4805 + if (tag == ATA_TAG_INTERNAL) 4806 + continue; 4807 + 4808 + if (!test_and_set_bit(tag, &ap->qc_allocated)) { 4809 + qc = __ata_qc_from_tag(ap, tag); 4810 + qc->tag = tag; 4811 + ap->last_tag = tag; 4807 4812 break; 4808 4813 } 4809 - 4810 - if (qc) 4811 - qc->tag = i; 4814 + } 4812 4815 4813 4816 return qc; 4814 4817 }
+5 -2
drivers/ata/pata_arasan_cf.c
··· 898 898 899 899 cf_card_detect(acdev, 0); 900 900 901 - return ata_host_activate(host, acdev->irq, irq_handler, 0, 902 - &arasan_cf_sht); 901 + ret = ata_host_activate(host, acdev->irq, irq_handler, 0, 902 + &arasan_cf_sht); 903 + if (!ret) 904 + return 0; 903 905 906 + cf_exit(acdev); 904 907 free_clk: 905 908 clk_put(acdev->clk); 906 909 return ret;
+6 -5
drivers/ata/pata_at91.c
··· 407 407 408 408 host->private_data = info; 409 409 410 - return ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, 411 - gpio_is_valid(irq) ? ata_sff_interrupt : NULL, 412 - irq_flags, &pata_at91_sht); 410 + ret = ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, 411 + gpio_is_valid(irq) ? ata_sff_interrupt : NULL, 412 + irq_flags, &pata_at91_sht); 413 + if (ret) 414 + goto err_put; 413 415 414 - if (!ret) 415 - return 0; 416 + return 0; 416 417 417 418 err_put: 418 419 clk_put(info->mck);
+7 -3
drivers/ata/pata_samsung_cf.c
··· 594 594 595 595 platform_set_drvdata(pdev, host); 596 596 597 - return ata_host_activate(host, info->irq, 598 - info->irq ? pata_s3c_irq : NULL, 599 - 0, &pata_s3c_sht); 597 + ret = ata_host_activate(host, info->irq, 598 + info->irq ? pata_s3c_irq : NULL, 599 + 0, &pata_s3c_sht); 600 + if (ret) 601 + goto stop_clk; 602 + 603 + return 0; 600 604 601 605 stop_clk: 602 606 clk_disable(info->clk);
+1
include/linux/libata.h
··· 822 822 unsigned long qc_allocated; 823 823 unsigned int qc_active; 824 824 int nr_active_links; /* #links with active qcs */ 825 + unsigned int last_tag; /* track next tag hw expects */ 825 826 826 827 struct ata_link link; /* host default link */ 827 828 struct ata_link *slave_link; /* see ata_slave_link_init() */