[PATCH i-g-t] tests/device_reset: Give PCI transactions more time to complete

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Wed Jan 11 09:01:03 UTC 2023


On DG1 platforms, after unbinding the i915 driver, we observed timeouts
reported by PCI subsystem while it was waiting for pending PCI
transactions to complete before it proceded with FLR.  When that
happened, subsequent driver rebind operation never succeeded.  That
may indicate FLR being affected at hardware / firmware level by those
PCI transactions still pending.

Wait a few seconds after driver unbind before proceding with device
reset on those platforms.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
 tests/device_reset.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/device_reset.c b/tests/device_reset.c
index 39ee8dca9f..9bc6c34578 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -39,6 +39,7 @@ struct device_fds {
 	} fds;
 	char dev_bus_addr[DEV_BUS_ADDR_LEN];
 	bool snd_unload;
+	uint32_t devid;
 };
 
 static int __open_sysfs_dir(int fd, const char* path)
@@ -161,7 +162,6 @@ static void init_device_fds(struct device_fds *dev)
 {
 	char dev_path[PATH_MAX];
 	char *addr_pos;
-	uint32_t devid;
 
 	igt_debug("open device\n");
 	/**
@@ -174,9 +174,9 @@ static void init_device_fds(struct device_fds *dev)
 	if (is_i915_device(dev->fds.dev)) {
 		igt_require_gem(dev->fds.dev);
 
-		devid = intel_get_drm_devid(dev->fds.dev);
-		if ((IS_HASWELL(devid) || IS_BROADWELL(devid) ||
-		     IS_DG1(devid)) &&
+		dev->devid = intel_get_drm_devid(dev->fds.dev);
+		if ((IS_HASWELL(dev->devid) || IS_BROADWELL(dev->devid) ||
+		     IS_DG1(dev->devid)) &&
 		     (igt_kmod_is_loaded("snd_hda_intel"))) {
 			igt_debug("Enable WA to unload snd driver\n");
 			dev->snd_unload = true;
@@ -397,6 +397,10 @@ static void unbind_reset_rebind(struct device_fds *dev, enum reset type)
 
 	driver_unbind(dev);
 
+	/* On DG1 PCI transactions take time, give them a chance to complete */
+	if (type == FLR_RESET && dev->devid && IS_DG1(dev->devid))
+		sleep(10);
+
 	initiate_device_reset(dev, type);
 
 	driver_bind(dev);
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list