patch 'bus/fslmc: fix VFIO setup' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Tue Jun 21 10:02:52 CEST 2022


Hi,

FYI, your patch has been queued to stable release 20.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/23/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/8f68d6fdc6262db2fcf83030e248b83ebba4c991

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 8f68d6fdc6262db2fcf83030e248b83ebba4c991 Mon Sep 17 00:00:00 2001
From: Romain Delhomel <romain.delhomel at 6wind.com>
Date: Fri, 3 Jun 2022 17:18:30 +0200
Subject: [PATCH] bus/fslmc: fix VFIO setup
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 36c3c4df136f6d79c0ffaddec00696f5eddaef16 ]

At device probe, the fslmc bus driver calls rte_vfio_get_group_fd() to
get a fd associated to a vfio group. This function first checks if the
group is already opened, else it opens /dev/vfio/%u, and increases the
number of active groups in default_vfio_cfg (which references the
default vfio container).

When adding the first group to a vfio_cfg, the caller is supposed to
pick an IOMMU type and set up DMA mappings for container, as it's done
by pci bus, but it is not done here. Instead, a new container is created
and used.

This prevents the pci bus driver, which uses the default_vfio_cfg
container, to configure the container because
default_vfio_cfg->active_group > 1.

This patch fixes the issue by always creating a new container (and its
associated vfio_cfg) and binding the group to it.

Fixes: a69f79300262 ("bus/fslmc: support multi VFIO group")

Signed-off-by: Romain Delhomel <romain.delhomel at 6wind.com>
Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index b52f36c33e..2ab1368202 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -968,6 +968,7 @@ fslmc_vfio_setup_group(void)
 {
 	int groupid;
 	int ret;
+	int vfio_container_fd;
 	struct vfio_group_status status = { .argsz = sizeof(status) };
 
 	/* if already done once */
@@ -986,8 +987,15 @@ fslmc_vfio_setup_group(void)
 		return 0;
 	}
 
+	ret = rte_vfio_container_create();
+	if (ret < 0) {
+		DPAA2_BUS_ERR("Failed to open VFIO container");
+		return ret;
+	}
+	vfio_container_fd = ret;
+
 	/* Get the actual group fd */
-	ret = rte_vfio_get_group_fd(groupid);
+	ret = rte_vfio_container_group_bind(vfio_container_fd, groupid);
 	if (ret < 0)
 		return ret;
 	vfio_group.fd = ret;
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-21 15:37:53.946601540 +0800
+++ 0106-bus-fslmc-fix-VFIO-setup.patch	2022-06-21 15:37:49.221118569 +0800
@@ -1 +1 @@
-From 36c3c4df136f6d79c0ffaddec00696f5eddaef16 Mon Sep 17 00:00:00 2001
+From 8f68d6fdc6262db2fcf83030e248b83ebba4c991 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 36c3c4df136f6d79c0ffaddec00696f5eddaef16 ]
@@ -25 +27,0 @@
-Cc: stable at dpdk.org
@@ -34 +36 @@
-index 1b89a56bbc..3d4e71a80a 100644
+index b52f36c33e..2ab1368202 100644
@@ -37 +39 @@
-@@ -995,6 +995,7 @@ fslmc_vfio_setup_group(void)
+@@ -968,6 +968,7 @@ fslmc_vfio_setup_group(void)
@@ -45 +47 @@
-@@ -1013,8 +1014,15 @@ fslmc_vfio_setup_group(void)
+@@ -986,8 +987,15 @@ fslmc_vfio_setup_group(void)


More information about the stable mailing list