From: "Laguna, Lukasz" <lukasz.laguna@intel.com>
To: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: <piotr.piorkowski@intel.com>, <jakub1.kolakowski@intel.com>
Subject: Re: [PATCH i-g-t 3/6] lib/xe/xe_query: Add tile helpers and iteration macro
Date: Thu, 6 Nov 2025 12:32:11 +0100 [thread overview]
Message-ID: <2cbfa06f-88fa-43fe-8184-bd5f6f856b7d@intel.com> (raw)
In-Reply-To: <20251031125633.1374273-4-marcin.bernatowicz@linux.intel.com>
On 10/31/2025 13:56, Marcin Bernatowicz wrote:
> From: Piotr Piórkowski <piotr.piorkowski@intel.com>
>
> Add helpers for tile-level access:
> - xe_tiles_count(): return number of tiles
> - xe_tile_get_main_gt_id(): get MAIN GT ID for a tile
> - xe_for_each_tile(): iterate over tiles via tile_mask
>
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
> ---
> lib/xe/xe_query.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> lib/xe/xe_query.h | 6 ++++++
> 2 files changed, 51 insertions(+)
>
> diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
> index a89e0b980..e58b3bf1e 100644
> --- a/lib/xe/xe_query.c
> +++ b/lib/xe/xe_query.c
> @@ -515,6 +515,22 @@ unsigned int xe_dev_max_gt(int fd)
> return igt_fls(xe_dev->gt_mask) - 1;
> }
>
> +/**
> + * xe_tiles_count
missing colon
> + * @fd: xe device fd
> + *
> + * Return number of tiles for xe device fd.
> + */
> +uint8_t xe_tiles_count(int fd)
> +{
> + struct xe_device *xe_dev;
> +
> + xe_dev = find_in_cache(fd);
> + igt_assert(xe_dev);
> +
> + return igt_hweight(xe_dev->tile_mask);
> +}
> +
> /**
> * all_memory_regions:
> * @fd: xe device fd
> @@ -995,6 +1011,35 @@ uint16_t xe_gt_get_tile_id(int fd, int gt)
> return xe_dev->gt_list->gt_list[gt].tile_id;
> }
>
> +/**
> + * xe_tile_get_main_gt_id:
> + * @fd: xe device fd
> + * @tile: tile id
> + *
> + * Returns main GT ID for given @tile.
> + */
> +uint16_t xe_tile_get_main_gt_id(int fd, uint8_t tile)
nit: uint16_t? Do we expect so many GTs?
> +{
> + struct xe_device *xe_dev;
> + int gt_id = -1;
> +
> + xe_dev = find_in_cache(fd);
> + igt_assert(xe_dev);
> +
> + for (int i = 0; i < xe_dev->gt_list->num_gt; i++) {
> + const struct drm_xe_gt *gt_data = &xe_dev->gt_list->gt_list[i];
> +
> + if (gt_data->tile_id == tile && gt_data->type == DRM_XE_QUERY_GT_TYPE_MAIN) {
> + gt_id = gt_data->gt_id;
> + break;
> + }
> + }
> +
> + igt_assert_f(gt_id >= 0, "No main GT found for tile %d\n", tile);
> +
> + return gt_id;
> +}
> +
> /**
> * xe_hwconfig_lookup_value:
> * @fd: xe device fd
> diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
> index 715b64e2f..bcdfb54b0 100644
> --- a/lib/xe/xe_query.h
> +++ b/lib/xe/xe_query.h
> @@ -86,6 +86,10 @@ struct xe_device {
> for (uint64_t igt_unique(__mask) = xe_device_get(__fd)->gt_mask; \
> __gt = ffsll(igt_unique(__mask)) - 1, igt_unique(__mask) != 0; \
> igt_unique(__mask) &= ~(1ull << __gt))
> +#define xe_for_each_tile(__fd, __tile) \
> + for (uint64_t igt_unique(__mask) = xe_device_get(__fd)->tile_mask; \
> + __tile = ffsll(igt_unique(__mask)) - 1, igt_unique(__mask) != 0; \
> + igt_unique(__mask) &= ~(1ull << __tile))
> #define xe_for_each_mem_region(__fd, __memreg, __r) \
> for (uint64_t igt_unique(__i) = 0; igt_unique(__i) < igt_fls(__memreg); igt_unique(__i)++) \
> for_if(__r = (__memreg & (1ull << igt_unique(__i))))
> @@ -101,6 +105,7 @@ struct xe_device {
>
> unsigned int xe_number_gt(int fd);
> unsigned int xe_dev_max_gt(int fd);
> +uint8_t xe_tiles_count(int fd);
> uint64_t all_memory_regions(int fd);
> uint64_t system_memory(int fd);
> const struct drm_xe_gt *drm_xe_get_gt(struct xe_device *xe_dev, int gt_id);
> @@ -135,6 +140,7 @@ uint16_t xe_gt_type(int fd, int gt);
> bool xe_is_media_gt(int fd, int gt);
> bool xe_is_main_gt(int fd, int gt);
> uint16_t xe_gt_get_tile_id(int fd, int gt);
> +uint16_t xe_tile_get_main_gt_id(int fd, uint8_t tile);
> uint32_t *xe_hwconfig_lookup_value(int fd, enum intel_hwconfig attribute, uint32_t *len);
> int xe_query_pxp_status(int fd);
> int xe_wait_for_pxp_init(int fd);
Looks good overall, just please fix the missing colon:
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
next prev parent reply other threads:[~2025-11-06 11:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 12:56 [PATCH i-g-t 0/6] Multi-tile support for xe_sriov_flr and related MMIO improvements Marcin Bernatowicz
2025-10-31 12:56 ` [PATCH i-g-t 1/6] lib/xe_mmio: Introduce tile-level XE MMIO access helpers Marcin Bernatowicz
2025-11-06 11:12 ` Laguna, Lukasz
2025-11-06 12:11 ` Bernatowicz, Marcin
2025-10-31 12:56 ` [PATCH i-g-t 2/6] lib/xe_mmio: Add init flag and helper to check initialization Marcin Bernatowicz
2025-10-31 12:56 ` [PATCH i-g-t 3/6] lib/xe/xe_query: Add tile helpers and iteration macro Marcin Bernatowicz
2025-11-06 11:32 ` Laguna, Lukasz [this message]
2025-11-06 12:42 ` Bernatowicz, Marcin
2025-10-31 12:56 ` [PATCH i-g-t 4/6] tests/xe_sriov_flr: Make subchecks Tile aware Marcin Bernatowicz
2025-11-06 11:19 ` Piotr Piórkowski
2025-11-06 15:13 ` Bernatowicz, Marcin
2025-10-31 12:56 ` [PATCH i-g-t 5/6] tests/intel/xe_sriov_flr: Use global MMIO context initialized in verify_flr Marcin Bernatowicz
2025-11-06 12:03 ` Piotr Piórkowski
2025-11-06 14:16 ` Bernatowicz, Marcin
2025-10-31 12:56 ` [PATCH i-g-t 6/6] tests/intel/xe_sriov_flr: Do not ignore failed prerequisites Marcin Bernatowicz
2025-11-06 13:48 ` Piotr Piórkowski
2025-11-01 1:43 ` ✓ i915.CI.BAT: success for Multi-tile support for xe_sriov_flr and related MMIO improvements Patchwork
2025-11-01 2:00 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-01 11:23 ` ✗ i915.CI.Full: failure " Patchwork
2025-11-01 18:41 ` ✓ Xe.CI.Full: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2025-11-06 15:28 [PATCH i-g-t 0/6] " Marcin Bernatowicz
2025-11-06 15:28 ` [PATCH i-g-t 3/6] lib/xe/xe_query: Add tile helpers and iteration macro Marcin Bernatowicz
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=2cbfa06f-88fa-43fe-8184-bd5f6f856b7d@intel.com \
--to=lukasz.laguna@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=marcin.bernatowicz@linux.intel.com \
--cc=piotr.piorkowski@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