From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B30C42D7C; Wed, 28 Jun 2023 08:37:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31939406B3; Wed, 28 Jun 2023 08:37:10 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 8CE2E40151; Wed, 28 Jun 2023 08:37:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687934228; x=1719470228; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zoZjDKuospZI5PbKyUauwh1BlDuVu9ieGboVCLjgDig=; b=PQODdENpyiW4UF7SB3tFKEuxG/0+xzA/p88cDdZW4v3Ynrws/p5LYE0k mGFc+zA0G3coZubNfQZCCYRmIPR4GJDOkypfdVzMgTri7GlRwup+qmeEr CJHq+ZHYpextC9OtN5X8Glr6raZUw+zia0AQ4YPc52tob9peeejkWvzgP tcmO4RfFEr/xml5/KBx/Gvmw+tSa+tvhXXBa2fT9LkRPognOM4OnfuqBU 6QO6lF2VKvd5p1PjnkoInzwMQg81073ZqYutUFCfiGIxJj7cfIw8/ywWr E4DWoMT7R+xMCaHOT0gTnAUYTzvAe0beP54BCoD5ptOxvpX4WR4hT7JHJ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="364313967" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="364313967" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2023 23:37:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="890939760" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="890939760" Received: from dpdk-limiao-icelake.sh.intel.com ([10.67.111.26]) by orsmga005.jf.intel.com with ESMTP; 27 Jun 2023 23:37:05 -0700 From: Miao Li To: dev@dpdk.org Cc: stable@dpdk.org, Maxime Coquelin , Chenbo Xia , David Marchand Subject: [PATCH 1/2] net/virtio: fix legacy device IO port map in secondary process Date: Wed, 28 Jun 2023 06:36:50 +0000 Message-Id: <20230628063651.178604-1-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When doing IO port map for legacy device in sencondary process, vfio_cfg setup for leagacy device like vfio_group_fd and vfio_dev_fd is missing. So, in sencondary process, rte_pci_map_device is added for legacy device to setup vfio_cfg and fill region info like in primary process. Fixes: 512e27eeb743 ("net/virtio: move PCI specific dev init to PCI ethdev init") Cc: stable@dpdk.org Signed-off-by: Miao Li --- drivers/net/virtio/virtio_pci_ethdev.c | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c index 9b4b846f8a..dc11a6e82f 100644 --- a/drivers/net/virtio/virtio_pci_ethdev.c +++ b/drivers/net/virtio/virtio_pci_ethdev.c @@ -44,23 +44,23 @@ virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_pci_dev *dev) { struct virtio_hw *hw = &dev->hw; - if (dev->modern) { - /* - * We don't have to re-parse the PCI config space, since - * rte_pci_map_device() makes sure the mapped address - * in secondary process would equal to the one mapped in - * the primary process: error will be returned if that - * requirement is not met. - * - * That said, we could simply reuse all cap pointers - * (such as dev_cfg, common_cfg, etc.) parsed from the - * primary process, which is stored in shared memory. - */ - if (rte_pci_map_device(pci_dev)) { - PMD_INIT_LOG(DEBUG, "failed to map pci device!"); - return -1; - } - } else { + /* + * We don't have to re-parse the PCI config space, since + * rte_pci_map_device() makes sure the mapped address + * in secondary process would equal to the one mapped in + * the primary process: error will be returned if that + * requirement is not met. + * + * That said, we could simply reuse all cap pointers + * (such as dev_cfg, common_cfg, etc.) parsed from the + * primary process, which is stored in shared memory. + */ + if (rte_pci_map_device(pci_dev)) { + PMD_INIT_LOG(DEBUG, "failed to map pci device!"); + return -1; + } + + if (!dev->modern) { if (vtpci_legacy_ioport_map(hw) < 0) return -1; } -- 2.25.1