aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-23 11:24:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-23 11:31:58 -0400
commit03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch)
treefbaf8738296b2e9dcba81c6daef2d515b6c4948c /drivers/ata
parent6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff)
parentf36b7534b83357cf52e747905de6d65b4f7c2512 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here... For the mac80211 stuff, these were fortunately just parallel adds. Trivially resolved. In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the function phy_disable_interrupts() earlier in the file, whilst in 'net-next' the phy_error() call from this function was removed. In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the 'rt_table_id' member of rtable collided with a bug fix in 'net' that added a new struct member "rt_mtu_locked" which needs to be copied over here. The mlxsw driver conflict consisted of net-next separating the span code and definitions into separate files, whilst a 'net' bug fix made some changes to that moved code. The mlx5 infiniband conflict resolution was quite non-trivial, the RDMA tree's merge commit was used as a guide here, and here are their notes: ==================== Due to bug fixes found by the syzkaller bot and taken into the for-rc branch after development for the 4.17 merge window had already started being taken into the for-next branch, there were fairly non-trivial merge issues that would need to be resolved between the for-rc branch and the for-next branch. This merge resolves those conflicts and provides a unified base upon which ongoing development for 4.17 can be based. Conflicts: drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524 (IB/mlx5: Fix cleanup order on unload) added to for-rc and commit b5ca15ad7e61 (IB/mlx5: Add proper representors support) add as part of the devel cycle both needed to modify the init/de-init functions used by mlx5. To support the new representors, the new functions added by the cleanup patch needed to be made non-static, and the init/de-init list added by the representors patch needed to be modified to match the init/de-init list changes made by the cleanup patch. Updates: drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function prototypes added by representors patch to reflect new function names as changed by cleanup patch drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init stage list to match new order from cleanup patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c4
-rw-r--r--drivers/ata/libahci.c10
-rw-r--r--drivers/ata/libahci_platform.c2
-rw-r--r--drivers/ata/libata-core.c26
-rw-r--r--drivers/ata/libata-eh.c3
-rw-r--r--drivers/ata/libata-scsi.c12
-rw-r--r--drivers/ata/sata_rcar.c62
7 files changed, 88 insertions, 31 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 355a95a83a34..1ff17799769d 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -550,7 +550,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
550 .driver_data = board_ahci_yes_fbs }, 550 .driver_data = board_ahci_yes_fbs },
551 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), 551 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
552 .driver_data = board_ahci_yes_fbs }, 552 .driver_data = board_ahci_yes_fbs },
553 { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), 553 { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), /* highpoint rocketraid 642L */
554 .driver_data = board_ahci_yes_fbs },
555 { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0645), /* highpoint rocketraid 644L */
554 .driver_data = board_ahci_yes_fbs }, 556 .driver_data = board_ahci_yes_fbs },
555 557
556 /* Promise */ 558 /* Promise */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index a0de7a38430c..7adcf3caabd0 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -665,6 +665,16 @@ int ahci_stop_engine(struct ata_port *ap)
665 if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0) 665 if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0)
666 return 0; 666 return 0;
667 667
668 /*
669 * Don't try to issue commands but return with ENODEV if the
670 * AHCI controller not available anymore (e.g. due to PCIe hot
671 * unplugging). Otherwise a 500ms delay for each port is added.
672 */
673 if (tmp == 0xffffffff) {
674 dev_err(ap->host->dev, "AHCI controller unavailable!\n");
675 return -ENODEV;
676 }
677
668 /* setting HBA to idle */ 678 /* setting HBA to idle */
669 tmp &= ~PORT_CMD_START; 679 tmp &= ~PORT_CMD_START;
670 writel(tmp, port_mmio + PORT_CMD); 680 writel(tmp, port_mmio + PORT_CMD);
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 341d0ef82cbd..30cc8f1a31e1 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -340,7 +340,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port,
340 * 2) regulator for controlling the targets power (optional) 340 * 2) regulator for controlling the targets power (optional)
341 * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node, 341 * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node,
342 * or for non devicetree enabled platforms a single clock 342 * or for non devicetree enabled platforms a single clock
343 * 4) phys (optional) 343 * 4) phys (optional)
344 * 344 *
345 * RETURNS: 345 * RETURNS:
346 * The allocated ahci_host_priv on success, otherwise an ERR_PTR value 346 * The allocated ahci_host_priv on success, otherwise an ERR_PTR value
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3c09122bf038..7431ccd03316 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4530,6 +4530,25 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4530 { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, 4530 { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
4531 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, 4531 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
4532 4532
4533 /* Crucial BX100 SSD 500GB has broken LPM support */
4534 { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM },
4535
4536 /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
4537 { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
4538 ATA_HORKAGE_ZERO_AFTER_TRIM |
4539 ATA_HORKAGE_NOLPM, },
4540 /* 512GB MX100 with newer firmware has only LPM issues */
4541 { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM |
4542 ATA_HORKAGE_NOLPM, },
4543
4544 /* 480GB+ M500 SSDs have both queued TRIM and LPM issues */
4545 { "Crucial_CT480M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4546 ATA_HORKAGE_ZERO_AFTER_TRIM |
4547 ATA_HORKAGE_NOLPM, },
4548 { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4549 ATA_HORKAGE_ZERO_AFTER_TRIM |
4550 ATA_HORKAGE_NOLPM, },
4551
4533 /* devices that don't properly handle queued TRIM commands */ 4552 /* devices that don't properly handle queued TRIM commands */
4534 { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4553 { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4535 ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4554 ATA_HORKAGE_ZERO_AFTER_TRIM, },
@@ -4541,7 +4560,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4541 ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4560 ATA_HORKAGE_ZERO_AFTER_TRIM, },
4542 { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | 4561 { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
4543 ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4562 ATA_HORKAGE_ZERO_AFTER_TRIM, },
4544 { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4563 { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4564 ATA_HORKAGE_ZERO_AFTER_TRIM, },
4565 { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4545 ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4566 ATA_HORKAGE_ZERO_AFTER_TRIM, },
4546 { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4567 { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4547 ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4568 ATA_HORKAGE_ZERO_AFTER_TRIM, },
@@ -5401,8 +5422,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5401 * We guarantee to LLDs that they will have at least one 5422 * We guarantee to LLDs that they will have at least one
5402 * non-zero sg if the command is a data command. 5423 * non-zero sg if the command is a data command.
5403 */ 5424 */
5404 if (WARN_ON_ONCE(ata_is_data(prot) && 5425 if (ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes))
5405 (!qc->sg || !qc->n_elem || !qc->nbytes)))
5406 goto sys_err; 5426 goto sys_err;
5407 5427
5408 if (ata_is_dma(prot) || (ata_is_pio(prot) && 5428 if (ata_is_dma(prot) || (ata_is_pio(prot) &&
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 11c3137d7b0a..c016829a38fd 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -815,7 +815,8 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
815 815
816 if (ap->pflags & ATA_PFLAG_LOADING) 816 if (ap->pflags & ATA_PFLAG_LOADING)
817 ap->pflags &= ~ATA_PFLAG_LOADING; 817 ap->pflags &= ~ATA_PFLAG_LOADING;
818 else if (ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) 818 else if ((ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) &&
819 !(ap->flags & ATA_FLAG_SAS_HOST))
819 schedule_delayed_work(&ap->hotplug_task, 0); 820 schedule_delayed_work(&ap->hotplug_task, 0);
820 821
821 if (ap->pflags & ATA_PFLAG_RECOVERED) 822 if (ap->pflags & ATA_PFLAG_RECOVERED)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 66be961c93a4..89a9d4a2efc8 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3316,6 +3316,12 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
3316 goto invalid_fld; 3316 goto invalid_fld;
3317 } 3317 }
3318 3318
3319 /* We may not issue NCQ commands to devices not supporting NCQ */
3320 if (ata_is_ncq(tf->protocol) && !ata_ncq_enabled(dev)) {
3321 fp = 1;
3322 goto invalid_fld;
3323 }
3324
3319 /* sanity check for pio multi commands */ 3325 /* sanity check for pio multi commands */
3320 if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) { 3326 if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) {
3321 fp = 1; 3327 fp = 1;
@@ -4282,7 +4288,7 @@ static inline void ata_scsi_dump_cdb(struct ata_port *ap,
4282#ifdef ATA_DEBUG 4288#ifdef ATA_DEBUG
4283 struct scsi_device *scsidev = cmd->device; 4289 struct scsi_device *scsidev = cmd->device;
4284 4290
4285 DPRINTK("CDB (%u:%d,%d,%d) %9ph\n", 4291 DPRINTK("CDB (%u:%d,%d,%lld) %9ph\n",
4286 ap->print_id, 4292 ap->print_id,
4287 scsidev->channel, scsidev->id, scsidev->lun, 4293 scsidev->channel, scsidev->id, scsidev->lun,
4288 cmd->cmnd); 4294 cmd->cmnd);
@@ -4309,7 +4315,9 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
4309 if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { 4315 if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
4310 /* relay SCSI command to ATAPI device */ 4316 /* relay SCSI command to ATAPI device */
4311 int len = COMMAND_SIZE(scsi_op); 4317 int len = COMMAND_SIZE(scsi_op);
4312 if (unlikely(len > scmd->cmd_len || len > dev->cdb_len)) 4318 if (unlikely(len > scmd->cmd_len ||
4319 len > dev->cdb_len ||
4320 scmd->cmd_len > ATAPI_CDB_LEN))
4313 goto bad_cdb_len; 4321 goto bad_cdb_len;
4314 4322
4315 xlat_func = atapi_xlat; 4323 xlat_func = atapi_xlat;
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 80ee2f2a50d0..6456e07db72a 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -146,6 +146,7 @@
146enum sata_rcar_type { 146enum sata_rcar_type {
147 RCAR_GEN1_SATA, 147 RCAR_GEN1_SATA,
148 RCAR_GEN2_SATA, 148 RCAR_GEN2_SATA,
149 RCAR_GEN3_SATA,
149 RCAR_R8A7790_ES1_SATA, 150 RCAR_R8A7790_ES1_SATA,
150}; 151};
151 152
@@ -784,26 +785,11 @@ static void sata_rcar_setup_port(struct ata_host *host)
784 ioaddr->command_addr = ioaddr->cmd_addr + (ATA_REG_CMD << 2); 785 ioaddr->command_addr = ioaddr->cmd_addr + (ATA_REG_CMD << 2);
785} 786}
786 787
787static void sata_rcar_init_controller(struct ata_host *host) 788static void sata_rcar_init_module(struct sata_rcar_priv *priv)
788{ 789{
789 struct sata_rcar_priv *priv = host->private_data;
790 void __iomem *base = priv->base; 790 void __iomem *base = priv->base;
791 u32 val; 791 u32 val;
792 792
793 /* reset and setup phy */
794 switch (priv->type) {
795 case RCAR_GEN1_SATA:
796 sata_rcar_gen1_phy_init(priv);
797 break;
798 case RCAR_GEN2_SATA:
799 case RCAR_R8A7790_ES1_SATA:
800 sata_rcar_gen2_phy_init(priv);
801 break;
802 default:
803 dev_warn(host->dev, "SATA phy is not initialized\n");
804 break;
805 }
806
807 /* SATA-IP reset state */ 793 /* SATA-IP reset state */
808 val = ioread32(base + ATAPI_CONTROL1_REG); 794 val = ioread32(base + ATAPI_CONTROL1_REG);
809 val |= ATAPI_CONTROL1_RESET; 795 val |= ATAPI_CONTROL1_RESET;
@@ -824,10 +810,33 @@ static void sata_rcar_init_controller(struct ata_host *host)
824 /* ack and mask */ 810 /* ack and mask */
825 iowrite32(0, base + SATAINTSTAT_REG); 811 iowrite32(0, base + SATAINTSTAT_REG);
826 iowrite32(0x7ff, base + SATAINTMASK_REG); 812 iowrite32(0x7ff, base + SATAINTMASK_REG);
813
827 /* enable interrupts */ 814 /* enable interrupts */
828 iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); 815 iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
829} 816}
830 817
818static void sata_rcar_init_controller(struct ata_host *host)
819{
820 struct sata_rcar_priv *priv = host->private_data;
821
822 /* reset and setup phy */
823 switch (priv->type) {
824 case RCAR_GEN1_SATA:
825 sata_rcar_gen1_phy_init(priv);
826 break;
827 case RCAR_GEN2_SATA:
828 case RCAR_GEN3_SATA:
829 case RCAR_R8A7790_ES1_SATA:
830 sata_rcar_gen2_phy_init(priv);
831 break;
832 default:
833 dev_warn(host->dev, "SATA phy is not initialized\n");
834 break;
835 }
836
837 sata_rcar_init_module(priv);
838}
839
831static const struct of_device_id sata_rcar_match[] = { 840static const struct of_device_id sata_rcar_match[] = {
832 { 841 {
833 /* Deprecated by "renesas,sata-r8a7779" */ 842 /* Deprecated by "renesas,sata-r8a7779" */
@@ -856,7 +865,7 @@ static const struct of_device_id sata_rcar_match[] = {
856 }, 865 },
857 { 866 {
858 .compatible = "renesas,sata-r8a7795", 867 .compatible = "renesas,sata-r8a7795",
859 .data = (void *)RCAR_GEN2_SATA 868 .data = (void *)RCAR_GEN3_SATA
860 }, 869 },
861 { 870 {
862 .compatible = "renesas,rcar-gen2-sata", 871 .compatible = "renesas,rcar-gen2-sata",
@@ -864,7 +873,7 @@ static const struct of_device_id sata_rcar_match[] = {
864 }, 873 },
865 { 874 {
866 .compatible = "renesas,rcar-gen3-sata", 875 .compatible = "renesas,rcar-gen3-sata",
867 .data = (void *)RCAR_GEN2_SATA 876 .data = (void *)RCAR_GEN3_SATA
868 }, 877 },
869 { }, 878 { },
870}; 879};
@@ -982,11 +991,18 @@ static int sata_rcar_resume(struct device *dev)
982 if (ret) 991 if (ret)
983 return ret; 992 return ret;
984 993
985 /* ack and mask */ 994 if (priv->type == RCAR_GEN3_SATA) {
986 iowrite32(0, base + SATAINTSTAT_REG); 995 sata_rcar_gen2_phy_init(priv);
987 iowrite32(0x7ff, base + SATAINTMASK_REG); 996 sata_rcar_init_module(priv);
988 /* enable interrupts */ 997 } else {
989 iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); 998 /* ack and mask */
999 iowrite32(0, base + SATAINTSTAT_REG);
1000 iowrite32(0x7ff, base + SATAINTMASK_REG);
1001
1002 /* enable interrupts */
1003 iowrite32(ATAPI_INT_ENABLE_SATAINT,
1004 base + ATAPI_INT_ENABLE_REG);
1005 }
990 1006
991 ata_host_resume(host); 1007 ata_host_resume(host);
992 1008