From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 657BB10E08F for ; Sat, 1 Jul 2023 17:19:57 +0000 (UTC) Date: Sat, 01 Jul 2023 10:09:03 -0700 Message-ID: <87lefz8spc.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Himal Prasad Ghimiray In-Reply-To: <20230627180805.4189160-2-himal.prasad.ghimiray@intel.com> References: <20230627180805.4189160-1-himal.prasad.ghimiray@intel.com> <20230627180805.4189160-2-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 v4 1/4] lib/igt_sysfs: Add support to query number of tiles List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, Upadhyay Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Tue, 27 Jun 2023 11:08:02 -0700, Himal Prasad Ghimiray wrote: > Hi Himal, > 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__) > + You did not answer the question I asked previously about this: "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 I think let's just do this and get rid of for_each_sysfs_tile_dirfd: #define xe_for_each_tile(xe__, tile__, tile_cnt__) \ for (tile__ = 0, tile_cnt__ = igt_sysfs_get_num_tiles(xe__); \ tile__ < tile_cnt__; \ ++tile__) > + > 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 >