All of lore.kernel.org
 help / color / mirror / Atom feed
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 3/4] lib/intel_device_info: allow xe_query to override graphics version
Date: Sat, 17 Jan 2026 07:14:58 +0000	[thread overview]
Message-ID: <20260117071459.892532-4-x.wang@intel.com> (raw)
In-Reply-To: <20260117071459.892532-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.

Signed-off-by: Xin Wang <x.wang@intel.com>
---
 lib/intel_chipset.h     |  1 +
 lib/intel_device_info.c | 23 +++++++++++++++++++++++
 lib/xe/xe_query.c       | 12 ++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index cc2225110..5006b8283 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));
+void 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..7ae2a642a 100644
--- a/lib/intel_device_info.c
+++ b/lib/intel_device_info.c
@@ -738,6 +738,29 @@ 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.
+ */
+void xe_dev_update_graphics_ver(uint16_t devid, unsigned major, unsigned minor)
+{
+	struct intel_device_info *info;
+	uint32_t key = devid;
+	if (intel_graphics_ver(devid) != IP_VER(major, minor)) {
+		pthread_mutex_lock(&dev.cache_mutex);
+		info = igt_map_search(dev.map, &key);
+		info->graphics_ver = major;
+		info->graphics_rel = minor;
+		pthread_mutex_unlock(&dev.cache_mutex);
+	}
+}
+
 /**
  * intel_get_device_info:
  * @devid: pci device id
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 981d76948..da094dab5 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -270,6 +270,18 @@ 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);
+			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);
+			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


  parent reply	other threads:[~2026-01-17  7:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-17  7:14 [PATCH v11 0/4] lib/intel_device_info: get the xe .graphics_rel from GMD_ID Xin Wang
2026-01-17  7:14 ` [PATCH 1/4] lib/igt_core: add igt_destructor helper macro Xin Wang
2026-01-17  7:14 ` [PATCH 2/4] lib/intel_device_info: make device info cache thread-safe Xin Wang
2026-01-17  7:14 ` Xin Wang [this message]
2026-01-17  7:14 ` [PATCH 4/4] lib/intel_device_info: remove the graphcs_rel from xe2+ devices Xin Wang
2026-01-17  8:08 ` ✓ Xe.CI.BAT: success for lib/intel_device_info: get the xe .graphics_rel from GMD_ID Patchwork
2026-01-17  8:31 ` ✓ i915.CI.BAT: " Patchwork
2026-01-17  9:14 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-17 10:30 ` ✓ 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=20260117071459.892532-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.