From: Andrzej Hajda <andrzej.hajda@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Priyanka Dandamudi" <priyanka.dandamudi@intel.com>,
"Gwan-gyeong Mun" <gwan-gyeong.mun@intel.com>,
"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
"Christoph Manszewski" <christoph.manszewski@intel.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>
Subject: [PATCH v6 7/7] tests/intel/xe_eudebug_online: use xe_query helpers for query GT topology
Date: Tue, 25 Nov 2025 10:37:27 +0100 [thread overview]
Message-ID: <20251125-xe_query_helpers-v6-7-97686fac1b77@intel.com> (raw)
In-Reply-To: <20251125-xe_query_helpers-v6-0-97686fac1b77@intel.com>
Using xe_query_device and xe_for_each_topology_mask simplifies the code.
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
tests/intel/xe_eudebug_online.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)
diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
index a5b2864a47a34b9051756174f73667bbc602e00b..1e160b0c3d8a3d616bfd99e2a99fb6b0d042f021 100644
--- a/tests/intel/xe_eudebug_online.c
+++ b/tests/intel/xe_eudebug_online.c
@@ -1208,36 +1208,14 @@ static int query_attention_bitmask_size(int fd, int gt)
{
uint32_t threads_per_eu = xe_hwconfig_lookup_value_u32(fd, INTEL_HWCONFIG_NUM_THREADS_PER_EU);
struct drm_xe_query_topology_mask *c_dss = NULL, *g_dss = NULL, *eu_per_dss = NULL;
- struct drm_xe_query_topology_mask *topology;
- struct drm_xe_device_query query = {
- .extensions = 0,
- .query = DRM_XE_DEVICE_QUERY_GT_TOPOLOGY,
- .size = 0,
- .data = 0,
- };
+ struct drm_xe_query_topology_mask *topology, *topo;
uint8_t dss_mask, last_dss;
- int pos = 0;
+ uint32_t size;
int i, last_dss_idx;
- igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
- igt_assert_neq(query.size, 0);
-
- topology = malloc(query.size);
- igt_assert(topology);
-
- query.data = to_user_pointer(topology);
- igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
-
- while (query.size >= sizeof(struct drm_xe_query_topology_mask)) {
- struct drm_xe_query_topology_mask *topo;
- int sz;
-
- topo = (struct drm_xe_query_topology_mask *)((unsigned char *)topology + pos);
- sz = sizeof(struct drm_xe_query_topology_mask) + topo->num_bytes;
-
- query.size -= sz;
- pos += sz;
+ topology = xe_query_device(fd, DRM_XE_DEVICE_QUERY_GT_TOPOLOGY, &size);
+ xe_for_each_topology_mask(topology, size, topo) {
if (topo->gt_id != gt)
continue;
--
2.43.0
next prev parent reply other threads:[~2025-11-25 9:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 9:37 [PATCH v6 0/7] lib/xe/xe_query: implement few query helpers Andrzej Hajda
2025-11-25 9:37 ` [PATCH v6 1/7] tests/intel/xe_eudebug_online: use helper to get hwconfig value Andrzej Hajda
2025-11-25 9:37 ` [PATCH v6 2/7] lib/xe/xe_query: introduce helpers for device query Andrzej Hajda
2025-11-25 9:37 ` [PATCH v6 3/7] lib/xe/xe_query: use recently introduced helper to query device Andrzej Hajda
2025-11-25 9:37 ` [PATCH v6 4/7] lib/xe/xe_query: introduce iterator for GT topology masks Andrzej Hajda
2025-11-25 9:37 ` [PATCH v6 5/7] lib/xe/xe_oa: use xe_query helpers for query GT topology Andrzej Hajda
2025-11-25 9:37 ` [PATCH v6 6/7] tests/intel/xe_query: " Andrzej Hajda
2025-11-25 9:37 ` Andrzej Hajda [this message]
2025-11-25 13:50 ` ✓ i915.CI.BAT: success for lib/xe/xe_query: implement few query helpers (rev6) Patchwork
2025-11-25 15:04 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-25 18:24 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-26 9:15 ` â " Hajda, Andrzej
2025-11-26 1:30 ` ✗ i915.CI.Full: " Patchwork
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=20251125-xe_query_helpers-v6-7-97686fac1b77@intel.com \
--to=andrzej.hajda@intel.com \
--cc=christoph.manszewski@intel.com \
--cc=gwan-gyeong.mun@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=piotr.piorkowski@intel.com \
--cc=priyanka.dandamudi@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;
as well as URLs for NNTP newsgroup(s).