From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [igt-dev] [PATCH i-g-t 3/3] tests/intel/freq: Test throttle basic API infra
Date: Tue, 5 Dec 2023 16:38:13 -0500 [thread overview]
Message-ID: <20231205213814.179963-3-rodrigo.vivi@intel.com> (raw)
In-Reply-To: <20231205213814.179963-1-rodrigo.vivi@intel.com>
For now we don't have a reliable way to force PCODE throttling,
but let's at least check for some sanity on our exposed API.
Cc: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
tests/intel/xe_gt_freq.c | 48 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/tests/intel/xe_gt_freq.c b/tests/intel/xe_gt_freq.c
index 719852530..650c54005 100644
--- a/tests/intel/xe_gt_freq.c
+++ b/tests/intel/xe_gt_freq.c
@@ -68,6 +68,49 @@ static uint32_t get_freq(int fd, int gt_id, const char *freq_name)
return freq;
}
+static uint32_t get_throttle(int fd, int gt_id, const char *throttle_file)
+{
+ uint32_t val;
+ char throttle_attr[40];
+ int gt_fd;
+
+ snprintf(throttle_attr, sizeof(throttle_attr),
+ "freq0/throttle/%s", throttle_file);
+ gt_fd = xe_sysfs_gt_open(fd, gt_id);
+ igt_assert(gt_fd >= 0);
+
+ igt_sysfs_scanf(gt_fd, throttle_attr, "%u", &val);
+
+ igt_debug("gt%d/freq0/throttle/%s: %u\n", gt_id, throttle_file, val);
+
+ close(gt_fd);
+ return val;
+}
+
+/**
+ * SUBTEST: throttle_basic_api
+ * Description: Test basic throttle API
+ */
+
+static void test_throttle_basic_api(int fd, int gt_id)
+{
+ uint32_t status, reasons;
+
+ status = get_throttle(fd, gt_id, "status");
+ reasons = get_throttle(fd, gt_id, "reason_pl1");
+ reasons |= get_throttle(fd, gt_id, "reason_pl2");
+ reasons |= get_throttle(fd, gt_id, "reason_pl4");
+ reasons |= get_throttle(fd, gt_id, "reason_prochot");
+ reasons |= get_throttle(fd, gt_id, "reason_ratl");
+ reasons |= get_throttle(fd, gt_id, "reason_thermal");
+ reasons |= get_throttle(fd, gt_id, "reason_vr_tdc");
+ reasons |= get_throttle(fd, gt_id, "reason_vr_thermalert");
+
+ if (status)
+ igt_assert(reasons);
+ else
+ igt_assert(!reasons);
+}
/**
* SUBTEST: freq_basic_api
@@ -289,6 +332,11 @@ igt_main
stash_max = get_freq(fd, 0, "max");
}
+ igt_subtest("throttle_basic_api") {
+ xe_for_each_gt(fd, gt)
+ test_throttle_basic_api(fd, gt);
+ }
+
igt_subtest("freq_basic_api") {
xe_for_each_gt(fd, gt)
test_freq_basic_api(fd, gt);
--
2.43.0
next prev parent reply other threads:[~2023-12-05 21:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 21:38 [igt-dev] [PATCH i-g-t 1/3] tests/intel/xe: Align change in the name of frequency sysfs attributes Rodrigo Vivi
2023-12-05 21:38 ` [igt-dev] [PATCH i-g-t 2/3] tests/intel/xe: Align with new xe_gt_freq component Rodrigo Vivi
2023-12-06 12:45 ` Kamil Konieczny
2023-12-06 23:02 ` Rodrigo Vivi
2023-12-05 21:38 ` Rodrigo Vivi [this message]
2023-12-06 4:44 ` [igt-dev] [PATCH i-g-t 3/3] tests/intel/freq: Test throttle basic API infra Sundaresan, Sujaritha
2023-12-05 22:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/3] tests/intel/xe: Align change in the name of frequency sysfs attributes Patchwork
2023-12-06 0:13 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
2023-12-06 4:38 ` [igt-dev] [PATCH i-g-t 1/3] " Sundaresan, Sujaritha
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=20231205213814.179963-3-rodrigo.vivi@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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