Skip to content

Commit

Permalink
scsi: replace blk_mq_pci_map_queues with blk_mq_dev_map_queues
Browse files Browse the repository at this point in the history
Replace blk_mq_pci_map_queues with blk_mq_dev_map_queues which is more
generic from blk-mq viewpoint, so we can unify all map queue via
blk_mq_dev_map_queues().

Meantime we can pass 'use_manage_irq' info to blk-mq via
blk_mq_dev_map_queues(), this info needn't be 100% accurate, and what
we need is that true has to be passed in if the hba really uses managed
irq.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
  • Loading branch information
Ming Lei authored and intel-lab-lkp committed Jul 9, 2021
1 parent 49f5094 commit 68d3a74
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 23 deletions.
21 changes: 10 additions & 11 deletions drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
Expand Up @@ -3547,24 +3547,23 @@ static struct device_attribute *host_attrs_v2_hw[] = {
NULL
};

static inline const struct cpumask *hisi_hba_get_queue_affinity(
void *dev_data, int offset, int idx)
{
struct hisi_hba *hba = dev_data;

return irq_get_affinity_mask(hba->irq_map[offset + idx]);
}

static int map_queues_v2_hw(struct Scsi_Host *shost)
{
struct hisi_hba *hisi_hba = shost_priv(shost);
struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
const struct cpumask *mask;
unsigned int queue, cpu;

for (queue = 0; queue < qmap->nr_queues; queue++) {
mask = irq_get_affinity_mask(hisi_hba->irq_map[96 + queue]);
if (!mask)
continue;

for_each_cpu(cpu, mask)
qmap->mq_map[cpu] = qmap->queue_offset + queue;
}

return 0;

return blk_mq_dev_map_queues(qmap, hisi_hba, 96,
hisi_hba_get_queue_affinity, false, true);
}

static struct scsi_host_template sht_v2_hw = {
Expand Down
5 changes: 3 additions & 2 deletions drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
Expand Up @@ -3132,8 +3132,9 @@ static int hisi_sas_map_queues(struct Scsi_Host *shost)
struct hisi_hba *hisi_hba = shost_priv(shost);
struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];

return blk_mq_pci_map_queues(qmap, hisi_hba->pci_dev,
BASE_VECTORS_V3_HW);
return blk_mq_dev_map_queues(qmap, hisi_hba->pci_dev,
BASE_VECTORS_V3_HW,
scsi_pci_get_queue_affinity, false, true);
}

static struct scsi_host_template sht_v3_hw = {
Expand Down
4 changes: 3 additions & 1 deletion drivers/scsi/megaraid/megaraid_sas_base.c
Expand Up @@ -47,6 +47,7 @@
#include <scsi/scsi_dbg.h>
#include "megaraid_sas_fusion.h"
#include "megaraid_sas.h"
#include "../scsi_priv.h"

/*
* Number of sectors per IO command
Expand Down Expand Up @@ -3185,7 +3186,8 @@ static int megasas_map_queues(struct Scsi_Host *shost)
map = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
map->nr_queues = instance->msix_vectors - offset;
map->queue_offset = 0;
blk_mq_pci_map_queues(map, instance->pdev, offset);
blk_mq_dev_map_queues(map, instance->pdev, offset,
scsi_pci_get_queue_affinity, false, true);
qoff += map->nr_queues;
offset += map->nr_queues;

Expand Down
9 changes: 5 additions & 4 deletions drivers/scsi/mpi3mr/mpi3mr_os.c
Expand Up @@ -2787,17 +2787,18 @@ static int mpi3mr_bios_param(struct scsi_device *sdev,
* mpi3mr_map_queues - Map queues callback handler
* @shost: SCSI host reference
*
* Call the blk_mq_pci_map_queues with from which operational
* Call the blk_mq_dev_map_queues with from which operational
* queue the mapping has to be done
*
* Return: return of blk_mq_pci_map_queues
* Return: return of blk_mq_dev_map_queues
*/
static int mpi3mr_map_queues(struct Scsi_Host *shost)
{
struct mpi3mr_ioc *mrioc = shost_priv(shost);

return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
mrioc->pdev, mrioc->op_reply_q_offset);
return blk_mq_dev_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
mrioc->pdev, mrioc->op_reply_q_offset,
scsi_pci_get_queue_affinity, false, true);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions drivers/scsi/mpt3sas/mpt3sas_scsih.c
Expand Up @@ -57,6 +57,7 @@
#include <linux/blk-mq-pci.h>
#include <asm/unaligned.h>

#include "../scsi_priv.h"
#include "mpt3sas_base.h"

#define RAID_CHANNEL 1
Expand Down Expand Up @@ -11784,8 +11785,9 @@ static int scsih_map_queues(struct Scsi_Host *shost)
if (ioc->shost->nr_hw_queues == 1)
return 0;

return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
ioc->pdev, ioc->high_iops_queues);
return blk_mq_dev_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
ioc->pdev, ioc->high_iops_queues, scsi_pci_get_queue_affinity,
false, true);
}

/* shost template for SAS 2.0 HBA devices */
Expand Down
4 changes: 3 additions & 1 deletion drivers/scsi/qla2xxx/qla_os.c
Expand Up @@ -21,6 +21,7 @@
#include <scsi/scsi_transport_fc.h>

#include "qla_target.h"
#include "../scsi_priv.h"

/*
* Driver version
Expand Down Expand Up @@ -7696,7 +7697,8 @@ static int qla2xxx_map_queues(struct Scsi_Host *shost)
if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase)
rc = blk_mq_map_queues(qmap);
else
rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset);
rc = blk_mq_dev_map_queues(qmap, vha->hw->pdev, vha->irq_offset,
scsi_pci_get_queue_affinity, false, true);
return rc;
}

Expand Down
9 changes: 9 additions & 0 deletions drivers/scsi/scsi_priv.h
Expand Up @@ -6,6 +6,7 @@
#include <linux/async.h>
#include <scsi/scsi_device.h>
#include <linux/sbitmap.h>
#include <linux/pci.h>

struct request_queue;
struct request;
Expand Down Expand Up @@ -190,4 +191,12 @@ extern int scsi_device_max_queue_depth(struct scsi_device *sdev);

#define SCSI_DEVICE_BLOCK_MAX_TIMEOUT 600 /* units in seconds */

static inline const struct cpumask *scsi_pci_get_queue_affinity(
void *dev_data, int offset, int queue)
{
struct pci_dev *pdev = dev_data;

return pci_irq_get_affinity(pdev, offset + queue);
}

#endif /* _SCSI_PRIV_H */
7 changes: 5 additions & 2 deletions drivers/scsi/smartpqi/smartpqi_init.c
Expand Up @@ -26,6 +26,7 @@
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport_sas.h>
#include <asm/unaligned.h>
#include "../scsi_priv.h"
#include "smartpqi.h"
#include "smartpqi_sis.h"

Expand Down Expand Up @@ -6104,8 +6105,10 @@ static int pqi_map_queues(struct Scsi_Host *shost)
{
struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost);

return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
ctrl_info->pci_dev, 0);
return blk_mq_dev_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
ctrl_info->pci_dev, 0,
scsi_pci_get_queue_affinity, false,
true);
}

static int pqi_slave_configure(struct scsi_device *sdev)
Expand Down

0 comments on commit 68d3a74

Please sign in to comment.