Skip to contentSkip to conversation

vfio: platform: ignore missing reset if disabled at module init

PATCH Superseded Tomasz Duszynski 3 participants 4 messages Jan 25, 2023 – Jan 30, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: platform: ignore missing reset if disabled at module init

If reset requirement was relaxed via module parameter errors caused by missing reset should not be propagated down to the vfio core. Otherwise initialization will fail.

Fixes 5f6c7e0831a1 ("vfio/platform: Use the new device life cycle helpers")
---
 drivers/vfio/platform/vfio_platform_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vfio/platform/vfio_platform_common.c +2 -1
index 1a0a238ffa35..c09ffab6fbe6 100644
@@ -653,7 +653,8 @@ int vfio_platform_init_common(struct vfio_platform_device *vdev)
 	if (ret && vdev->reset_required)
 		dev_err(dev, "No reset function found for device %s\n",
 			vdev->name);
-	return ret;
+
+	return vdev->reset_required ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(vfio_platform_init_common);
 
Signature · 1 line
2.34.1
#1 lore raw

drivers/vfio/platform/vfio_platform_common.c int vfio_platform_init_common(struct · line 660

Quoted 12 lines

From: Tomasz Duszynski <[email protected]>
Sent: Thursday, January 26, 2023 12:11 AM

drivers/vfio/platform/vfio_platform_common.c +2 -1
@@ -653,7 +653,8 @@ int vfio_platform_init_common(struct
 vfio_platform_device *vdev)
 	if (ret && vdev->reset_required)
 		dev_err(dev, "No reset function found for device %s\n",
 			vdev->name);
-	return ret;
+
+	return vdev->reset_required ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(vfio_platform_init_common);

It reads slightly better to me as below:

	if (ret & vdev->reset_required) {
		dev_err(...);
		return ret;
	}

	return 0;
maintainer
#2 lore raw

Hi,

Quoted 14 lines · Kevin

drivers/vfio/platform/vfio_platform_common.c int vfio_platform_init_common(struct · line 660

Quoted 12 lines

From: Tomasz Duszynski <[email protected]>
Sent: Thursday, January 26, 2023 12:11 AM

drivers/vfio/platform/vfio_platform_common.c +2 -1
@@ -653,7 +653,8 @@ int vfio_platform_init_common(struct
 vfio_platform_device *vdev)
 	if (ret && vdev->reset_required)
 		dev_err(dev, "No reset function found for device %s\n",
 			vdev->name);
-	return ret;
+
+	return vdev->reset_required ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(vfio_platform_init_common);

It reads slightly better to me as below:

Quoted 7 lines
	if (ret & vdev->reset_required) {
		dev_err(...);
		return ret;
	}

	return 0;

agreed.

Thanks

Eric

#3 lore raw
In reply to Tian, Kevin
Quoted 26 lines

-----Original Message-----
From: Tian, Kevin <[email protected]>
Sent: Monday, January 30, 2023 10:06 AM
To: Tomasz Duszynski <[email protected]>; Eric Auger <[email protected]>; Alex Williamson <[email protected]>; Cornelia Huck <[email protected]>; Jason Gunthorpe <[email protected]>; open list:VFIO PLATFORM DRIVER <[email protected]>; open list <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>
Subject: [EXT] RE: [PATCH] vfio: platform: ignore missing reset if disabled at module init

External Email

----------------------------------------------------------------------

drivers/vfio/platform/vfio_platform_common.c int vfio_platform_init_common(struct vfio_platform_device *vdev) · line 659

Quoted 11 lines

From: Tomasz Duszynski <[email protected]>
Sent: Thursday, January 26, 2023 12:11 AM @@ -653,7 +653,8 @@ int vfio_platform_init_common(struct vfio_platform_device *vdev)

drivers/vfio/platform/vfio_platform_common.c +2 -1
 	if (ret && vdev->reset_required)
 		dev_err(dev, "No reset function found for device %s\n",
 			vdev->name);
-	return ret;
+
+	return vdev->reset_required ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(vfio_platform_init_common);

It reads slightly better to me as below:

Quoted 6 lines
	if (ret & vdev->reset_required) {
		dev_err(...);
		return ret;
	}

	return 0;

Sure no problem.