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 ACFD042D60; Thu, 29 Jun 2023 04:27:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A36541611; Thu, 29 Jun 2023 04:27:03 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 6A6AF406B7; Thu, 29 Jun 2023 04:27:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688005621; x=1719541621; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZZ9pl07QvbPSByhxSeadRyErsYoXeb4vVdggm1LZP8Q=; b=fhQcqPGl5yhe2csMFFb9yGjIlEygkzFr/ikOMosZQIoU7Yji+laOrYHb CQk3L3++BbItkd1fTd41+1FtQJwj7NV06XW7jOM3KjQ4jSSVNHSNrwVBA n7bD1NUt00o3QMJiaxdUAl5MOAoxK7KJHHYNOyrOG/mX2a+ApXX9y93Xb blcHbiZBNRhlTb+Q/1sWXo7+RMNtZlSQNFc5+tyjDzSc7rdycvJE7MPRN 4u13i42I+7L92g6dVki4wXe+YSD6fnRNONHvjOEwDy9boQ/PUV6wcfNw1 fcBFVEOkRztCHbWlU2AVi4JMocoevWzrXsjfum/M6SZq+gsVmi1I+2aVY g==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="362047098" X-IronPort-AV: E=Sophos;i="6.01,167,1684825200"; d="scan'208";a="362047098" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 19:27:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="861747237" X-IronPort-AV: E=Sophos;i="6.01,167,1684825200"; d="scan'208";a="861747237" Received: from dpdk-limiao-icelake.sh.intel.com ([10.67.111.26]) by fmsmga001.fm.intel.com with ESMTP; 28 Jun 2023 19:26:58 -0700 From: Miao Li To: dev@dpdk.org Cc: stable@dpdk.org, Maxime Coquelin , Chenbo Xia , David Marchand Subject: [PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process Date: Thu, 29 Jun 2023 02:26:52 +0000 Message-Id: <20230629022653.263046-1-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230628063651.178604-1-miao.li@intel.com> References: <20230628063651.178604-1-miao.li@intel.com> 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 secondary process, vfio_cfg setup for legacy device like vfio_group_fd and vfio_dev_fd is missing. So, in secondary process, rte_pci_map_device is added for legacy device to setup vfio_cfg and fill in 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