[igt-dev] [i-g-t] lib/intel_chipset: Read device id from xe_device struct

Bhanuprakash Modem bhanuprakash.modem at intel.com
Mon Sep 4 09:50:58 UTC 2023


Upon opening the driver, we query the device id & cache it in
the xe_device struct. So, no need to query for it every time,
instead, just read it from the xe_device.

Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Mauro Carvalho Chehab <mchehab at kernel.org>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 lib/intel_chipset.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c
index 1d7166aef..760faede2 100644
--- a/lib/intel_chipset.c
+++ b/lib/intel_chipset.c
@@ -127,29 +127,6 @@ static uint32_t __i915_get_drm_devid(int fd)
 	return devid;
 }
 
-static uint32_t __xe_get_drm_devid(int fd)
-{
-	struct drm_xe_query_config *config;
-	struct drm_xe_device_query query = {
-		.extensions = 0,
-		.query = DRM_XE_DEVICE_QUERY_CONFIG,
-		.size = 0,
-		.data = 0,
-	};
-
-	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
-
-	config = malloc(query.size);
-	igt_assert(config);
-
-	query.data = to_user_pointer(config);
-	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
-
-	igt_assert(config->num_params > 0);
-
-	return config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
-}
-
 /**
  * intel_get_drm_devid:
  * @fd: open i915/xe drm file descriptor
@@ -174,7 +151,7 @@ intel_get_drm_devid(int fd)
 	if (is_i915_device(fd))
 		return __i915_get_drm_devid(fd);
 	else
-		return __xe_get_drm_devid(fd);
+		return xe_dev_id(fd);
 }
 
 /**
-- 
2.40.0



More information about the igt-dev mailing list