From patchwork Mon Jan 10 05:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708226 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFFF2C433F5 for ; Mon, 10 Jan 2022 05:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238738AbiAJF1B (ORCPT ); Mon, 10 Jan 2022 00:27:01 -0500 Received: from mga01.intel.com ([192.55.52.88]:9535 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238702AbiAJF0x (ORCPT ); Mon, 10 Jan 2022 00:26:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792413; x=1673328413; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O4t9i/AKNYnzGZdgGMZEdQetQ7hbhCioKYXvHK22hEk=; b=B6Dz8Duo9dgeGfYlox3wKJ5lkdGco9YYNIK+QSyKmoxvx/bKlMaEzwUC 3wjTST5lE3LXs4xVQIK1zdMI1x1TZAbrr4+o/y2V/6Pv7Y5qN2YWgGqTq ZDvA2DLUmGuG5hVWK+6gLlxwhzlVmFgG62Dho5sXRT6zGRQw/+yYqklW6 An+Niy7wNDz/E83G8JUZA/+hFw59hosmvoCyx96bCL0nU6QEcbF6r77TT npAEJcDbB/jaZMVbUCseXctf3g6r+ByWqTCAzzTBkAYUKR+8kyLrj0xQL 8N+tb07exCCER/3QMEZ41E0CzWKwRYHpGnqQTogf/Z6bzZILTzRM9ehIm w==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479489" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479489" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:53 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892268" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:51 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 1/7] vDPA/ifcvf: implement IO read/write helpers in the header file Date: Mon, 10 Jan 2022 13:19:41 +0800 Message-Id: <20220110051947.84901-2-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org re-implement IO read/write helpers in the header file, so that they can be utilized among modules. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_base.c | 36 -------------------------------- drivers/vdpa/ifcvf/ifcvf_base.h | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c index 2808f1ba9f7b..0b5df4cfaf06 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -10,42 +10,6 @@ #include "ifcvf_base.h" -static inline u8 ifc_ioread8(u8 __iomem *addr) -{ - return ioread8(addr); -} -static inline u16 ifc_ioread16 (__le16 __iomem *addr) -{ - return ioread16(addr); -} - -static inline u32 ifc_ioread32(__le32 __iomem *addr) -{ - return ioread32(addr); -} - -static inline void ifc_iowrite8(u8 value, u8 __iomem *addr) -{ - iowrite8(value, addr); -} - -static inline void ifc_iowrite16(u16 value, __le16 __iomem *addr) -{ - iowrite16(value, addr); -} - -static inline void ifc_iowrite32(u32 value, __le32 __iomem *addr) -{ - iowrite32(value, addr); -} - -static void ifc_iowrite64_twopart(u64 val, - __le32 __iomem *lo, __le32 __iomem *hi) -{ - ifc_iowrite32((u32)val, lo); - ifc_iowrite32(val >> 32, hi); -} - struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw) { return container_of(hw, struct ifcvf_adapter, vf); diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h index 09918af3ecf8..c924a7673afb 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.h +++ b/drivers/vdpa/ifcvf/ifcvf_base.h @@ -42,6 +42,43 @@ #define ifcvf_private_to_vf(adapter) \ (&((struct ifcvf_adapter *)adapter)->vf) +static inline u8 ifc_ioread8(u8 __iomem *addr) +{ + return ioread8(addr); +} + +static inline u16 ifc_ioread16(__le16 __iomem *addr) +{ + return ioread16(addr); +} + +static inline u32 ifc_ioread32(__le32 __iomem *addr) +{ + return ioread32(addr); +} + +static inline void ifc_iowrite8(u8 value, u8 __iomem *addr) +{ + iowrite8(value, addr); +} + +static inline void ifc_iowrite16(u16 value, __le16 __iomem *addr) +{ + iowrite16(value, addr); +} + +static inline void ifc_iowrite32(u32 value, __le32 __iomem *addr) +{ + iowrite32(value, addr); +} + +static inline void ifc_iowrite64_twopart(u64 val, + __le32 __iomem *lo, __le32 __iomem *hi) +{ + ifc_iowrite32((u32)val, lo); + ifc_iowrite32(val >> 32, hi); +} + struct vring_info { u64 desc; u64 avail; From patchwork Mon Jan 10 05:19:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708227 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70BD3C433EF for ; Mon, 10 Jan 2022 05:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238743AbiAJF1F (ORCPT ); Mon, 10 Jan 2022 00:27:05 -0500 Received: from mga01.intel.com ([192.55.52.88]:9532 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238715AbiAJF0z (ORCPT ); Mon, 10 Jan 2022 00:26:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792415; x=1673328415; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SkK3KJA5kuRSaw0A/VhI97frWfNhCA3kJuBS59qfbO8=; b=nertf6DbHtSoFadCrFfaGCzoPd8dgZwe67Jf9M0jOeREXBzPMQHIrrw/ dt5zyPArL3cy0U6v9J7nI06C0zDjTvkcMkQ00hTxoSj8yy/nG9k+gdXZW bBYeSwz0ZYnh/Aq7SsEgoRp3MzlpZcMcFoepyQnB7mgsragcowV3pSJWC 6t7LVwZUWml+hwP8i/4oE49BONuNdXM3UZLcg0CHuYbAWKrTrjKHsNBkR 8UgDCwKn5Bzu8qLF8CgKVe+5TW6txwnG/W9tE1BpgE3FGZqXJUpvX6PFE 50lZhpLt8c7vgtee1n5Q/UcFsNa+xu5InSbwyc65gsyBw9JQ7D0lKjafQ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479497" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479497" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:55 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892276" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:53 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 2/7] vDPA/ifcvf: introduce new helpers to set config vector and vq vectors Date: Mon, 10 Jan 2022 13:19:42 +0800 Message-Id: <20220110051947.84901-3-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit introduces new helpers to set config vector and vq vectors in virtio common config space. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_base.c | 30 ++++++++++++++++++++++++++++++ drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c index 0b5df4cfaf06..696a41560eaa 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -15,6 +15,36 @@ struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw) return container_of(hw, struct ifcvf_adapter, vf); } +int ifcvf_set_vq_vector(struct ifcvf_hw *hw, u16 qid, int vector) +{ + struct virtio_pci_common_cfg __iomem *cfg = hw->common_cfg; + struct ifcvf_adapter *ifcvf = vf_to_adapter(hw); + + ifc_iowrite16(qid, &cfg->queue_select); + ifc_iowrite16(vector, &cfg->queue_msix_vector); + if (ifc_ioread16(&cfg->queue_msix_vector) == VIRTIO_MSI_NO_VECTOR) { + IFCVF_ERR(ifcvf->pdev, "No msix vector for queue %u\n", qid); + return -EINVAL; + } + + return 0; +} + +int ifcvf_set_config_vector(struct ifcvf_hw *hw, int vector) +{ + struct virtio_pci_common_cfg __iomem *cfg = hw->common_cfg; + struct ifcvf_adapter *ifcvf = vf_to_adapter(hw); + + cfg = hw->common_cfg; + ifc_iowrite16(vector, &cfg->msix_config); + if (ifc_ioread16(&cfg->msix_config) == VIRTIO_MSI_NO_VECTOR) { + IFCVF_ERR(ifcvf->pdev, "No msix vector for device config\n"); + return -EINVAL; + } + + return 0; +} + static void __iomem *get_cap_addr(struct ifcvf_hw *hw, struct virtio_pci_cap *cap) { diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h index c924a7673afb..1d5431040d7d 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.h +++ b/drivers/vdpa/ifcvf/ifcvf_base.h @@ -157,4 +157,6 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid); int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num); struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw); int ifcvf_probed_virtio_net(struct ifcvf_hw *hw); +int ifcvf_set_vq_vector(struct ifcvf_hw *hw, u16 qid, int vector); +int ifcvf_set_config_vector(struct ifcvf_hw *hw, int vector); #endif /* _IFCVF_H_ */ From patchwork Mon Jan 10 05:19:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708228 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DEF6C433F5 for ; Mon, 10 Jan 2022 05:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233367AbiAJF1J (ORCPT ); Mon, 10 Jan 2022 00:27:09 -0500 Received: from mga01.intel.com ([192.55.52.88]:9535 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238719AbiAJF05 (ORCPT ); Mon, 10 Jan 2022 00:26:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792417; x=1673328417; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ioRk7cwXbBNQJIQEP8s7EVvCPiqFelLbAYEXA+lwOtU=; b=HxcrfeQNEvh5Rot0B4VkbW5Wo1HPx9YTVMj4pSjDo8WZU86cX8PILWZJ JoDHkYt4l/vR0tppgzFGbCLLF9UvVDvObEmbn+Fj2u6tn9CL9zWwsSkBr Mnwberf9W1LnsZUjURTiIhq6aSkOvFfhd4kgc2ZCP16HMAsJ/CSf7Bbyq uDvzPDbZzwk11k2x4wsNXFi6nNQP7T6kdbph/x9UVH0PbVGTn0LQOTUxz 9F7ZK6/55bDSlI0GZYEZQLYVKpas0Yv8p++nmcM0YiplYOKxBbNSB5Ohg VHYAb1RwYjs2BPcUPRkU6XungpCoxM79jFAbf5n1FiLF+sRMoD1KI9F4H A==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479510" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479510" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:57 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892284" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:55 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 3/7] vDPA/ifcvf: implement device MSIX vector allocation helper Date: Mon, 10 Jan 2022 13:19:43 +0800 Message-Id: <20220110051947.84901-4-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit implements a MSIX vector allocation helper Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 6dc75ca70b37..64fc78eaa1a9 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -58,6 +58,30 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues) ifcvf_free_irq_vectors(pdev); } +static int ifcvf_alloc_vectors(struct ifcvf_adapter *adapter) +{ + struct pci_dev *pdev = adapter->pdev; + struct ifcvf_hw *vf = &adapter->vf; + u16 max_intr = 0; + u16 ret = 0; + + /* all queues and config interrupt */ + max_intr = vf->nr_vring + 1; + ret = pci_alloc_irq_vectors(pdev, 1, max_intr, PCI_IRQ_MSIX|PCI_IRQ_AFFINITY); + + if (ret < 0) { + IFCVF_ERR(pdev, "Failed to alloc IRQ vectors\n"); + return ret; + } + + if (ret < max_intr) + IFCVF_INFO(pdev, + "Requested %u vectors, however only %u allocated, lower performance\n", + max_intr, ret); + + return ret; +} + static int ifcvf_request_irq(struct ifcvf_adapter *adapter) { struct pci_dev *pdev = adapter->pdev; From patchwork Mon Jan 10 05:19:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708229 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9C42C433EF for ; Mon, 10 Jan 2022 05:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233446AbiAJF1M (ORCPT ); Mon, 10 Jan 2022 00:27:12 -0500 Received: from mga01.intel.com ([192.55.52.88]:9532 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238731AbiAJF07 (ORCPT ); Mon, 10 Jan 2022 00:26:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792418; x=1673328418; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5spvfVY7/awR+3F1s36KHqk46jZB1r0FdwjUDAIkfT4=; b=XSuyD3FgsQ53+gOf5SvkKi+re2o5MKHH7jmRga4AgNllhDaT7KfSTi3F h+yUGpLGvmNKnWCyOU9r1t6U4rvuGoUs0smH3sEx7TisxhZFShcgE19qa oiv5niOS6q8Ow0mezNMUemKAkfnEaIZS9ZyR8oKjIrasMsj8+6nFV8Vtg 6khPVcaLP7JGUnPXBxyyHJC02uKWljRPub84ZllwhaBbAF4ez8i2A9n8A gJgzL8hadTe6+ljiBeKM2d+vTRRocsTkPkoBBupvdfX7XqTkC+Ec9VeGh PINte6RAI1zygreAhLfZsx7vXf5ajQbZFOzC0LgTWqz1WFh6afp/gtt54 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479519" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479519" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:58 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892304" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:57 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 4/7] vDPA/ifcvf: implement shared irq handlers for vqs Date: Mon, 10 Jan 2022 13:19:44 +0800 Message-Id: <20220110051947.84901-5-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It has observed that a device may fail to alloc enough vectors on some platforms, e.g., requires 16 vectors, but only 2 or 4 vector slots allocated. The virt queues have to share a vector/irq under such circumstances. This irq handlers has to kick every queue because it is not possible to tell which queue triggers the interrupt. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 64fc78eaa1a9..19e1d1cd71a3 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -37,6 +37,21 @@ static irqreturn_t ifcvf_intr_handler(int irq, void *arg) return IRQ_HANDLED; } +static irqreturn_t ifcvf_shared_intr_handler(int irq, void *arg) +{ + struct ifcvf_hw *vf = arg; + struct vring_info *vring; + int i; + + for (i = 0; i < vf->nr_vring; i++) { + vring = &vf->vring[i]; + if (vring->cb.callback) + vf->vring->cb.callback(vring->cb.private); + } + + return IRQ_HANDLED; +} + static void ifcvf_free_irq_vectors(void *data) { pci_free_irq_vectors(data); From patchwork Mon Jan 10 05:19:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708230 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D0FC433FE for ; Mon, 10 Jan 2022 05:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238768AbiAJF1P (ORCPT ); Mon, 10 Jan 2022 00:27:15 -0500 Received: from mga01.intel.com ([192.55.52.88]:9535 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238733AbiAJF1B (ORCPT ); Mon, 10 Jan 2022 00:27:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792421; x=1673328421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vwEflBjEi/Ibz5v2X+ulh3NV9ceFr49WwWhf2QgLebY=; b=XomUORyioSVQVyGrR6Ln/gk9kvUHbRzTMxGEbB5ok5ZYqBLrMp43KIip INVHRuGRyH1Evzbrfqs9dQvXO+9BHTRNkEMLC9OyOFfNEJXbV4/HVwcHJ d52zqol8w/+nE4umIhnujN2RTzzY6/PlPGxbE8DKnYyXQDk1nrDs/YQKk LLM4/BlT29fq2/Aatspn/LD2eqcwnyYlYtFKdL3OVjNh1HYL1f26zbXeR fdVguNC7TyypqwS4j+0/lLhiRPd64hGgPLeKvNAfzo4cSnwF7eso7P28J Ra43huYIxCoa+Dftl+HFbsaRV1ut0i4lyo0AJ+0/2ZhDRl2jA8ihKj/cs Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479523" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479523" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:27:00 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892312" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:26:59 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 5/7] vDPA/ifcvf: irq request helpers for both shared and per_vq irq Date: Mon, 10 Jan 2022 13:19:45 +0800 Message-Id: <20220110051947.84901-6-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit implements new irq request helpers: ifcvf_request_shared_vq_irq() for a shared irq, in this case, all virtqueues would share one irq/vector. This can help the device work on some platforms that can not provide enough MSIX vectors ifcvf_request_per_vq_irq() for per vq irqs, in this case, every virtqueue has its own irq/vector ifcvf_request_vq_irq() calls either of the above two, depends on the number of allocated vectors. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_base.c | 9 ----- drivers/vdpa/ifcvf/ifcvf_main.c | 66 +++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c index 696a41560eaa..fc496d10cf8d 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -349,15 +349,6 @@ static int ifcvf_hw_enable(struct ifcvf_hw *hw) ifc_iowrite64_twopart(hw->vring[i].used, &cfg->queue_used_lo, &cfg->queue_used_hi); ifc_iowrite16(hw->vring[i].size, &cfg->queue_size); - ifc_iowrite16(i + IFCVF_MSI_QUEUE_OFF, &cfg->queue_msix_vector); - - if (ifc_ioread16(&cfg->queue_msix_vector) == - VIRTIO_MSI_NO_VECTOR) { - IFCVF_ERR(ifcvf->pdev, - "No msix vector for queue %u\n", i); - return -EINVAL; - } - ifcvf_set_vq_state(hw, i, hw->vring[i].last_avail_idx); ifc_iowrite16(1, &cfg->queue_enable); } diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 19e1d1cd71a3..ce2fbc429fbe 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -97,6 +97,72 @@ static int ifcvf_alloc_vectors(struct ifcvf_adapter *adapter) return ret; } +static int ifcvf_request_per_vq_irq(struct ifcvf_adapter *adapter) +{ + struct pci_dev *pdev = adapter->pdev; + struct ifcvf_hw *vf = &adapter->vf; + int i, vector, ret, irq; + + for (i = 0; i < vf->nr_vring; i++) { + snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n", pci_name(pdev), i); + vector = i; + irq = pci_irq_vector(pdev, vector); + ret = devm_request_irq(&pdev->dev, irq, + ifcvf_intr_handler, 0, + vf->vring[i].msix_name, + &vf->vring[i]); + if (ret) { + IFCVF_ERR(pdev, "Failed to request irq for vq %d\n", i); + ifcvf_free_irq(adapter, i); + } else { + vf->vring[i].irq = irq; + ifcvf_set_vq_vector(vf, i, vector); + } + } + + return 0; +} + +static int ifcvf_request_shared_vq_irq(struct ifcvf_adapter *adapter) +{ + struct pci_dev *pdev = adapter->pdev; + struct ifcvf_hw *vf = &adapter->vf; + int i, vector, ret, irq; + + vector = 0; + irq = pci_irq_vector(pdev, vector); + ret = devm_request_irq(&pdev->dev, irq, + ifcvf_shared_intr_handler, 0, + "ifcvf_shared_irq", + vf); + if (ret) { + IFCVF_ERR(pdev, "Failed to request shared irq for vf\n"); + + return ret; + } + + for (i = 0; i < vf->nr_vring; i++) { + vf->vring[i].irq = irq; + ifcvf_set_vq_vector(vf, i, vector); + } + + return 0; + +} + +static int ifcvf_request_vq_irq(struct ifcvf_adapter *adapter, u8 vector_per_vq) +{ + int ret; + + if (vector_per_vq) + ret = ifcvf_request_per_vq_irq(adapter); + else + ret = ifcvf_request_shared_vq_irq(adapter); + + return ret; +} + + static int ifcvf_request_irq(struct ifcvf_adapter *adapter) { struct pci_dev *pdev = adapter->pdev; From patchwork Mon Jan 10 05:19:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708231 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CBCDC433EF for ; Mon, 10 Jan 2022 05:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238774AbiAJF1S (ORCPT ); Mon, 10 Jan 2022 00:27:18 -0500 Received: from mga01.intel.com ([192.55.52.88]:9532 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238739AbiAJF1D (ORCPT ); Mon, 10 Jan 2022 00:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792423; x=1673328423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C3u87lHKZw5KqrSIqgM7CnXVDqNPk+IDdddK2e/V1wU=; b=BQhGCpo6M0sguIeDY+uthCug6BFslDgoYjFArRkd7DbnHVODxzvOgF0/ KY7vfb1nNI/u2UZS/H9B/jMLxqUtE7TJmyojj/XCL4IVS63TnbstO0fz8 b8kBTdThIEHj8JF0AKnpdBPycSaG4LJ8s3nGMirbf4d+ZdNBUC41KzPN9 neTb8+L/1uc0Z8imlhhreTtZJAwZlibPZK/aEZE3ACqtZXwOFPIlALN8t rtY+1n+DsyidP6oEKPSumSIz9efhVElN2Zzp6318EoPoZZJaNlt2fHn2w 6dU9DcAoIB+0KXvlmMJ5vwJlw1jmVfyBJ5dcINmagKgVGaOksrireDiLJ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479527" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479527" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:27:02 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892325" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:27:00 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 6/7] vDPA/ifcvf: implement config interrupt request helper Date: Mon, 10 Jan 2022 13:19:46 +0800 Message-Id: <20220110051947.84901-7-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit implements new helper to request config interrupt by a given MSIX vector. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_base.c | 6 ------ drivers/vdpa/ifcvf/ifcvf_main.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c index fc496d10cf8d..38f91dc6481f 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -330,12 +330,6 @@ static int ifcvf_hw_enable(struct ifcvf_hw *hw) ifcvf = vf_to_adapter(hw); cfg = hw->common_cfg; - ifc_iowrite16(IFCVF_MSI_CONFIG_OFF, &cfg->msix_config); - - if (ifc_ioread16(&cfg->msix_config) == VIRTIO_MSI_NO_VECTOR) { - IFCVF_ERR(ifcvf->pdev, "No msix vector for device config\n"); - return -EINVAL; - } for (i = 0; i < hw->nr_vring; i++) { if (!hw->vring[i].ready) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index ce2fbc429fbe..414b5dfd04ca 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -162,6 +162,32 @@ static int ifcvf_request_vq_irq(struct ifcvf_adapter *adapter, u8 vector_per_vq) return ret; } +static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter, int config_vector) +{ + struct pci_dev *pdev = adapter->pdev; + struct ifcvf_hw *vf = &adapter->vf; + int ret; + + if (!config_vector) { + IFCVF_INFO(pdev, "No config interrupt because of no vectors\n"); + vf->config_irq = -EINVAL; + return 0; + } + + snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n", + pci_name(pdev)); + vf->config_irq = pci_irq_vector(pdev, config_vector); + ret = devm_request_irq(&pdev->dev, vf->config_irq, + ifcvf_config_changed, 0, + vf->config_msix_name, vf); + if (ret) { + IFCVF_ERR(pdev, "Failed to request config irq\n"); + return ret; + } + ifcvf_set_config_vector(vf, config_vector); + + return 0; +} static int ifcvf_request_irq(struct ifcvf_adapter *adapter) { From patchwork Mon Jan 10 05:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12708232 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 284E9C433F5 for ; Mon, 10 Jan 2022 05:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238799AbiAJF1b (ORCPT ); Mon, 10 Jan 2022 00:27:31 -0500 Received: from mga01.intel.com ([192.55.52.88]:9544 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238742AbiAJF1E (ORCPT ); Mon, 10 Jan 2022 00:27:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641792424; x=1673328424; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Y43mCzCtOa4jeMuuqM5GMSSeh6Z308UfkfH52saLW0=; b=JEIn8FarUEbXjNcLo5vO6YH8bCvMwMyRi9eVqE2NT4XxlW9qjhIRSHqz K3ceqb5vu0ALWrNpVOTBzKrLECyf+FLsolSlm+1UMW1r9ub//S0XKYWLD Bc6fb8Hht/ko4sVXUug4l9H2S62Es844CRKcX5zTbF/cxMPcJMPmUCZqE CcZMeoYhRarrIDY8sUaZEWdO2Noo04UeOZm/oj0MSRujdJ21rNEeET/Tp Cgua1XLS/Uj1B/8RiCtfisG96Umd5EX5+RuA+6tq5CPbuQ8dFFRGo51VB w+YnLx/UrG8VeJFCuSp7sk2Sx8YmYwqwHelEDQPGziHDr20R2h4WVcFrD Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="267479532" X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="267479532" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:27:04 -0800 X-IronPort-AV: E=Sophos;i="5.88,276,1635231600"; d="scan'208";a="489892333" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2022 21:27:02 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH 7/7] vDPA/ifcvf: improve irq requester, to handle per_vq/shared/config irq Date: Mon, 10 Jan 2022 13:19:47 +0800 Message-Id: <20220110051947.84901-8-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220110051947.84901-1-lingshan.zhu@intel.com> References: <20220110051947.84901-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This commit expends irq requester abilities to handle per vq irq, shared irq and config irq. On some platforms, the device can not get enough vectors for every virtqueue and config interrupt, the device needs to work under such circumstances. Normally a device can get enough vectors, so every virtqueue and config interrupt can have its own vector/irq. If the total vector number is less than all virtqueues + 1(config interrupt), all virtqueues need to share a vector/irq and config interrupt is enabled. If the total vector number < 2, all vitequeues share a vector/irq, and config interrupt is disabled. Otherwise it will fail if allocation for vectors fails. This commit also made necessary chages to the irq cleaner to free per vq irq/shared irq and config irq. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_base.h | 6 +-- drivers/vdpa/ifcvf/ifcvf_main.c | 78 +++++++++++++++------------------ 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h index 1d5431040d7d..1d0afb63f06c 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.h +++ b/drivers/vdpa/ifcvf/ifcvf_base.h @@ -27,8 +27,6 @@ #define IFCVF_QUEUE_ALIGNMENT PAGE_SIZE #define IFCVF_QUEUE_MAX 32768 -#define IFCVF_MSI_CONFIG_OFF 0 -#define IFCVF_MSI_QUEUE_OFF 1 #define IFCVF_PCI_MAX_RESOURCE 6 #define IFCVF_LM_CFG_SIZE 0x40 @@ -102,11 +100,13 @@ struct ifcvf_hw { u8 notify_bar; /* Notificaiton bar address */ void __iomem *notify_base; + u8 vector_per_vq; + u16 padding; phys_addr_t notify_base_pa; u32 notify_off_multiplier; + u32 dev_type; u64 req_features; u64 hw_features; - u32 dev_type; struct virtio_pci_common_cfg __iomem *common_cfg; void __iomem *net_cfg; struct vring_info vring[IFCVF_MAX_QUEUES]; diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 414b5dfd04ca..ec76e342bd7e 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -17,6 +17,8 @@ #define DRIVER_AUTHOR "Intel Corporation" #define IFCVF_DRIVER_NAME "ifcvf" +static struct vdpa_config_ops ifc_vdpa_ops; + static irqreturn_t ifcvf_config_changed(int irq, void *arg) { struct ifcvf_hw *vf = arg; @@ -63,13 +65,20 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues) struct ifcvf_hw *vf = &adapter->vf; int i; + if (vf->vector_per_vq) + for (i = 0; i < queues; i++) { + devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]); + vf->vring[i].irq = -EINVAL; + } + else + devm_free_irq(&pdev->dev, vf->vring[0].irq, vf); - for (i = 0; i < queues; i++) { - devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]); - vf->vring[i].irq = -EINVAL; + + if (vf->config_irq != -EINVAL) { + devm_free_irq(&pdev->dev, vf->config_irq, vf); + vf->config_irq = -EINVAL; } - devm_free_irq(&pdev->dev, vf->config_irq, vf); ifcvf_free_irq_vectors(pdev); } @@ -191,52 +200,35 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter, int config_ve static int ifcvf_request_irq(struct ifcvf_adapter *adapter) { - struct pci_dev *pdev = adapter->pdev; struct ifcvf_hw *vf = &adapter->vf; - int vector, i, ret, irq; - u16 max_intr; + u16 nvectors, max_vectors; + int config_vector, ret; - /* all queues and config interrupt */ - max_intr = vf->nr_vring + 1; + nvectors = ifcvf_alloc_vectors(adapter); + if (nvectors < 0) + return nvectors; - ret = pci_alloc_irq_vectors(pdev, max_intr, - max_intr, PCI_IRQ_MSIX); - if (ret < 0) { - IFCVF_ERR(pdev, "Failed to alloc IRQ vectors\n"); - return ret; - } + vf->vector_per_vq = true; + max_vectors = vf->nr_vring + 1; + config_vector = vf->nr_vring; - snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n", - pci_name(pdev)); - vector = 0; - vf->config_irq = pci_irq_vector(pdev, vector); - ret = devm_request_irq(&pdev->dev, vf->config_irq, - ifcvf_config_changed, 0, - vf->config_msix_name, vf); - if (ret) { - IFCVF_ERR(pdev, "Failed to request config irq\n"); - return ret; + if (nvectors < max_vectors) { + vf->vector_per_vq = false; + config_vector = 1; + ifc_vdpa_ops.get_vq_irq = NULL; } - for (i = 0; i < vf->nr_vring; i++) { - snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n", - pci_name(pdev), i); - vector = i + IFCVF_MSI_QUEUE_OFF; - irq = pci_irq_vector(pdev, vector); - ret = devm_request_irq(&pdev->dev, irq, - ifcvf_intr_handler, 0, - vf->vring[i].msix_name, - &vf->vring[i]); - if (ret) { - IFCVF_ERR(pdev, - "Failed to request irq for vq %d\n", i); - ifcvf_free_irq(adapter, i); + if (nvectors < 2) + config_vector = 0; - return ret; - } + ret = ifcvf_request_vq_irq(adapter, vf->vector_per_vq); + if (ret) + return ret; - vf->vring[i].irq = irq; - } + ret = ifcvf_request_config_irq(adapter, config_vector); + + if (ret) + return ret; return 0; } @@ -573,7 +565,7 @@ static struct vdpa_notification_area ifcvf_get_vq_notification(struct vdpa_devic * IFCVF currently does't have on-chip IOMMU, so not * implemented set_map()/dma_map()/dma_unmap() */ -static const struct vdpa_config_ops ifc_vdpa_ops = { +static struct vdpa_config_ops ifc_vdpa_ops = { .get_features = ifcvf_vdpa_get_features, .set_features = ifcvf_vdpa_set_features, .get_status = ifcvf_vdpa_get_status,