[PATCH i-g-t 5/7] tests/intel/xe_query: Look up GT reference clock correctly
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Wed Jul 2 11:33:08 UTC 2025
On Mon, Jun 30, 2025 at 09:35:35AM -0700, Matt Roper wrote:
> The open-coded GT loop should be replaced by a direct GT ID lookup to
> obtain the reference clock in order to ensure this continues to work on
> future platforms where GT ID != index in the GT query list.
>
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> tests/intel/xe_query.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
> index 9c7bf1d6f..96352da2c 100644
> --- a/tests/intel/xe_query.c
> +++ b/tests/intel/xe_query.c
> @@ -675,18 +675,13 @@ query_engine_cycles(int fd, struct drm_xe_query_engine_cycles *resp)
> static uint32_t
> __engine_reference_clock(int fd, int gt_id)
> {
> - uint32_t reference_clock = 0;
> struct xe_device *xe_dev = xe_device_get(fd);
> + const struct drm_xe_gt *gt = drm_xe_get_gt(xe_dev, gt_id);
>
> - for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++) {
> - if (gt == gt_id) {
> - reference_clock = xe_dev->gt_list->gt_list[gt].reference_clock;
> - break;
> - }
> - }
> - igt_assert(reference_clock);
> + igt_assert(gt);
> + igt_assert(gt->reference_clock);
>
> - return reference_clock;
> + return gt->reference_clock;
> }
>
> static void
> --
> 2.49.0
>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
More information about the igt-dev
mailing list