Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v8 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes
Date: Sat, 08 Jul 2023 12:30:16 -0700	[thread overview]
Message-ID: <87351yi4l3.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20230707113055.648662-3-himal.prasad.ghimiray@intel.com>

On Fri, 07 Jul 2023 04:30:53 -0700, Himal Prasad Ghimiray wrote:
>
> +char *xe_sysfs_gt_path(int xe_device, int gt, char *path, int pathlen)
> +{
> +	struct stat st;
> +
> +	if (xe_device < 0)
> +		return NULL;
> +
> +	if (igt_debug_on(fstat(xe_device, &st)) || igt_debug_on(!S_ISCHR(st.st_mode)))
> +		return NULL;
> +
> +	if (IS_METEORLAKE(xe_device))

This is wrong, it should be:

	if (IS_METEORLAKE(intel_get_drm_devid(xe_device)))

Also why not use the IS_PONTEVECCHIO() check as I suggested? Several
upcoming platforms will have the MTL tile/gt configuration so we'll need to
keep fixing this, if we use PVC we can leave this code alone for a
while. Anyway I am ok as is too.

Also maybe move these 2 functions above igt_sysfs_gt_path() in the file. I
have a reason for that, will explain later.

Apart from this, almost there I think. I can suggest a couple more changes
but will hold off so that we can get this merged first.

But the build seems to have failed so let's fix that and also make sure
xe_guc_pc IGT's are passing in pre-merge CI (just in case we've missed
anything). I'll take a look and then R-b the patches.

Thanks.
--
Ashutosh


> +		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile0/gt%d",
> +			 major(st.st_rdev), minor(st.st_rdev), gt);
> +	else
> +		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile%d/gt%d",
> +			 major(st.st_rdev), minor(st.st_rdev), gt, gt);
> +
> +	if (!access(path, F_OK))
> +		return path;
> +
> +	return NULL;
> +}
> +
> +/**
> + * xe_sysfs_gt_open:
> + * @xe_device: fd of the device
> + * @gt: gt number
> + *
> + * This opens the sysfs gt directory corresponding to device and tile for use
> + *
> + * Returns:
> + * The directory fd, or -1 on failure.
> + */
> +int xe_sysfs_gt_open(int xe_device, int gt)
> +{
> +	char path[96];
> +
> +	if (!xe_sysfs_gt_path(xe_device, gt, path, sizeof(path)))
> +		return -1;
> +
> +	return open(path, O_RDONLY);
> +}
> +
>  /**
>   * xe_sysfs_tile_path:
>   * @xe_device: fd of the device
> diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
> index 5d584b1c7..afcafb07c 100644
> --- a/lib/igt_sysfs.h
> +++ b/lib/igt_sysfs.h
> @@ -157,6 +157,8 @@ void igt_sysfs_rw_attr_verify(igt_sysfs_rw_attr_t *rw);
>  void igt_sysfs_engines(int xe, int engines, const char **property,
>		       void (*test)(int, int, const char **));
>
> +char *xe_sysfs_gt_path(int xe_device, int gt, char *path, int pathlen);
> +int xe_sysfs_gt_open(int xe_device, int gt);
>  char *xe_sysfs_tile_path(int xe_device, int tile, char *path, int pathlen);
>  int xe_sysfs_tile_open(int xe_device, int tile);
>  int xe_sysfs_get_num_tiles(int xe_device);
> --
> 2.25.1
>

  reply	other threads:[~2023-07-08 19:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 11:30 [igt-dev] [PATCH i-g-t v8 0/4] Handle GT and tile seperation in IGT Himal Prasad Ghimiray
2023-07-07 11:30 ` [igt-dev] [PATCH i-g-t v8 1/4] lib/igt_sysfs: Add support to query number of tiles Himal Prasad Ghimiray
2023-07-08 19:29   ` Dixit, Ashutosh
2023-07-10  4:12     ` Ghimiray, Himal Prasad
2023-07-07 11:30 ` [igt-dev] [PATCH i-g-t v8 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes Himal Prasad Ghimiray
2023-07-08 19:30   ` Dixit, Ashutosh [this message]
2023-07-10  4:14     ` Ghimiray, Himal Prasad
2023-07-07 11:30 ` [igt-dev] [PATCH i-g-t v8 3/4] tests/xe/xe_guc_pc: Change the sysfs paths Himal Prasad Ghimiray
2023-07-08 19:30   ` Dixit, Ashutosh
2023-07-07 11:30 ` [igt-dev] [PATCH i-g-t v8 4/4] tests/xe/xe_sysfs_tile: adds new test to verify per tile vram addr_range Himal Prasad Ghimiray
2023-07-07 11:51 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Handle GT and tile seperation in IGT (rev7) 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=87351yi4l3.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