From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 056AD10E261 for ; Mon, 26 Jun 2023 22:34:31 +0000 (UTC) Date: Mon, 26 Jun 2023 15:34:27 -0700 Message-ID: <875y79df9o.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Upadhyay, Tejas" In-Reply-To: References: <20230623114946.3803540-1-himal.prasad.ghimiray@intel.com> <20230623114946.3803540-3-himal.prasad.ghimiray@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [igt-dev] [PATCH v2 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "igt-dev@lists.freedesktop.org" Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Mon, 26 Jun 2023 03:48:16 -0700, Upadhyay, Tejas wrote: > > > -----Original Message----- > > From: Ghimiray, Himal Prasad > > Sent: Friday, June 23, 2023 5:20 PM > > To: igt-dev@lists.freedesktop.org > > Cc: Ghimiray, Himal Prasad ; Iddamsetty, > > Aravind ; Upadhyay, Tejas > > ; Kumar, Janga Rahul > > ; Dugast, Francois > > ; Dixit, Ashutosh ; > > Roper, Matthew D > > Subject: [PATCH v2 2/4] lib/igt_sysfs: Handling gt related sysfs uapi changes > > > > Patch https://patchwork.freedesktop.org/series/118927/ > > is moving gt sysfs parent under tile folder. > > > > With the above patch path for sysfs changes: > > from: /sys/class/drm/cardX/device/gtN/ > > to : /sys/class/drm/cardX/device/tileN/gtN > > > > Adding xe_for_each_gt_under_each_tile macro to access new path. > > > > v2: > > - Calculate number of tiles once within iterator. (Rahul) > > > > Cc: Aravind Iddamsetty > > Cc: Upadhyay > > Cc: Janga Rahul Kumar > > Cc: Francois Dugast > > Cc: Ashutosh Dixit > > Cc: Matt Roper > > Signed-off-by: Himal Prasad Ghimiray > > --- > > lib/igt_sysfs.h | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h index de2c9a86..42bf2741 100644 > > --- a/lib/igt_sysfs.h > > +++ b/lib/igt_sysfs.h > > @@ -80,6 +80,12 @@ > > > > #define xe_for_each_tile for_each_sysfs_tile_dirfd > > > > +/* FIXME: Need to revisit if GT indexing under TILE changes from KMD */ > > +#define xe_for_each_gt_under_each_tile(xe__, gt__, tile__, tile_cnt__) \ > > + for (gt__ = 0, tile__ = 0, tile_cnt__ = igt_sysfs_get_num_tiles(xe__) ; \ > > + gt__ < xe_number_gt(xe__); \ > > + (xe_number_gt(xe__) == tile_cnt__) ? ++gt__, ++tile__ : ++gt__) > > + > > This is with consideration of indexing and also considering equal (or all > GT counts are on one tile) GT counts on each tile. Consider case when > 2GTs on 1 tile and 1 GT on other tile. But for all current platforms we > have it should work, need to revisit when any of those scenario comes. Yes because of this like tile info should be properly exposed from the xe kmd query api. Or we could do the sysfs as we did on i915. For the above how about a shorter name like "xe_for_each_tile_and_gt"? Also I would change the order of tile__ and gt__ arguments since that is more logical, gt's are under tiles. Also I don't think tile_cnt__ should be in the macro args, we could just do this: #define xe_for_each_tile_and_gt(xe__, , tile__, gt__) \ for (gt__ = 0, tile__ = 0; \ gt__ < xe_number_gt(xe__); \ (xe_number_gt(xe__) == igt_sysfs_get_num_tiles(xe__) ? ++gt__, ++tile__ : ++gt__) So that is possible, but why are we comparing num_gt with num_tiles? So no idea what's going on here. It should be num gt's per tile if they are all the same :/ > > Reviewed-by: Tejas Upadhyay > > > enum i915_attr_id { > > RPS_ACT_FREQ_MHZ, > > RPS_CUR_FREQ_MHZ, > > -- > > 2.25.1 >