DPDK patches and discussions
 help / color / mirror / Atom feed
From: Miao Li <miao.li@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>,
	David Marchand <david.marchand@redhat.com>
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	[thread overview]
Message-ID: <20230629022653.263046-1-miao.li@intel.com> (raw)
In-Reply-To: <20230628063651.178604-1-miao.li@intel.com>

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 <miao.li@intel.com>
---
 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


  parent reply	other threads:[~2023-06-29  2:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28  6:36 [PATCH " Miao Li
2023-06-28  6:36 ` [PATCH 2/2] bus/pci: add IO port region check before region map Miao Li
2023-06-29  2:26 ` Miao Li [this message]
2023-06-29  2:26   ` [PATCH v2 " Miao Li
2023-07-03  1:19   ` [PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process Ling, WeiX
2023-07-03  7:47   ` David Marchand
2023-07-03  8:54     ` Li, Miao
2023-07-03  8:57       ` David Marchand
2023-07-03  9:31         ` Xia, Chenbo
2023-07-07 17:03           ` Gupta, Nipun
2023-07-06  8:58     ` Xia, Chenbo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230629022653.263046-1-miao.li@intel.com \
    --to=miao.li@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).