summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-05-11 14:51:05 -0400
committerTejun Heo <tj@kernel.org>2018-05-11 16:10:43 -0400
commite3ed8939644166a7560a33c46f508584a7f1756a (patch)
treef8b52a6aeb75ec45f131373880c53d922e972f77
parent4e5b6260cc9ba84ec127f948173ff7d87581f029 (diff)
libata: bump ->qc_active to a 64-bit type
This is in preparation for allowing full usage of the tag space, which means that our reserved error handling command will be using an internal tag value of 32. This doesn't fit in a u32, so move to a u64. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--drivers/ata/libata-core.c17
-rw-r--r--drivers/ata/sata_fsl.c2
-rw-r--r--drivers/ata/sata_mv.c2
-rw-r--r--drivers/ata/sata_nv.c2
-rw-r--r--include/linux/libata.h4
5 files changed, 14 insertions, 13 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 1687e24d3633..b079c3b5ec27 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1571,7 +1571,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1571 int auto_timeout = 0; 1571 int auto_timeout = 0;
1572 struct ata_queued_cmd *qc; 1572 struct ata_queued_cmd *qc;
1573 unsigned int tag, preempted_tag; 1573 unsigned int tag, preempted_tag;
1574 u32 preempted_sactive, preempted_qc_active; 1574 u32 preempted_sactive;
1575 u64 preempted_qc_active;
1575 int preempted_nr_active_links; 1576 int preempted_nr_active_links;
1576 DECLARE_COMPLETION_ONSTACK(wait); 1577 DECLARE_COMPLETION_ONSTACK(wait);
1577 unsigned long flags; 1578 unsigned long flags;
@@ -5195,7 +5196,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
5195 * is called. (when rc != 0 and atapi request sense is needed) 5196 * is called. (when rc != 0 and atapi request sense is needed)
5196 */ 5197 */
5197 qc->flags &= ~ATA_QCFLAG_ACTIVE; 5198 qc->flags &= ~ATA_QCFLAG_ACTIVE;
5198 ap->qc_active &= ~(1 << qc->tag); 5199 ap->qc_active &= ~(1ULL << qc->tag);
5199 5200
5200 /* call completion callback */ 5201 /* call completion callback */
5201 qc->complete_fn(qc); 5202 qc->complete_fn(qc);
@@ -5352,29 +5353,29 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5352 * RETURNS: 5353 * RETURNS:
5353 * Number of completed commands on success, -errno otherwise. 5354 * Number of completed commands on success, -errno otherwise.
5354 */ 5355 */
5355int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active) 5356int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active)
5356{ 5357{
5357 int nr_done = 0; 5358 int nr_done = 0;
5358 u32 done_mask; 5359 u64 done_mask;
5359 5360
5360 done_mask = ap->qc_active ^ qc_active; 5361 done_mask = ap->qc_active ^ qc_active;
5361 5362
5362 if (unlikely(done_mask & qc_active)) { 5363 if (unlikely(done_mask & qc_active)) {
5363 ata_port_err(ap, "illegal qc_active transition (%08x->%08x)\n", 5364 ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n",
5364 ap->qc_active, qc_active); 5365 ap->qc_active, qc_active);
5365 return -EINVAL; 5366 return -EINVAL;
5366 } 5367 }
5367 5368
5368 while (done_mask) { 5369 while (done_mask) {
5369 struct ata_queued_cmd *qc; 5370 struct ata_queued_cmd *qc;
5370 unsigned int tag = __ffs(done_mask); 5371 unsigned int tag = __ffs64(done_mask);
5371 5372
5372 qc = ata_qc_from_tag(ap, tag); 5373 qc = ata_qc_from_tag(ap, tag);
5373 if (qc) { 5374 if (qc) {
5374 ata_qc_complete(qc); 5375 ata_qc_complete(qc);
5375 nr_done++; 5376 nr_done++;
5376 } 5377 }
5377 done_mask &= ~(1 << tag); 5378 done_mask &= ~(1ULL << tag);
5378 } 5379 }
5379 5380
5380 return nr_done; 5381 return nr_done;
@@ -5418,7 +5419,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5418 } 5419 }
5419 5420
5420 qc->flags |= ATA_QCFLAG_ACTIVE; 5421 qc->flags |= ATA_QCFLAG_ACTIVE;
5421 ap->qc_active |= 1 << qc->tag; 5422 ap->qc_active |= 1ULL << qc->tag;
5422 5423
5423 /* 5424 /*
5424 * We guarantee to LLDs that they will have at least one 5425 * We guarantee to LLDs that they will have at least one
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index cb67847d2157..1b22d5c339d7 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1266,7 +1266,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1266 } 1266 }
1267 1267
1268 VPRINTK("Status of all queues :\n"); 1268 VPRINTK("Status of all queues :\n");
1269 VPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%x\n", 1269 VPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%llx\n",
1270 done_mask, 1270 done_mask,
1271 ioread32(hcr_base + CA), 1271 ioread32(hcr_base + CA),
1272 ioread32(hcr_base + CE), 1272 ioread32(hcr_base + CE),
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 3a08f38c695c..cddf96f6e431 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -2539,7 +2539,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap)
2539 failed_links = hweight16(new_map); 2539 failed_links = hweight16(new_map);
2540 2540
2541 ata_port_info(ap, 2541 ata_port_info(ap,
2542 "%s: pmp_map=%04x qc_map=%04x failed_links=%d nr_active_links=%d\n", 2542 "%s: pmp_map=%04x qc_map=%04llx failed_links=%d nr_active_links=%d\n",
2543 __func__, pp->delayed_eh_pmp_map, 2543 __func__, pp->delayed_eh_pmp_map,
2544 ap->qc_active, failed_links, 2544 ap->qc_active, failed_links,
2545 ap->nr_active_links); 2545 ap->nr_active_links);
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index d83afc3dbf94..9a74f9ff5ebc 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1782,7 +1782,7 @@ static void nv_swncq_ncq_stop(struct ata_port *ap)
1782 u32 sactive; 1782 u32 sactive;
1783 u32 done_mask; 1783 u32 done_mask;
1784 1784
1785 ata_port_err(ap, "EH in SWNCQ mode,QC:qc_active 0x%X sactive 0x%X\n", 1785 ata_port_err(ap, "EH in SWNCQ mode,QC:qc_active 0x%llX sactive 0x%X\n",
1786 ap->qc_active, ap->link.sactive); 1786 ap->qc_active, ap->link.sactive);
1787 ata_port_err(ap, 1787 ata_port_err(ap,
1788 "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n " 1788 "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n "
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 07a8d54ba7af..2881919b3728 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -852,7 +852,7 @@ struct ata_port {
852 852
853 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; 853 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
854 unsigned long sas_tag_allocated; /* for sas tag allocation only */ 854 unsigned long sas_tag_allocated; /* for sas tag allocation only */
855 unsigned int qc_active; 855 u64 qc_active;
856 int nr_active_links; /* #links with active qcs */ 856 int nr_active_links; /* #links with active qcs */
857 unsigned int sas_last_tag; /* track next tag hw expects */ 857 unsigned int sas_last_tag; /* track next tag hw expects */
858 858
@@ -1185,7 +1185,7 @@ extern void ata_id_c_string(const u16 *id, unsigned char *s,
1185extern unsigned int ata_do_dev_read_id(struct ata_device *dev, 1185extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
1186 struct ata_taskfile *tf, u16 *id); 1186 struct ata_taskfile *tf, u16 *id);
1187extern void ata_qc_complete(struct ata_queued_cmd *qc); 1187extern void ata_qc_complete(struct ata_queued_cmd *qc);
1188extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active); 1188extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
1189extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); 1189extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
1190extern int ata_std_bios_param(struct scsi_device *sdev, 1190extern int ata_std_bios_param(struct scsi_device *sdev,
1191 struct block_device *bdev, 1191 struct block_device *bdev,