]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/scsi/megaraid/megaraid_sas_fusion.c
scsi: megaraid_sas: fix selection of reply queue
[mirror_ubuntu-bionic-kernel.git] / drivers / scsi / megaraid / megaraid_sas_fusion.c
index 65dc4fea6352a3d6b12ed5add5aafe7c85d866e4..7ef81d6290b47f0cd92be8e8d084182a0addb1c9 100644 (file)
@@ -216,36 +216,30 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
 /**
  * megasas_fire_cmd_fusion -   Sends command to the FW
  * @instance:                  Adapter soft state
- * @req_desc:                  32bit or 64bit Request descriptor
+ * @req_desc:                  64bit Request descriptor
  *
- * Perform PCI Write. Ventura supports 32 bit Descriptor.
- * Prior to Ventura (12G) MR controller supports 64 bit Descriptor.
+ * Perform PCI Write.
  */
 
 static void
 megasas_fire_cmd_fusion(struct megasas_instance *instance,
                union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc)
 {
-       if (instance->adapter_type == VENTURA_SERIES)
-               writel(le32_to_cpu(req_desc->u.low),
-                       &instance->reg_set->inbound_single_queue_port);
-       else {
 #if defined(writeq) && defined(CONFIG_64BIT)
-               u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
-                               le32_to_cpu(req_desc->u.low));
+       u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
+               le32_to_cpu(req_desc->u.low));
 
-               writeq(req_data, &instance->reg_set->inbound_low_queue_port);
+       writeq(req_data, &instance->reg_set->inbound_low_queue_port);
 #else
-               unsigned long flags;
-               spin_lock_irqsave(&instance->hba_lock, flags);
-               writel(le32_to_cpu(req_desc->u.low),
-                       &instance->reg_set->inbound_low_queue_port);
-               writel(le32_to_cpu(req_desc->u.high),
-                       &instance->reg_set->inbound_high_queue_port);
-               mmiowb();
-               spin_unlock_irqrestore(&instance->hba_lock, flags);
+       unsigned long flags;
+       spin_lock_irqsave(&instance->hba_lock, flags);
+       writel(le32_to_cpu(req_desc->u.low),
+               &instance->reg_set->inbound_low_queue_port);
+       writel(le32_to_cpu(req_desc->u.high),
+               &instance->reg_set->inbound_high_queue_port);
+       mmiowb();
+       spin_unlock_irqrestore(&instance->hba_lock, flags);
 #endif
-       }
 }
 
 /**
@@ -982,7 +976,6 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
        const char *sys_info;
        MFI_CAPABILITIES *drv_ops;
        u32 scratch_pad_2;
-       unsigned long flags;
        struct timeval tv;
        bool cur_fw_64bit_dma_capable;
 
@@ -1121,14 +1114,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
                        break;
        }
 
-       /* For Ventura also IOC INIT required 64 bit Descriptor write. */
-       spin_lock_irqsave(&instance->hba_lock, flags);
-       writel(le32_to_cpu(req_desc.u.low),
-              &instance->reg_set->inbound_low_queue_port);
-       writel(le32_to_cpu(req_desc.u.high),
-              &instance->reg_set->inbound_high_queue_port);
-       mmiowb();
-       spin_unlock_irqrestore(&instance->hba_lock, flags);
+       megasas_fire_cmd_fusion(instance, &req_desc);
 
        wait_and_poll(instance, cmd, MFI_POLL_TIMEOUT_SECS);
 
@@ -2655,11 +2641,8 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
                        fp_possible = (io_info.fpOkForIo > 0) ? true : false;
        }
 
-       /* Use raw_smp_processor_id() for now until cmd->request->cpu is CPU
-          id by default, not CPU group id, otherwise all MSI-X queues won't
-          be utilized */
-       cmd->request_desc->SCSIIO.MSIxIndex = instance->msix_vectors ?
-               raw_smp_processor_id() % instance->msix_vectors : 0;
+       cmd->request_desc->SCSIIO.MSIxIndex =
+               instance->reply_map[raw_smp_processor_id()];
 
        praid_context = &io_request->RaidContext;
 
@@ -2981,10 +2964,9 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
        }
 
        cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
-       cmd->request_desc->SCSIIO.MSIxIndex =
-               instance->msix_vectors ?
-               (raw_smp_processor_id() % instance->msix_vectors) : 0;
 
+       cmd->request_desc->SCSIIO.MSIxIndex =
+               instance->reply_map[raw_smp_processor_id()];
 
        if (!fp_possible) {
                /* system pd firmware path */