Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Upadhyay <tejas.upadhyay@intel.com>,
	Badal Nilawar <badal.nilawar@intel.com>
Subject: [igt-dev] [PATCH i-g-t v6 3/4] tests/xe/xe_guc_pc: Change the sysfs paths
Date: Wed,  5 Jul 2023 18:48:52 +0530	[thread overview]
Message-ID: <20230705131853.545449-4-himal.prasad.ghimiray@intel.com> (raw)
In-Reply-To: <20230705131853.545449-1-himal.prasad.ghimiray@intel.com>

Changes to access sysfs entries under tile directory.
Access freq sysfs from /sys/class/drm/cardX/device/tileN/gtN
path.

v2:
- Use snprintf instead of sprintf and check error.
- Describe what changes are done. (Kamil)

v3:
- change order of gt and tile and drop passing tilecount.(Ashutosh)

v4:
- Rebase

v5:
- Drop usage of xe_for_each_gt_under_each_tile and use
  a function to return gt path. (Ashutosh)

Reviewed-by: Upadhyay <tejas.upadhyay@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
Cc: Upadhyay <tejas.upadhyay@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: Riana Tauro <riana.tauro@intel.com>
Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 tests/xe/xe_guc_pc.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c
index 827693eb4..046791d51 100644
--- a/tests/xe/xe_guc_pc.c
+++ b/tests/xe/xe_guc_pc.c
@@ -137,8 +137,13 @@ static int set_freq(int sysfs, int gt_id, const char *freq_name, uint32_t freq)
 {
 	int ret = -EAGAIN;
 	char path[32];
+	char *gt_path;
+
+	gt_path = xe_gt_sysfs_path(sysfs, gt_id);
+	igt_assert(snprintf(path, sizeof(path), "%s/freq_%s",
+			    xe_gt_sysfs_path(sysfs, gt_id), freq_name) < sizeof(path));
+	free(gt_path);
 
-	sprintf(path, "device/gt%d/freq_%s", gt_id, freq_name);
 	while (ret == -EAGAIN)
 		ret = igt_sysfs_printf(sysfs, path, "%u", freq);
 	return ret;
@@ -149,7 +154,12 @@ static uint32_t get_freq(int sysfs, int gt_id, const char *freq_name)
 	uint32_t freq;
 	int err = -EAGAIN;
 	char path[32];
-	sprintf(path, "device/gt%d/freq_%s", gt_id, freq_name);
+	char *gt_path;
+
+	gt_path = xe_gt_sysfs_path(sysfs, gt_id);
+	igt_assert(snprintf(path, sizeof(path), "%s/freq_%s",
+			    gt_path, freq_name) < sizeof(path));
+	free(gt_path);
 	while (err == -EAGAIN)
 		err = igt_sysfs_scanf(sysfs, path, "%u", &freq);
 	return freq;
-- 
2.25.1

  parent reply	other threads:[~2023-07-05 13:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 13:18 [igt-dev] [PATCH i-g-t v6 0/4] Handle GT and tile seperation in IGT Himal Prasad Ghimiray
2023-07-05 13:18 ` [igt-dev] [PATCH i-g-t v6 1/4] lib/igt_sysfs: Add support to query number of tiles Himal Prasad Ghimiray
2023-07-06  2:03   ` Dixit, Ashutosh
2023-07-06  3:17     ` Ghimiray, Himal Prasad
2023-07-05 13:18 ` [igt-dev] [PATCH i-g-t v6 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes Himal Prasad Ghimiray
2023-07-06  0:16   ` Dixit, Ashutosh
2023-07-06  3:18     ` Ghimiray, Himal Prasad
2023-07-05 13:18 ` Himal Prasad Ghimiray [this message]
2023-07-05 13:18 ` [igt-dev] [PATCH i-g-t v6 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range Himal Prasad Ghimiray
2023-07-05 13:41 ` [igt-dev] ✗ GitLab.Pipeline: warning for Handle GT and tile seperation in IGT (rev5) Patchwork
2023-07-05 14:21 ` [igt-dev] ✗ Fi.CI.BAT: failure " 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=20230705131853.545449-4-himal.prasad.ghimiray@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tejas.upadhyay@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