libata: bump ->qc_active to a 64-bit type
authorJens Axboe <axboe@kernel.dk>
Fri, 11 May 2018 18:51:05 +0000 (12:51 -0600)
committerTejun Heo <tj@kernel.org>
Fri, 11 May 2018 20:10:43 +0000 (13:10 -0700)
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>
drivers/ata/libata-core.c
drivers/ata/sata_fsl.c
drivers/ata/sata_mv.c
drivers/ata/sata_nv.c
include/linux/libata.h

index 1687e24..b079c3b 100644 (file)
@@ -1571,7 +1571,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
        int auto_timeout = 0;
        struct ata_queued_cmd *qc;
        unsigned int tag, preempted_tag;
-       u32 preempted_sactive, preempted_qc_active;
+       u32 preempted_sactive;
+       u64 preempted_qc_active;
        int preempted_nr_active_links;
        DECLARE_COMPLETION_ONSTACK(wait);
        unsigned long flags;
@@ -5195,7 +5196,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
         * is called. (when rc != 0 and atapi request sense is needed)
         */
        qc->flags &= ~ATA_QCFLAG_ACTIVE;
-       ap->qc_active &= ~(1 << qc->tag);
+       ap->qc_active &= ~(1ULL << qc->tag);
 
        /* call completion callback */
        qc->complete_fn(qc);
@@ -5352,29 +5353,29 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
  *     RETURNS:
  *     Number of completed commands on success, -errno otherwise.
  */
-int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active)
+int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active)
 {
        int nr_done = 0;
-       u32 done_mask;
+       u64 done_mask;
 
        done_mask = ap->qc_active ^ qc_active;
 
        if (unlikely(done_mask & qc_active)) {
-               ata_port_err(ap, "illegal qc_active transition (%08x->%08x)\n",
+               ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n",
                             ap->qc_active, qc_active);
                return -EINVAL;
        }
 
        while (done_mask) {
                struct ata_queued_cmd *qc;
-               unsigned int tag = __ffs(done_mask);
+               unsigned int tag = __ffs64(done_mask);
 
                qc = ata_qc_from_tag(ap, tag);
                if (qc) {
                        ata_qc_complete(qc);
                        nr_done++;
                }
-               done_mask &= ~(1 << tag);
+               done_mask &= ~(1ULL << tag);
        }
 
        return nr_done;
@@ -5418,7 +5419,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
        }
 
        qc->flags |= ATA_QCFLAG_ACTIVE;
-       ap->qc_active |= 1 << qc->tag;
+       ap->qc_active |= 1ULL << qc->tag;
 
        /*
         * We guarantee to LLDs that they will have at least one
index cb67847..1b22d5c 100644 (file)
@@ -1266,7 +1266,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
        }
 
        VPRINTK("Status of all queues :\n");
-       VPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%x\n",
+       VPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%llx\n",
                done_mask,
                ioread32(hcr_base + CA),
                ioread32(hcr_base + CE),
index 3a08f38..cddf96f 100644 (file)
@@ -2539,7 +2539,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap)
        failed_links = hweight16(new_map);
 
        ata_port_info(ap,
-                     "%s: pmp_map=%04x qc_map=%04x failed_links=%d nr_active_links=%d\n",
+                     "%s: pmp_map=%04x qc_map=%04llx failed_links=%d nr_active_links=%d\n",
                      __func__, pp->delayed_eh_pmp_map,
                      ap->qc_active, failed_links,
                      ap->nr_active_links);
index d83afc3..9a74f9f 100644 (file)
@@ -1782,7 +1782,7 @@ static void nv_swncq_ncq_stop(struct ata_port *ap)
        u32 sactive;
        u32 done_mask;
 
-       ata_port_err(ap, "EH in SWNCQ mode,QC:qc_active 0x%X sactive 0x%X\n",
+       ata_port_err(ap, "EH in SWNCQ mode,QC:qc_active 0x%llX sactive 0x%X\n",
                     ap->qc_active, ap->link.sactive);
        ata_port_err(ap,
                "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n  "
index 07a8d54..2881919 100644 (file)
@@ -852,7 +852,7 @@ struct ata_port {
 
        struct ata_queued_cmd   qcmd[ATA_MAX_QUEUE];
        unsigned long           sas_tag_allocated; /* for sas tag allocation only */
-       unsigned int            qc_active;
+       u64                     qc_active;
        int                     nr_active_links; /* #links with active qcs */
        unsigned int            sas_last_tag;   /* track next tag hw expects */
 
@@ -1185,7 +1185,7 @@ extern void ata_id_c_string(const u16 *id, unsigned char *s,
 extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
                                        struct ata_taskfile *tf, u16 *id);
 extern void ata_qc_complete(struct ata_queued_cmd *qc);
-extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
+extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active);
 extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
 extern int ata_std_bios_param(struct scsi_device *sdev,
                              struct block_device *bdev,