From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Upadhyay <tejas.upadhyay@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v7 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes
Date: Thu, 06 Jul 2023 17:56:27 -0700 [thread overview]
Message-ID: <87edlkczes.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20230706104500.595707-3-himal.prasad.ghimiray@intel.com>
On Thu, 06 Jul 2023 03:44:58 -0700, Himal Prasad Ghimiray wrote:
>
> +/*
> + * xe_gt_sysfs_path::
> + * @sysfs: fd of sysfs
> + * @gt_id: gt id
> + *
> + * This function returns the path for gtX directory
> + */
> +char *xe_gt_sysfs_path(int sysfs, int gt_id)
> +{
> + char tiledir[24];
> + char gtdir[32];
> + char *gt_path;
> + int i = 0;
> +
> + snprintf(tiledir, sizeof(tiledir), "device/tile0/");
> + snprintf(gtdir, sizeof(gtdir), "%s/gt%d", tiledir, gt_id);
> +
> + while (dir_exists_in_sysfd(sysfs, tiledir)) {
> + if (dir_exists_in_sysfd(sysfs, gtdir)) {
> + gt_path = malloc(sizeof(gtdir));
> + strcpy(gt_path, gtdir);
> + return gt_path;
> + } else {
> + snprintf(tiledir, sizeof(tiledir), "device/tile%d/", i++);
> + snprintf(gtdir, sizeof(gtdir), "%s/gt%d", tiledir, gt_id);
> + }
> + }
> + igt_assert_f(false, "No gt%d dir found in sysfs\n", gt_id);
> +}
Now that you I see the code (sorry for changing again but we are adding
this to the igt lib so functions should have some uniformity), this
function should have the same prototype and arguments as
igt_sysfs_gt_path(). Also call it xe_sysfs_gt_path.
Also because now we have drm_fd available we can find the device (PVC/MTL)
so we can use the simpler implementation I mentioned before:
switch (devid) {
case PVC:
return tile0/gt0 or tile1/gt1
default:
return tile0/gtN
}
This function can be extended for future platforms as they arise. Or
someone can write a better function to go over the dir tree. I think it
should be done similar to going over the directory as is done in
hwmon_read/hwmon_write. I don't like the implementation above but for now
the approach mentioned above is fine.
The above means we will change set_freq()/get_freq() in xe_guc_pc.c to take
the drm_fd as the first argument rather than the sysfs fd. So there will be
changes throught the file but better do that once so that all future IGT's
can follow the same pattern.
Also write another function xe_sysfs_gt_open() similar to
igt_sysfs_gt_open() or xe_sysfs_tile_open().
I want Kamil to take a look at this series too after he is back.
> diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
> index 5d584b1c7..0792c644e 100644
> --- a/lib/igt_sysfs.h
> +++ b/lib/igt_sysfs.h
> @@ -153,6 +153,7 @@ typedef struct igt_sysfs_rw_attr {
> } igt_sysfs_rw_attr_t;
>
> void igt_sysfs_rw_attr_verify(igt_sysfs_rw_attr_t *rw);
> +char *xe_gt_sysfs_path(int sysfs, int gt_id);
>
> void igt_sysfs_engines(int xe, int engines, const char **property,
> void (*test)(int, int, const char **));
> --
> 2.25.1
>
next prev parent reply other threads:[~2023-07-07 0:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 10:44 [igt-dev] [PATCH i-g-t v7 0/4] Handle GT and tile seperation in IGT Himal Prasad Ghimiray
2023-07-06 10:44 ` [igt-dev] [PATCH i-g-t v7 1/4] lib/igt_sysfs: Add support to query number of tiles Himal Prasad Ghimiray
2023-07-06 23:46 ` Dixit, Ashutosh
2023-07-07 3:57 ` Ghimiray, Himal Prasad
2023-07-06 10:44 ` [igt-dev] [PATCH i-g-t v7 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes Himal Prasad Ghimiray
2023-07-07 0:56 ` Dixit, Ashutosh [this message]
2023-07-07 4:29 ` Ghimiray, Himal Prasad
2023-07-07 5:02 ` Ghimiray, Himal Prasad
2023-07-06 10:44 ` [igt-dev] [PATCH i-g-t v7 3/4] tests/xe/xe_guc_pc: Change the sysfs paths Himal Prasad Ghimiray
2023-07-07 1:01 ` Dixit, Ashutosh
2023-07-07 5:03 ` Ghimiray, Himal Prasad
2023-07-06 10:45 ` [igt-dev] [PATCH i-g-t v7 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range Himal Prasad Ghimiray
2023-07-07 1:10 ` Dixit, Ashutosh
2023-07-07 5:04 ` Ghimiray, Himal Prasad
2023-07-06 13:03 ` [igt-dev] ✓ Fi.CI.BAT: success for Handle GT and tile seperation in IGT (rev6) Patchwork
2023-07-06 13:12 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2023-07-06 17:12 ` [igt-dev] ✗ Fi.CI.IGT: 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=87edlkczes.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=himal.prasad.ghimiray@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