From: Stuart Summers <stuart.summers@intel.com>
Cc: igt-dev@lists.freedesktop.org, rodrigo.vivi@intel.com,
matthew.brost@intel.com, umesh.nerlige.ramappa@intel.com,
Michal.Wajdeczko@intel.com, matthew.d.roper@intel.com,
daniele.ceraolospurio@intel.com, shuicheng.lin@intel.com,
Stuart Summers <stuart.summers@intel.com>
Subject: [PATCH i-g-t 2/2] tests/intel/xe_configfs: Add coverage for GuC log configfs entries
Date: Fri, 21 Aug 2026 19:23:33 +0000 [thread overview]
Message-ID: <20260821192332.19060-6-stuart.summers@intel.com> (raw)
In-Reply-To: <20260821192332.19060-4-stuart.summers@intel.com>
Cover the new guc_log_level and guc_log_target debug configfs
attributes: default values, the full range of accepted values, values
that must be rejected, and rejection with -EBUSY while the device is
bound.
Signed-off-by: Stuart Summers <stuart.summers@intel.com>
Assisted-by: Copilot:claude-opus-5
---
tests/intel/xe_configfs.c | 181 ++++++++++++++++++++++++++++++++++++++
1 file changed, 181 insertions(+)
diff --git a/tests/intel/xe_configfs.c b/tests/intel/xe_configfs.c
index c537e5d69..c036a805e 100644
--- a/tests/intel/xe_configfs.c
+++ b/tests/intel/xe_configfs.c
@@ -365,6 +365,142 @@ static void test_ctx_restore(int configfs_debug_fd, const char *type,
}
}
+/* Values accepted by the guc_log_level attribute: -1 (unset) and 0..5 */
+#define XE_GUC_LOG_LEVEL_UNSET -1
+#define GUC_LOG_LEVEL_MAX 5
+
+/* Values accepted by the guc_log_target attribute: memory, NPK and both */
+#define GUC_LOG_TARGET_MEM 0
+#define GUC_LOG_TARGET_MAX 2
+
+static void assert_attr_eq(int configfs_debug_fd, const char *attr, int expected)
+{
+ int value;
+
+ igt_assert_f(igt_sysfs_scanf(configfs_debug_fd, attr, "%d", &value) == 1,
+ "Failed to read %s\n", attr);
+ igt_assert_f(value == expected, "Expecting %s=%d but found %d\n",
+ attr, expected, value);
+}
+
+static void set_attr_and_verify(int configfs_debug_fd, const char *attr, int value)
+{
+ char buf[16];
+
+ snprintf(buf, sizeof(buf), "%d", value);
+
+ igt_debug("Writing '%s' to %s\n", buf, attr);
+ igt_assert_f(igt_sysfs_set(configfs_debug_fd, attr, buf),
+ "Writing '%s' to %s failed\n", buf, attr);
+ assert_attr_eq(configfs_debug_fd, attr, value);
+}
+
+static void test_attr_invalid(int configfs_debug_fd, const char *attr,
+ const char * const *values, size_t nvalues,
+ int unchanged)
+{
+ for (size_t i = 0; i < nvalues; i++) {
+ const char *v = values[i];
+
+ igt_debug("Writing '%s' to %s\n", v, attr);
+ igt_assert_f(!igt_sysfs_set(configfs_debug_fd, attr, v),
+ "Writing '%s' to %s should have failed\n", v, attr);
+ assert_attr_eq(configfs_debug_fd, attr, unchanged);
+ }
+}
+
+/**
+ * SUBTEST: guc-log-level
+ * Description: Validate guc_log_level attribute
+ */
+static void test_guc_log_level(int configfs_debug_fd)
+{
+ /*
+ * The attribute can only be changed while the device is unbound, so
+ * make sure there's no device bound.
+ */
+ igt_audio_driver_unload(NULL);
+ igt_kmod_unbind("xe", bus_addr);
+
+ /* Default is 'unset': the guc_log_level modparam is used instead */
+ assert_attr_eq(configfs_debug_fd, "guc_log_level", XE_GUC_LOG_LEVEL_UNSET);
+
+ for (int level = XE_GUC_LOG_LEVEL_UNSET; level <= GUC_LOG_LEVEL_MAX; level++)
+ set_attr_and_verify(configfs_debug_fd, "guc_log_level", level);
+
+ /* Restore the default and make sure the driver still probes */
+ set_attr_and_verify(configfs_debug_fd, "guc_log_level", XE_GUC_LOG_LEVEL_UNSET);
+ igt_assert_eq(igt_kmod_bind("xe", bus_addr), 0);
+}
+
+/**
+ * SUBTEST: guc-log-level-invalid
+ * Description: Validate guc_log_level attribute for invalid values
+ */
+static void test_guc_log_level_invalid(int configfs_debug_fd)
+{
+ static const char * const values[] = {
+ "-2", "6", "100", "abc", "1a", "",
+ };
+
+ igt_audio_driver_unload(NULL);
+ igt_kmod_unbind("xe", bus_addr);
+
+ test_attr_invalid(configfs_debug_fd, "guc_log_level", values,
+ ARRAY_SIZE(values), XE_GUC_LOG_LEVEL_UNSET);
+}
+
+/**
+ * SUBTEST: guc-log-target
+ * Description: Validate guc_log_target attribute
+ */
+static void test_guc_log_target(int configfs_debug_fd)
+{
+ igt_audio_driver_unload(NULL);
+ igt_kmod_unbind("xe", bus_addr);
+
+ /* Default is to log to memory only */
+ assert_attr_eq(configfs_debug_fd, "guc_log_target", GUC_LOG_TARGET_MEM);
+
+ for (int target = GUC_LOG_TARGET_MEM; target <= GUC_LOG_TARGET_MAX; target++)
+ set_attr_and_verify(configfs_debug_fd, "guc_log_target", target);
+
+ /* Restore the default and make sure the driver still probes */
+ set_attr_and_verify(configfs_debug_fd, "guc_log_target", GUC_LOG_TARGET_MEM);
+ igt_assert_eq(igt_kmod_bind("xe", bus_addr), 0);
+}
+
+/**
+ * SUBTEST: guc-log-target-invalid
+ * Description: Validate guc_log_target attribute for invalid values
+ */
+static void test_guc_log_target_invalid(int configfs_debug_fd)
+{
+ static const char * const values[] = {
+ "-1", "3", "256", "abc", "1a", "",
+ };
+
+ igt_audio_driver_unload(NULL);
+ igt_kmod_unbind("xe", bus_addr);
+
+ test_attr_invalid(configfs_debug_fd, "guc_log_target", values,
+ ARRAY_SIZE(values), GUC_LOG_TARGET_MEM);
+}
+
+/**
+ * SUBTEST: guc-log-bound
+ * Description: Validate GuC log attributes are rejected while bound
+ */
+static void test_guc_log_bound(int configfs_debug_fd)
+{
+ igt_kmod_bind("xe", bus_addr);
+
+ igt_assert_f(!igt_sysfs_set(configfs_debug_fd, "guc_log_level", "1"),
+ "Writing guc_log_level while bound should have failed\n");
+ igt_assert_f(!igt_sysfs_set(configfs_debug_fd, "guc_log_target", "1"),
+ "Writing guc_log_target while bound should have failed\n");
+}
+
static void set_bus_addr(int fd)
{
pci_dev = igt_device_get_pci_device(fd);
@@ -475,6 +611,51 @@ int igt_main()
configfs_debug_fd);
}
+ igt_describe("Validate guc_log_level");
+ igt_subtest("guc-log-level") {
+ create_debug_configfs_group(configfs_fd, &configfs_device_fd,
+ &configfs_debug_fd);
+ test_guc_log_level(configfs_debug_fd);
+ close_debug_configfs_group(configfs_fd, configfs_device_fd,
+ configfs_debug_fd);
+ }
+
+ igt_describe("Validate guc_log_level with invalid options");
+ igt_subtest("guc-log-level-invalid") {
+ create_debug_configfs_group(configfs_fd, &configfs_device_fd,
+ &configfs_debug_fd);
+ test_guc_log_level_invalid(configfs_debug_fd);
+ close_debug_configfs_group(configfs_fd, configfs_device_fd,
+ configfs_debug_fd);
+ }
+
+ igt_describe("Validate guc_log_target");
+ igt_subtest("guc-log-target") {
+ create_debug_configfs_group(configfs_fd, &configfs_device_fd,
+ &configfs_debug_fd);
+ test_guc_log_target(configfs_debug_fd);
+ close_debug_configfs_group(configfs_fd, configfs_device_fd,
+ configfs_debug_fd);
+ }
+
+ igt_describe("Validate guc_log_target with invalid options");
+ igt_subtest("guc-log-target-invalid") {
+ create_debug_configfs_group(configfs_fd, &configfs_device_fd,
+ &configfs_debug_fd);
+ test_guc_log_target_invalid(configfs_debug_fd);
+ close_debug_configfs_group(configfs_fd, configfs_device_fd,
+ configfs_debug_fd);
+ }
+
+ igt_describe("Validate GuC log attributes are rejected while bound");
+ igt_subtest("guc-log-bound") {
+ create_debug_configfs_group(configfs_fd, &configfs_device_fd,
+ &configfs_debug_fd);
+ test_guc_log_bound(configfs_debug_fd);
+ close_debug_configfs_group(configfs_fd, configfs_device_fd,
+ configfs_debug_fd);
+ }
+
igt_describe("Validate ctx_restore_post_bb with invalid options");
igt_subtest("ctx-restore-post-bb-invalid") {
igt_skip_on_f(is_vf_device, "MMIO register readback not possible on VF\n");
--
2.43.0
next prev parent reply other threads:[~2026-08-21 20:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 19:23 [PATCH i-g-t 0/2] Test new debug based configfs changes Stuart Summers
2026-08-21 19:23 ` [PATCH i-g-t 1/2] tests/intel/xe_configfs: Use the new debug configfs group Stuart Summers
2026-08-21 19:23 ` Stuart Summers [this message]
2026-08-21 21:11 ` ✓ Xe.CI.BAT: success for Test new debug based configfs changes Patchwork
2026-08-21 21:26 ` ✓ i915.CI.BAT: " Patchwork
2026-08-21 23:19 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-08-22 0:16 ` ✗ i915.CI.Full: " Patchwork
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=20260821192332.19060-6-stuart.summers@intel.com \
--to=stuart.summers@intel.com \
--cc=Michal.Wajdeczko@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=shuicheng.lin@intel.com \
--cc=umesh.nerlige.ramappa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.