Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: "Upadhyay, Tejas" <tejas.upadhyay@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH v2 1/4] lib/igt_sysfs: Add support to query number of tiles
Date: Mon, 26 Jun 2023 13:24:15 -0700	[thread overview]
Message-ID: <87jzvq6kgg.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <SJ1PR11MB62044D5FD86A614257B19D8F8126A@SJ1PR11MB6204.namprd11.prod.outlook.com>

On Mon, 26 Jun 2023 03:24:05 -0700, Upadhyay, Tejas wrote:
>
> > -----Original Message-----
> > From: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>
> > Sent: Friday, June 23, 2023 5:20 PM
> > To: igt-dev@lists.freedesktop.org
> > Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray@intel.com>; Iddamsetty,
> > Aravind <aravind.iddamsetty@intel.com>; Upadhyay, Tejas
> > <tejas.upadhyay@intel.com>; Kumar, Janga Rahul
> > <janga.rahul.kumar@intel.com>
> > Subject: [PATCH v2 1/4] lib/igt_sysfs: Add support to query number of tiles
> >
> > With tile and GT seperation in KMD, we need to know number of tiles
> > supported by platform.
> > We will need to access tile associated properties from IGT.
> > Hence adding iterator for all supported tiles.
> >
> > v2:
> > - Calculate number of tiles once within iterator. (Rahul)
> > - Use snprintf instead of sprintf.
> >
> > Cc: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
> > Cc: Upadhyay <tejas.upadhyay@intel.com>
> > Cc: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
> > Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> > ---
> >  lib/igt_sysfs.c | 30 ++++++++++++++++++++++++++++++  lib/igt_sysfs.h |  8
> > ++++++++
> >  2 files changed, 38 insertions(+)
> >
> > diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c index 35a4faa9..495b0288 100644
> > --- a/lib/igt_sysfs.c
> > +++ b/lib/igt_sysfs.c
> > @@ -287,6 +287,36 @@ int igt_sysfs_get_num_gt(int device)
> >	return num_gts;
> >  }
> >
> > +/**
> > + * igt_sysfs_get_num_tiles:
> > + * @device: fd of the device
> > + *
> > + * Reads number of tiles sysfs entries.
> > + * Asserts for at least one tile entry.
> > + *
> > + * Returns: Number of tiles.
> > + */
> > +int igt_sysfs_get_num_tiles(int device) {
> > +	int num_tiles;
> > +	char sysfs[48];
> > +	char tiledir[96];
> > +
> > +	num_tiles =0;
> > +	if (!igt_sysfs_path(device, sysfs, sizeof(sysfs)))
> > +		return -1;
> > +
> > +	do {
> > +		igt_assert(snprintf(tiledir, sizeof(tiledir), "%s/device/tile%d",
> > +				    sysfs, num_tiles) < sizeof(tiledir));
>
> I feel this is not best way to count tiles, as because of some reason if
> we don't create tile sysfs dir , wrong number of tiles will be detected
> and then logic to follow for_each_gt/tile. But for now as we don't have
> anything supporting in kernel right now to give tile info we can rely on
> this.
>
> Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>

I don't see the point of adding temporary solutions like this. Why not add
XE_QUERY_CONFIG_TILE_COUNT under drm_xe_query_config in the kernel?

>
> > +		num_tiles++;
> > +	} while (!access(tiledir, F_OK));
> > +
> > +	num_tiles--;
> > +	igt_assert_f(num_tiles > 0, "No tiles sysfs entry is found.");
> > +	return num_tiles;
> > +}
> > +
> >  /**
> >   * igt_sysfs_write:
> >   * @dir: directory for the device from igt_sysfs_open() diff --git
> > a/lib/igt_sysfs.h b/lib/igt_sysfs.h index 978b6906..de2c9a86 100644
> > --- a/lib/igt_sysfs.h
> > +++ b/lib/igt_sysfs.h
> > @@ -38,6 +38,11 @@
> >	     (dirfd__ = igt_sysfs_gt_open(i915__, gt__)) != -1; \
> >	     close(dirfd__), gt__++)
> >
> > +#define for_each_sysfs_tile_dirfd(xe__, tile__, tile_cnt__) \
> > +	for (tile__ = 0, tile_cnt__ = igt_sysfs_get_num_tiles(xe__); \
> > +	     tile__ < tile_cnt__; \
> > +	     ++tile__)

Where is dirfd here which should be a fd to an open sysfs directory as in
for_each_sysfs_gt_dirfd?

> > +
> >  #define i915_for_each_gt for_each_sysfs_gt_dirfd
> >
> >  #define igt_sysfs_rps_write(dir, id, data, len) \ @@ -73,6 +78,8 @@  #define
> > igt_sysfs_rps_set_boolean(dir, id, value) \
> >	igt_sysfs_set_boolean(dir, igt_sysfs_dir_id_to_name(dir, id), value)
> >
> > +#define xe_for_each_tile for_each_sysfs_tile_dirfd
> > +
> >  enum i915_attr_id {
> >	RPS_ACT_FREQ_MHZ,
> >	RPS_CUR_FREQ_MHZ,
> > @@ -97,6 +104,7 @@ int igt_sysfs_open(int device);  char
> > *igt_sysfs_gt_path(int device, int gt, char *path, int pathlen);  int
> > igt_sysfs_gt_open(int device, int gt);  int igt_sysfs_get_num_gt(int device);
> > +int igt_sysfs_get_num_tiles(int device);
> >  bool igt_sysfs_has_attr(int dir, const char *attr);  const char
> > *igt_sysfs_dir_id_to_name(int dir, enum i915_attr_id id);  const char
> > *igt_sysfs_path_id_to_name(const char *path, enum i915_attr_id id);
> > --
> > 2.25.1
>

  reply	other threads:[~2023-06-26 20:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 11:49 [igt-dev] [PATCH v2 0/4] Handle GT and tile seperation in IGT Himal Prasad Ghimiray
2023-06-23 11:49 ` [igt-dev] [PATCH v2 1/4] lib/igt_sysfs: Add support to query number of tiles Himal Prasad Ghimiray
2023-06-26 10:24   ` Upadhyay, Tejas
2023-06-26 20:24     ` Dixit, Ashutosh [this message]
2023-06-23 11:49 ` [igt-dev] [PATCH v2 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes Himal Prasad Ghimiray
2023-06-26 10:48   ` Upadhyay, Tejas
2023-06-26 22:34     ` Dixit, Ashutosh
2023-06-27  4:22       ` Ghimiray, Himal Prasad
2023-06-27  6:02         ` Dixit, Ashutosh
2023-06-27  7:06           ` Ghimiray, Himal Prasad
2023-07-01 17:44             ` Dixit, Ashutosh
2023-07-04  5:42               ` Ghimiray, Himal Prasad
2023-06-23 11:49 ` [igt-dev] [PATCH v2 3/4] tests/xe/xe_guc_pc: Change the sysfs paths Himal Prasad Ghimiray
2023-06-26 10:49   ` Upadhyay, Tejas
2023-06-23 11:49 ` [igt-dev] [PATCH v2 4/4] tests/xe/xe_sysfs_tile_prop: adds new test to verify per tile vram addr_range Himal Prasad Ghimiray
2023-06-26 10:59   ` Upadhyay, Tejas
2023-06-26 11:20     ` Ghimiray, Himal Prasad
2023-06-23 12:44 ` [igt-dev] ✓ Fi.CI.BAT: success for Handle GT and tile seperation in IGT Patchwork
2023-06-23 18:13 ` [igt-dev] ✓ Fi.CI.IGT: " 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=87jzvq6kgg.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@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