From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Marcin Bernatowicz" <marcin.bernatowicz@linux.intel.com>,
"Adam Miszczak" <adam.miszczak@linux.intel.com>,
"Jakub Kolakowski" <jakub1.kolakowski@intel.com>,
"Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Lukasz Laguna" <lukasz.laguna@intel.com>,
"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
"Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>
Subject: [PATCH i-g-t 1/2] lib/xe/xe_query: Don’t assume sequential GT IDs in xe_gt_type()
Date: Mon, 8 Sep 2025 18:07:22 +0200 [thread overview]
Message-ID: <20250908160723.1723178-2-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20250908160723.1723178-1-marcin.bernatowicz@linux.intel.com>
Replace direct gt_list indexing with drm_xe_get_gt() and check
gt_mask before use. This ensures xe_gt_type() works with real
GT IDs instead of assuming list index == uapi ID, consistent
with other helpers.
Fixes: 3bb0c49ac668 ("lib/xe/xe_query: Add xe_gt_type() and xe_is_main_gt() helpers")
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
---
lib/xe/xe_query.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 9b88cce8d..17045f3fb 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -927,12 +927,15 @@ bool xe_has_media_gt(int fd)
uint16_t xe_gt_type(int fd, int gt)
{
struct xe_device *xe_dev = find_in_cache(fd);
+ const struct drm_xe_gt *xe_gt;
igt_assert(xe_dev);
- igt_assert_f(gt >= 0 && gt < xe_number_gt(fd),
- "gt %d out of range [0..%d)\n", gt, xe_number_gt(fd));
+ igt_assert(xe_dev->gt_mask & BIT(gt));
+
+ xe_gt = drm_xe_get_gt(xe_dev, gt);
+ igt_assert(xe_gt);
- return xe_dev->gt_list->gt_list[gt].type;
+ return xe_gt->type;
}
/**
--
2.31.1
next prev parent reply other threads:[~2025-09-08 16:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-08 16:07 [PATCH i-g-t 0/2] Don’t assume sequential GT IDs Marcin Bernatowicz
2025-09-08 16:07 ` Marcin Bernatowicz [this message]
2025-09-09 8:23 ` [PATCH i-g-t 1/2] lib/xe/xe_query: Don’t assume sequential GT IDs in xe_gt_type() Kamil Konieczny
2025-09-08 16:07 ` [PATCH i-g-t 2/2] tests/intel/xe_sriov_flr: Use xe_for_each_gt() for GT iteration Marcin Bernatowicz
2025-09-09 8:26 ` Kamil Konieczny
2025-09-09 2:38 ` ✓ i915.CI.BAT: success for Don’t assume sequential GT IDs Patchwork
2025-09-09 2:57 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-09 10:43 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-09 13:57 ` Bernatowicz, Marcin
2025-09-09 18:13 ` ✗ i915.CI.Full: " Patchwork
2025-09-10 7:45 ` Bernatowicz, Marcin
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=20250908160723.1723178-2-marcin.bernatowicz@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=kamil.konieczny@linux.intel.com \
--cc=lukasz.laguna@intel.com \
--cc=piotr.piorkowski@intel.com \
--cc=satyanarayana.k.v.p@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.