DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] net/virtio: fix legacy device IO port map in secondary process
@ 2023-06-28  6:36 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 ` [PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process Miao Li
  0 siblings, 2 replies; 11+ messages in thread
From: Miao Li @ 2023-06-28  6:36 UTC (permalink / raw)
  To: dev; +Cc: stable, Maxime Coquelin, Chenbo Xia, David Marchand

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 <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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-07-07 17:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28  6:36 [PATCH 1/2] net/virtio: fix legacy device IO port map in secondary process 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 ` [PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process Miao Li
2023-06-29  2:26   ` [PATCH v2 2/2] bus/pci: add IO port region check before region map 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

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).