From patchwork Fri Mar 23 22:19:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 10305663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 988FB60349 for ; Fri, 23 Mar 2018 22:17:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C788291C9 for ; Fri, 23 Mar 2018 22:17:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 716EC291CF; Fri, 23 Mar 2018 22:17:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9794291CE for ; Fri, 23 Mar 2018 22:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752007AbeCWWRI (ORCPT ); Fri, 23 Mar 2018 18:17:08 -0400 Received: from mga17.intel.com ([192.55.52.151]:21051 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751715AbeCWWRH (ORCPT ); Fri, 23 Mar 2018 18:17:07 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Mar 2018 15:17:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,351,1517904000"; d="scan'208";a="185485264" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.44]) by orsmga004.jf.intel.com with ESMTP; 23 Mar 2018 15:17:06 -0700 From: Keith Busch To: Linux NVMe , Linux Block Cc: Christoph Hellwig , Sagi Grimberg , Jianchao Wang , Ming Lei , Jens Axboe , Keith Busch Subject: [PATCH 1/3] blk-mq: Allow PCI vector offset for mapping queues Date: Fri, 23 Mar 2018 16:19:21 -0600 Message-Id: <20180323221923.24545-1-keith.busch@intel.com> X-Mailer: git-send-email 2.13.6 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The PCI interrupt vectors intended to be associated with a queue may not start at 0. This patch adds an offset parameter so blk-mq may find the intended affinity mask. The default value is 0 so existing drivers that don't care about this parameter don't need to change. Signed-off-by: Keith Busch --- block/blk-mq-pci.c | 12 ++++++++++-- include/linux/blk-mq-pci.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/blk-mq-pci.c b/block/blk-mq-pci.c index 76944e3271bf..1040a7705c13 100644 --- a/block/blk-mq-pci.c +++ b/block/blk-mq-pci.c @@ -21,6 +21,7 @@ * blk_mq_pci_map_queues - provide a default queue mapping for PCI device * @set: tagset to provide the mapping for * @pdev: PCI device associated with @set. + * @offset: PCI irq starting vector offset * * This function assumes the PCI device @pdev has at least as many available * interrupt vectors as @set has queues. It will then query the vector @@ -28,13 +29,14 @@ * that maps a queue to the CPUs that have irq affinity for the corresponding * vector. */ -int blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev) +int __blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev, + int offset) { const struct cpumask *mask; unsigned int queue, cpu; for (queue = 0; queue < set->nr_hw_queues; queue++) { - mask = pci_irq_get_affinity(pdev, queue); + mask = pci_irq_get_affinity(pdev, queue + offset); if (!mask) goto fallback; @@ -50,4 +52,10 @@ int blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev) set->mq_map[cpu] = 0; return 0; } +EXPORT_SYMBOL_GPL(__blk_mq_pci_map_queues); + +int blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev) +{ + return __blk_mq_pci_map_queues(set, pdev, 0); +} EXPORT_SYMBOL_GPL(blk_mq_pci_map_queues); diff --git a/include/linux/blk-mq-pci.h b/include/linux/blk-mq-pci.h index 6338551e0fb9..5a92ecdbd78e 100644 --- a/include/linux/blk-mq-pci.h +++ b/include/linux/blk-mq-pci.h @@ -5,6 +5,8 @@ struct blk_mq_tag_set; struct pci_dev; +int __blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev, + int offset); int blk_mq_pci_map_queues(struct blk_mq_tag_set *set, struct pci_dev *pdev); #endif /* _LINUX_BLK_MQ_PCI_H */