From: Anshuman Gupta <anshuman.gupta@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: badal.nilawar@intel.com, rodrigo.vivi@intel.com
Subject: [igt-dev] [PATCH i-g-t v4 4/5] test/device_reset: Refactor initiate_device_reset
Date: Fri, 25 Nov 2022 13:13:39 +0530 [thread overview]
Message-ID: <20221125074339.3483859-1-anshuman.gupta@intel.com> (raw)
In-Reply-To: <20221123085441.2821638-6-anshuman.gupta@intel.com>
Added a reset type enum to support multiple types
of reset like WARM, COLD and FLR reset.
No functional change.
v2:
- Removed WARM_RESET enum as not used yet. [Badal]
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
tests/device_reset.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/tests/device_reset.c b/tests/device_reset.c
index e60d4c7fde..0c477a02c0 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -19,6 +19,11 @@ IGT_TEST_DESCRIPTION("Examine behavior of a driver on device sysfs reset");
#define DEV_PATH_LEN 80
#define DEV_BUS_ADDR_LEN 13 /* addr has form 0000:00:00.0 */
+enum reset {
+ COLD_RESET,
+ FLR_RESET
+};
+
/**
* Helper structure containing file descriptors
* and bus address related to tested device
@@ -222,10 +227,13 @@ static void driver_bind(struct device_fds *dev)
}
/* Initiate device reset */
-static void initiate_device_reset(struct device_fds *dev)
+static void initiate_device_reset(struct device_fds *dev, enum reset type)
{
igt_debug("reset device\n");
- igt_assert(igt_sysfs_set(dev->fds.dev_dir, "reset", "1"));
+
+ if (type == FLR_RESET)
+ igt_assert(igt_sysfs_set(dev->fds.dev_dir, "reset", "1"));
+
}
static bool is_i915_wedged(int i915)
@@ -274,14 +282,14 @@ static void set_device_filter(const char* dev_path)
igt_assert_eq(igt_device_filter_add(filter), 1);
}
-static void unbind_reset_rebind(struct device_fds *dev)
+static void unbind_reset_rebind(struct device_fds *dev, enum reset type)
{
igt_debug("close the device\n");
close_if_opened(&dev->fds.dev);
driver_unbind(dev);
- initiate_device_reset(dev);
+ initiate_device_reset(dev, type);
driver_bind(dev);
}
@@ -306,13 +314,13 @@ igt_main
igt_describe("Unbinds driver from device, initiates reset"
" then rebinds driver to device");
igt_subtest("unbind-reset-rebind") {
- unbind_reset_rebind(&dev);
+ unbind_reset_rebind(&dev, FLR_RESET);
healthcheck(&dev);
}
igt_describe("Resets device with bound driver");
igt_subtest("reset-bound") {
- initiate_device_reset(&dev);
+ initiate_device_reset(&dev, FLR_RESET);
healthcheck(&dev);
}
--
2.25.1
next prev parent reply other threads:[~2022-11-25 7:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 8:54 [igt-dev] [PATCH i-g-t v3 0/5] Cold Reset IGT Test Anshuman Gupta
2022-11-23 8:54 ` [igt-dev] [PATCH i-g-t v3 1/5] lib/igt_pci: helpers to get PCI capabilities offset Anshuman Gupta
2022-11-29 12:00 ` Nilawar, Badal
2022-11-30 12:43 ` Kamil Konieczny
2022-11-30 12:56 ` Nilawar, Badal
2022-12-07 17:27 ` Bernatowicz, Marcin
2022-12-07 16:58 ` Bernatowicz, Marcin
2022-11-23 8:54 ` [igt-dev] [PATCH i-g-t v3 2/5] lib/igt_pci: Add PCIe slot cap Anshuman Gupta
2022-11-29 14:43 ` Nilawar, Badal
2022-11-23 8:54 ` [igt-dev] [PATCH i-g-t v3 3/5] lib/igt_pm: Refactor get firmware_node fd Anshuman Gupta
2022-11-30 8:43 ` Kamil Konieczny
2022-11-30 8:46 ` Gupta, Anshuman
2022-11-23 8:54 ` [igt-dev] [PATCH i-g-t v3 4/5] test/device_reset: Refactor initiate_device_reset Anshuman Gupta
2022-11-23 8:54 ` [igt-dev] [PATCH i-g-t v3 5/5] tests/device_reset: Add cold reset IGT test Anshuman Gupta
2022-11-25 4:27 ` Iddamsetty, Aravind
2022-11-25 4:53 ` Gupta, Anshuman
2022-11-25 5:13 ` Iddamsetty, Aravind
2022-11-25 7:43 ` Anshuman Gupta [this message]
2022-11-29 16:50 ` [igt-dev] [PATCH i-g-t v4 4/5] test/device_reset: Refactor initiate_device_reset Nilawar, Badal
2022-11-30 13:29 ` Kamil Konieczny
2022-11-28 10:20 ` [igt-dev] [PATCH i-g-t v4 5/5] tests/device_reset: Add cold reset IGT test Anshuman Gupta
2022-11-30 13:09 ` Kamil Konieczny
2022-11-30 13:25 ` Nilawar, Badal
2022-12-07 8:38 ` Gupta, Anshuman
2022-11-23 9:45 ` [igt-dev] ✓ Fi.CI.BAT: success for Cold Reset IGT Test Patchwork
2022-11-25 8:25 ` [igt-dev] ✓ Fi.CI.BAT: success for Cold Reset IGT Test (rev2) Patchwork
2022-11-28 10:57 ` [igt-dev] ✓ Fi.CI.BAT: success for Cold Reset IGT Test (rev3) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2022-12-07 10:25 [igt-dev] [PATCH i-g-t v4 0/5] Cold Reset IGT Test Anshuman Gupta
2022-12-07 10:25 ` [igt-dev] [PATCH i-g-t v4 4/5] test/device_reset: Refactor initiate_device_reset Anshuman Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221125074339.3483859-1-anshuman.gupta@intel.com \
--to=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox