[igt-dev] [PATCH i-g-t v8 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes

Ghimiray, Himal Prasad himal.prasad.ghimiray at intel.com
Mon Jul 10 04:14:53 UTC 2023



> -----Original Message-----
> From: Dixit, Ashutosh <ashutosh.dixit at intel.com>
> Sent: 09 July 2023 01:00
> To: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>
> Cc: igt-dev at lists.freedesktop.org; Kamil Konieczny
> <kamil.konieczny at linux.intel.com>; Iddamsetty, Aravind
> <aravind.iddamsetty at intel.com>; Upadhyay, Tejas
> <tejas.upadhyay at intel.com>; Kumar, Janga Rahul
> <janga.rahul.kumar at intel.com>; Dugast, Francois
> <francois.dugast at intel.com>; Roper, Matthew D
> <matthew.d.roper at intel.com>
> Subject: Re: [PATCH i-g-t v8 2/4] lib/igt_sysfs: Handling gt related sysfs uapi
> changes
> 
> 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)))

Thanks for pointing this.

> 
> 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.

Will change to IS_PONTEVECCHIO()

> 
> Also maybe move these 2 functions above igt_sysfs_gt_path() in the file. I
> have a reason for that, will explain later.
Ok.
> 
> 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.

New changes merged on Friday causing conflict. Will address the conflicts and push new patch.

> 
> 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
> >


More information about the igt-dev mailing list