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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A70BC4332F for ; Fri, 25 Nov 2022 15:06:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A9D8E4059C; Fri, 25 Nov 2022 15:06:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A9D8E4059C Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Kum0WM8T X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fJ8OHgfQR2qp; Fri, 25 Nov 2022 15:06:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 3F58740484; Fri, 25 Nov 2022 15:06:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3F58740484 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 113A1C0033; Fri, 25 Nov 2022 15:06:44 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 58B62C002D for ; Fri, 25 Nov 2022 15:06:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 277998216B for ; Fri, 25 Nov 2022 15:06:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 277998216B Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Kum0WM8T X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oTdwShG17Lq6 for ; Fri, 25 Nov 2022 15:06:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 80F4482159 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by smtp1.osuosl.org (Postfix) with ESMTPS id 80F4482159 for ; Fri, 25 Nov 2022 15:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669388801; x=1700924801; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lRb74Ed4w5JOXpI/O/j8nJXYHPcznwfk4WiJ395xlf8=; b=Kum0WM8T6nGfGp57UqNYDr78n3lszXN0TPQFEuuhljQCBtnln2ntl1t6 EgclUiXBg7n7gWO0A1DZWvDP6kujPrMe2BXLYrP5e49jIpZjhH9GNQ19H ZjuXDJtuCsRimsXkUC2ZmbxCd0pXzM9/Mj7hw01SbdPMJrgAa/5RXbCHu E9oSOzMWL5SVCfeA1VKeFTdN47KCM0j9fuojge2ZITyV6YCsbzKT6N4Gx lgvJ0kRKqCtZJT06MVvnyxpk0XU9fV7Q3g8ytRIXwgVmPGEF9F+Fnbi8v HQd2UK84WOgfHF7KQ9o/YD+mlyCy2MQPOYxDwXa85w9MUnA8HFX9oPMp7 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="400787417" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="400787417" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 07:06:41 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="593240281" X-IronPort-AV: E=Sophos;i="5.96,193,1665471600"; d="scan'208";a="593240281" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.193.73]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 07:06:38 -0800 From: Zhu Lingshan To: jasowang@redhat.com, mst@redhat.com Subject: [PATCH V2 07/12] vDPA/ifcvf: decouple config/dev IRQ requester and vectors allocator from the adapter Date: Fri, 25 Nov 2022 22:57:19 +0800 Message-Id: <20221125145724.1129962-8-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221125145724.1129962-1-lingshan.zhu@intel.com> References: <20221125145724.1129962-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Cc: kvm@vger.kernel.org, piotr.uminski@intel.com, stable@vger.kernel.org, hang.yuan@intel.com, virtualization@lists.linux-foundation.org X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" This commit decouples the config irq requester, the device shared irq requester and the MSI vectors allocator from the adapter. So they can be safely invoked since probe before the adapter is allocated. Signed-off-by: Zhu Lingshan Cc: stable@vger.kernel.org --- drivers/vdpa/ifcvf/ifcvf_main.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index ee9c22975119..8320bdacace8 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -132,10 +132,9 @@ static void ifcvf_free_irq(struct ifcvf_hw *vf) * It returns the number of allocated vectors, negative * return value when fails. */ -static int ifcvf_alloc_vectors(struct ifcvf_adapter *adapter) +static int ifcvf_alloc_vectors(struct ifcvf_hw *vf) { - struct pci_dev *pdev = adapter->pdev; - struct ifcvf_hw *vf = &adapter->vf; + struct pci_dev *pdev = vf->pdev; int max_intr, ret; /* all queues and config interrupt */ @@ -222,10 +221,9 @@ static int ifcvf_request_vqs_reused_irq(struct ifcvf_hw *vf) return -EFAULT; } -static int ifcvf_request_dev_irq(struct ifcvf_adapter *adapter) +static int ifcvf_request_dev_irq(struct ifcvf_hw *vf) { - struct pci_dev *pdev = adapter->pdev; - struct ifcvf_hw *vf = &adapter->vf; + struct pci_dev *pdev = vf->pdev; int i, vector, ret, irq; vector = 0; @@ -276,10 +274,9 @@ static int ifcvf_request_vq_irq(struct ifcvf_hw *vf) return ret; } -static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter) +static int ifcvf_request_config_irq(struct ifcvf_hw *vf) { - struct pci_dev *pdev = adapter->pdev; - struct ifcvf_hw *vf = &adapter->vf; + struct pci_dev *pdev = vf->pdev; int config_vector, ret; if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG) @@ -322,7 +319,7 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter) struct ifcvf_hw *vf = &adapter->vf; int nvectors, ret, max_intr; - nvectors = ifcvf_alloc_vectors(adapter); + nvectors = ifcvf_alloc_vectors(vf); if (nvectors <= 0) return -EFAULT; @@ -333,7 +330,7 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter) if (nvectors == 1) { vf->msix_vector_status = MSIX_VECTOR_DEV_SHARED; - ret = ifcvf_request_dev_irq(adapter); + ret = ifcvf_request_dev_irq(vf); return ret; } @@ -342,7 +339,7 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter) if (ret) return ret; - ret = ifcvf_request_config_irq(adapter); + ret = ifcvf_request_config_irq(vf); if (ret) return ret; -- 2.31.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization