From: Xin Wang <x.wang@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: matthew.d.roper@intel.com, zbigniew.kempczynski@intel.com,
kamil.konieczny@linux.intel.com, ravi.kumar.vodapalli@intel.com,
Xin Wang <x.wang@intel.com>
Subject: [PATCH v12 3/4] lib/intel_device_info: allow xe_query to override graphics version
Date: Sat, 17 Jan 2026 23:48:19 +0000 [thread overview]
Message-ID: <20260117234821.929209-4-x.wang@intel.com> (raw)
In-Reply-To: <20260117234821.929209-1-x.wang@intel.com>
Xe2+ devices expose the graphics major/minor version via the hardware GMD_ID
register. Teach xe_device_get() to pick up ip_ver_{major,minor} from the MAIN
GT and update the cached intel_device_info accordingly.
Add xe_dev_update_graphics_ver() helper and wire it up from xe_query.
v2:
- make xe_dev_update_graphics_ver() return error and guard NULL cache.
- assert in xe query path to avoid silently ignoring update failures.
Signed-off-by: Xin Wang <x.wang@intel.com>
---
lib/intel_chipset.h | 1 +
lib/intel_device_info.c | 32 ++++++++++++++++++++++++++++++++
lib/xe/xe_query.c | 13 +++++++++++++
3 files changed, 46 insertions(+)
diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index cc2225110..18d84f2f4 100644
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -106,6 +106,7 @@ const struct intel_cmds_info *intel_get_cmds_info(uint16_t devid) __attribute__(
unsigned intel_gen(uint16_t devid) __attribute__((pure));
unsigned intel_graphics_ver(uint16_t devid) __attribute__((pure));
unsigned intel_display_ver(uint16_t devid) __attribute__((pure));
+int32_t xe_dev_update_graphics_ver(uint16_t devid, unsigned major, unsigned minor);
extern enum pch_type intel_pch;
diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
index e97a8caa0..15f9afdf2 100644
--- a/lib/intel_device_info.c
+++ b/lib/intel_device_info.c
@@ -738,6 +738,38 @@ igt_destructor
intel_device_info_cache_fini();
}
+/**
+ * xe_dev_update_graphics_ver:
+ * @devid: pci device id
+ * @major: new major graphics version
+ * @minor: new minor graphics version
+ *
+ * This function updates the graphics version for Xe devices with the specified
+ * devid, for Xe2+ devices, the graphics major and minor versions can be read
+ * directly from the hardware GMD_ID register.
+ * Returns:
+ * 0 on success, -1 if the cache is not found in the map.
+ */
+int32_t xe_dev_update_graphics_ver(uint16_t devid, unsigned major, unsigned minor)
+{
+ struct intel_device_info *info;
+ uint32_t key = devid;
+ int32_t ret = 0;
+ if (intel_graphics_ver(devid) != IP_VER(major, minor)) {
+ pthread_mutex_lock(&dev.cache_mutex);
+ info = igt_map_search(dev.map, &key);
+ if (info) {
+ info->graphics_ver = major;
+ info->graphics_rel = minor;
+ }
+ else {
+ ret = -1;
+ }
+ pthread_mutex_unlock(&dev.cache_mutex);
+ }
+ return ret;
+}
+
/**
* intel_get_device_info:
* @devid: pci device id
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 981d76948..0033680a7 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -270,6 +270,19 @@ struct xe_device *xe_device_get(int fd)
for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++)
xe_dev->gt_mask |= (1ull << xe_dev->gt_list->gt_list[gt].gt_id);
+ for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++) {
+ if (xe_dev->gt_list->gt_list[gt].type == DRM_XE_QUERY_GT_TYPE_MAIN &&
+ xe_dev->gt_list->gt_list[gt].ip_ver_major) {
+ igt_debug("Setting graphics_ver to %u and graphics_rel to %u\n",
+ xe_dev->gt_list->gt_list[gt].ip_ver_major,
+ xe_dev->gt_list->gt_list[gt].ip_ver_minor);
+ igt_assert_f(!xe_dev_update_graphics_ver(xe_dev->dev_id,
+ xe_dev->gt_list->gt_list[gt].ip_ver_major,
+ xe_dev->gt_list->gt_list[gt].ip_ver_minor),
+ "Failed to update graphics version for dev_id 0x%x\n", xe_dev->dev_id);
+ break;
+ }
+ }
/* Tile IDs may be non-consecutive; keep a mask of valid IDs */
for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++)
xe_dev->tile_mask |= (1ull << xe_dev->gt_list->gt_list[gt].tile_id);
--
2.43.0
next prev parent reply other threads:[~2026-01-17 23:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-17 23:48 [PATCH v12 0/4] lib/intel_device_info: get the xe .graphics_rel from GMD_ID Xin Wang
2026-01-17 23:48 ` [PATCH v12 1/4] lib/igt_core: add igt_destructor helper macro Xin Wang
2026-01-17 23:48 ` [PATCH v12 2/4] lib/intel_device_info: make device info cache thread-safe Xin Wang
2026-01-17 23:48 ` Xin Wang [this message]
2026-01-17 23:48 ` [PATCH v12 4/4] lib/intel_device_info: remove the graphcs_rel from xe2+ devices Xin Wang
2026-01-18 0:40 ` ✓ Xe.CI.BAT: success for lib/intel_device_info: get the xe .graphics_rel from GMD_ID Patchwork
2026-01-18 0:52 ` ✓ i915.CI.BAT: " Patchwork
2026-01-18 1:47 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-18 2:56 ` ✓ i915.CI.Full: success " 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=20260117234821.929209-4-x.wang@intel.com \
--to=x.wang@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=matthew.d.roper@intel.com \
--cc=ravi.kumar.vodapalli@intel.com \
--cc=zbigniew.kempczynski@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.