[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241113-refactor-blk-affinity-helpers-v4-7-dd3baa1e267f@kernel.org>
Date: Wed, 13 Nov 2024 15:26:21 +0100
From: Daniel Wagner <wagi@...nel.org>
To: Jens Axboe <axboe@...nel.dk>, Bjorn Helgaas <bhelgaas@...gle.com>,
"Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio PĂ©rez <eperezma@...hat.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Keith Busch <kbusch@...nel.org>, Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>, John Garry <john.g.garry@...cle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hannes Reinecke <hare@...e.de>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, virtualization@...ts.linux.dev,
linux-scsi@...r.kernel.org, megaraidlinux.pdl@...adcom.com,
mpi3mr-linuxdrv.pdl@...adcom.com, MPT-FusionLinux.pdl@...adcom.com,
storagedev@...rochip.com, linux-nvme@...ts.infradead.org,
Daniel Wagner <wagi@...nel.org>
Subject: [PATCH v4 07/10] scsi: hisi_sas: use blk_mq_hctx_map_queues to map
queues
The PCI struct bus_type irq_get_affinity callback can't be used here as
hisi_sas v2 implements its own irq affinity code. Thus install a driver
specific irq_get_affinity callback. With this in place it's possible to
replace the open coded queue mapping with blk_mq_hctx_map_queues
function.
Signed-off-by: Daniel Wagner <wagi@...nel.org>
---
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 342d75f12051d28fb1a0692b45ff568dd5b6f814..faa85fbf3e267cf883568d1808207e9a56c70674 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -3372,7 +3372,7 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
for (queue_no = 0; queue_no < hisi_hba->cq_nvecs; queue_no++) {
struct hisi_sas_cq *cq = &hisi_hba->cq[queue_no];
- cq->irq_no = hisi_hba->irq_map[queue_no + 96];
+ cq->irq_no = hisi_hba->irq_map[queue_no + COQ_IRQ_INDEX];
rc = devm_request_threaded_irq(dev, cq->irq_no,
cq_interrupt_v2_hw,
cq_thread_v2_hw, IRQF_ONESHOT,
@@ -3389,6 +3389,14 @@ static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
return rc;
}
+static const struct cpumask *hisi_sas_v2_irq_get_affinity(struct device *dev,
+ unsigned int irq_vec)
+{
+ struct hisi_hba *hisi_hba = dev->driver_data;
+
+ return irq_get_affinity_mask(hisi_hba->irq_map[irq_vec]);
+}
+
static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
{
int rc;
@@ -3553,17 +3561,8 @@ static void 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;
- }
+ blk_mq_hctx_map_queues(qmap, hisi_hba->dev, CQ0_IRQ_INDEX);
}
static const struct scsi_host_template sht_v2_hw = {
@@ -3636,6 +3635,7 @@ static struct platform_driver hisi_sas_v2_driver = {
.name = DRV_NAME,
.of_match_table = sas_v2_of_match,
.acpi_match_table = ACPI_PTR(sas_v2_acpi_match),
+ .irq_get_affinity = hisi_sas_v2_irq_get_affinity,
},
};
--
2.47.0
Powered by blists - more mailing lists