[Intel-gfx] [PATCH v10 16/22] vfio: Name noiommu vfio_device with "noiommu-" prefix

Yi Liu yi.l.liu at intel.com
Wed Apr 26 15:03:15 UTC 2023


For noiommu device, vfio core names the cdev node with prefix "noiommu-".

Reviewed-by: Kevin Tian <kevin.tian at intel.com>
Tested-by: Nicolin Chen <nicolinc at nvidia.com>
Tested-by: Yanting Jiang <yanting.jiang at intel.com>
Signed-off-by: Yi Liu <yi.l.liu at intel.com>
---
 drivers/vfio/vfio_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 0f1139126622..c0459872d79a 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -269,10 +269,6 @@ static int __vfio_register_dev(struct vfio_device *device,
 	if (!device->dev_set)
 		vfio_assign_device_set(device, device);
 
-	ret = dev_set_name(&device->device, "vfio%d", device->index);
-	if (ret)
-		return ret;
-
 	ret = vfio_device_set_group(device, type);
 	if (ret)
 		return ret;
@@ -281,6 +277,11 @@ static int __vfio_register_dev(struct vfio_device *device,
 	if (ret)
 		goto err_out;
 
+	ret = dev_set_name(&device->device, "%svfio%d",
+			   device->noiommu ? "noiommu-" : "", device->index);
+	if (ret)
+		goto err_out;
+
 	ret = device_add(&device->device);
 	if (ret)
 		goto err_out;
-- 
2.34.1



More information about the Intel-gfx mailing list