lib/xe/xe_query: implement few query helpers
v4 cover lib/xe/xe_query: implement few query helpers
This patchset adds following helpers to xe_query library:
- xe_hwconfig_get_u32 - to get single value from hwconfig,
similar helper exists in kernel,
- xe_query_device - encapsulates common code around DRM_IOCTL_XE_DEVICE_QUERY,
- xe_for_each_topology_mask - iterator for blob returned by DRM_XE_DEVICE_QUERY_GT_TOPOLOGY Beside adding helpers patchset also shows their usefullness.
Cleaner code and diffstat of 85 insertions vs 282 deletions hopefuly proves usability of these helpers.
---
Changes in v4:
- removed can_fail arg from xe_query_device and add xe_query_device_may_fail,
- squashed last three patches into one,
- added tags,
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- added sanity check for len > 0 in xe_hwconfig_get_u32 (Priyanka),
- in xe_query_device treat returned query.size == 0 as unsupported query,
- with above change allow query for HWCONFIG to fail - case of old platforms (ADL-S),
- added R-B tag for patch 2,
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- add xe_query_device arg to allow fail without assert,
because EU_STALL and OA_UNITS are not implemented on old platforms,
- also return NULL if data size is 0 - case of hwconfig on old platforms,
- split first patch to implementation and conversion,
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Andrzej Hajda (6):
lib/xe_query: add helper to get first value of hwconfig tests/intel/xe_eudebug_online: use helper to get hwconfig value lib/xe/xe_query: introduce helpers for device query lib/xe/xe_query: use recently introduced helper to query device lib/xe/xe_query: introduce iterator for GT topology masks xe/treewide: use xe_query helpers for query GT topology
lib/xe/xe_oa.c | 37 ++----- lib/xe/xe_query.c | 220 ++++++++++------------------------------ lib/xe/xe_query.h | 27 +++++ tests/intel/xe_eudebug_online.c | 41 +------- tests/intel/xe_query.c | 69 ++++--------- 5 files changed, 111 insertions(+), 283 deletions(-)
---
base-commit: 5aeea13f553d4c5882cf4af9c83c8609265200f1
change-id: 20251106-xe_query_helpers-9a49432d828d
Best regards,
Signature · 1 line
Andrzej Hajda <[email protected]>
PATCH v4 1/6 lib/xe_query: add helper to get first value of hwconfig
Most hwconfig attributes are single values. Let's simplify querying them.
--- lib/xe/xe_query.c | 17 +++++++++++++++++ lib/xe/xe_query.h | 1 + 2 files changed, 18 insertions(+)
lib/xe/xe_query.c +17 -0
@@ -1080,6 +1080,23 @@ uint32_t *xe_hwconfig_lookup_value(int fd, enum intel_hwconfig attribute, uint32return NULL ; } +/** +* xe_hwconfig_get_u32: +* @fd: xe device fd +* @attribute: hwconfig attribute id +* @default_value: value to be returned in case attribute is not present +* +* Returns attribute value, if present, @default_value otherwise. +*/ +uint32_t xe_hwconfig_get_u32 (int fd,enum intel_hwconfig attribute,uint32_t default_value) +{ +uint32_t *vals, len; + + vals =xe_hwconfig_lookup_value (fd, attribute, &len); + +return (vals && len >0 ) ? *vals : default_value; +} +/** * xe_query_pxp_status: * @fd: xe device fd
lib/xe/xe_query.h +1 -0
@@ -142,6 +142,7 @@ bool xe_is_main_gt(int fd, int gt);uint16_t xe_gt_get_tile_id (int fd,int gt);uint16_t xe_tile_get_main_gt_id (int fd,uint8_t tile);uint32_t *xe_hwconfig_lookup_value (int fd,enum intel_hwconfig attribute,uint32_t *len); +uint32_t xe_hwconfig_get_u32 (int fd,enum intel_hwconfig attribute,uint32_t default_value);int xe_query_pxp_status (int fd);int xe_wait_for_pxp_init (int fd);
Signature · 1 line
2.43.0
PATCH v4 2/6 tests/intel/xe_eudebug_online: use helper to get hwconfig value
In reply to Andrzej HajdaRecently introduced helper makes the code cleaner.
--- tests/intel/xe_eudebug_online.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
tests/intel/xe_eudebug_online.c +1 -10
@@ -1182,9 +1182,7 @@ static bool intel_gen_has_lockstep_eus(int fd)static int query_attention_bitmask_size (int fd,int gt) { -uint32_t thread_count_len; -uint32_t *thread_count_ptr; -uint32_t threads_per_eu =8 ; +uint32_t threads_per_eu =xe_hwconfig_get_u32 (fd,INTEL_HWCONFIG_NUM_THREADS_PER_EU ,8 );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 = {
@@ -1197,13 +1195,6 @@ static int query_attention_bitmask_size(int fd, int gt)int pos =0 ;int i, last_dss_idx; - thread_count_ptr =xe_hwconfig_lookup_value (fd,INTEL_HWCONFIG_NUM_THREADS_PER_EU , - &thread_count_len); -if (thread_count_ptr) { -igt_assert (thread_count_len ==1 ); - threads_per_eu = *thread_count_ptr; - } -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 );igt_assert_neq (query.size,0 );
Signature · 1 line
2.43.0
PATCH v4 3/6 lib/xe/xe_query: introduce helpers for device query
In reply to Andrzej HajdaHelpers abstracts out common bits of DRM_XE_DEVICE_QUERY_HWCONFIG ioctl:
- query data size,
- alloc memory,
- get data,
- error checks,
- valgrind annotations.
There are two flawors, to fulfill current usage patterns:
- xe_query_device_may_fail - returns NULL if query is not supported,
- xe_query_device - asserts on error otherwise returns valid pointer.
--- lib/xe/xe_query.c | 43 +++++++++++++++++++++++++++++++++++++++++++ lib/xe/xe_query.h | 20 ++++++++++++++++++++ 2 files changed, 63 insertions(+)
lib/xe/xe_query.c +43 -0
@@ -25,6 +25,49 @@#include "xe_query.h" #include "xe_ioctl.h" +/** +* xe_query_device_may_fail: +* @fd: xe device fd +* @type: query type, one of DRM_XE_DEVICE_QUERY_* values +* @size: pointer to get size of returned data, can be NULL +* +* Calls DRM_IOCTL_XE_DEVICE_QUERY ioctl to query device information +* about specified @type. Returns pointer to malloc'ed data, which +* should be freed later by the user. If @query is not supported +* function returns NULL. On any other error it asserts. +*/ +void *xe_query_device_may_fail (int fd,uint32_t type,uint32_t *size) +{ +struct drm_xe_device_query query = { + .extensions =0 , + .query = type, + .size =0 , + .data =0 , + }; +void *data =NULL ; + +/* In case of unsupported query xe driver usually returns error, +* but in case of HWCONFIG it can also return query.size == 0 +* on older platforms. +*/ +if (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query) || !query.size) + goto skip_query; + + data =malloc (query.size); +igt_assert (data); + + query.data =to_user_pointer (data); +igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); + +VG (VALGRIND_MAKE_MEM_DEFINED (data, query.size)); + +skip_query: +if (size) + *size = query.size; + +return data; +} +static struct drm_xe_query_config *xe_query_config_new (int fd) {struct drm_xe_query_config *config;
lib/xe/xe_query.h +20 -0
@@ -143,9 +143,29 @@ uint16_t xe_gt_get_tile_id(int fd, int gt);uint16_t xe_tile_get_main_gt_id (int fd,uint8_t tile);uint32_t *xe_hwconfig_lookup_value (int fd,enum intel_hwconfig attribute,uint32_t *len);uint32_t xe_hwconfig_get_u32 (int fd,enum intel_hwconfig attribute,uint32_t default_value); +void *xe_query_device_may_fail (int fd,uint32_t type,uint32_t *size);int xe_query_pxp_status (int fd);int xe_wait_for_pxp_init (int fd); +/** +* xe_query_device: +* @fd: xe device fd +* @type: query type, one of DRM_XE_DEVICE_QUERY_* values +* @size: pointer to get size of returned data, can be NULL +* +* Calls DRM_IOCTL_XE_DEVICE_QUERY ioctl to query device information +* about specified @type. Returns pointer to malloc'ed data, which +* should be freed later by the user. If @query is not supported +* or on any other error it asserts. +*/ +static inline void *xe_query_device (int fd,uint32_t type,uint32_t *size) +{ +void *data =xe_query_device_may_fail (fd, type, size); + +igt_assert (data); +return data; +} +struct xe_device *xe_device_get (int fd);void xe_device_put (int fd);
Signature · 1 line
2.43.0
PATCH v4 4/6 lib/xe/xe_query: use recently introduced helper to query device
In reply to Andrzej HajdaIt simplifies the code.
--- lib/xe/xe_query.c | 190 +++--------------------------------------------------- 1 file changed, 8 insertions(+), 182 deletions(-)
lib/xe/xe_query.c +8 -182
@@ -68,83 +68,6 @@ skip_query:return data; } -static struct drm_xe_query_config *xe_query_config_new (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 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (config, query.size)); - -igt_assert (config->num_params >0 ); - -return config; -} - -static uint32_t *xe_query_hwconfig_new (int fd,uint32_t *hwconfig_size) -{ -uint32_t *hwconfig; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_HWCONFIG , - .size =0 , - .data =0 , - }; - -/* Perform the initial query to get the size */ -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); -if (!query.size) -return NULL ; - - hwconfig =malloc (query.size); -igt_assert (hwconfig); - - query.data =to_user_pointer (hwconfig); - -/* Perform the query to get the actual data */ -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (hwconfig, query.size)); - - *hwconfig_size = query.size; -return hwconfig; -} - -static struct drm_xe_query_gt_list *xe_query_gt_list_new (int fd) -{ -struct drm_xe_query_gt_list *gt_list; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_GT_LIST , - .size =0 , - .data =0 , - }; - -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - - gt_list =malloc (query.size); -igt_assert (gt_list); - - query.data =to_user_pointer (gt_list); -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (gt_list, query.size)); - -return gt_list; -} -static uint64_t __memory_regions (const struct drm_xe_query_gt_list *gt_list) {uint64_t regions =0 ;
@@ -157,103 +80,6 @@ static uint64_t __memory_regions(const struct drm_xe_query_gt_list *gt_list)return regions; } -static struct drm_xe_query_engines *xe_query_engines (int fd) -{ -struct drm_xe_query_engines *engines; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_ENGINES , - .size =0 , - .data =0 , - }; - -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - - engines =malloc (query.size); -igt_assert (engines); - - query.data =to_user_pointer (engines); -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (engines, query.size)); - -return engines; -} - -static struct drm_xe_query_mem_regions *xe_query_mem_regions_new (int fd) -{ -struct drm_xe_query_mem_regions *mem_regions; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_MEM_REGIONS , - .size =0 , - .data =0 , - }; - -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - - mem_regions =malloc (query.size); -igt_assert (mem_regions); - - query.data =to_user_pointer (mem_regions); -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (mem_regions, query.size)); - -return mem_regions; -} - -static struct drm_xe_query_eu_stall *xe_query_eu_stall_new (int fd) -{ -struct drm_xe_query_eu_stall *query_eu_stall; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_EU_STALL , - .size =0 , - .data =0 , - }; - -/* Support older kernels where this uapi is not yet available */ -if (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query)) -return NULL ; -igt_assert_neq (query.size,0 ); - - query_eu_stall =malloc (query.size); -igt_assert (query_eu_stall); - - query.data =to_user_pointer (query_eu_stall); -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (query_eu_stall, query.size)); - -return query_eu_stall; -} - -static struct drm_xe_query_oa_units *xe_query_oa_units_new (int fd) -{ -struct drm_xe_query_oa_units *oa_units; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_OA_UNITS , - .size =0 , - .data =0 , - }; - -/* Support older kernels where this uapi is not yet available */ -if (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query)) -return NULL ; - - oa_units =malloc (query.size); -igt_assert (oa_units); - - query.data =to_user_pointer (oa_units); -igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - -VG (VALGRIND_MAKE_MEM_DEFINED (oa_units, query.size)); - -return oa_units; -} -static uint64_t native_region_for_gt (const struct drm_xe_gt *gt) {uint64_t region;
@@ -412,11 +238,11 @@ struct xe_device *xe_device_get(int fd)igt_assert (xe_dev); xe_dev->fd = fd; - xe_dev->config =xe_query_config_new (fd); - xe_dev->hwconfig =xe_query_hwconfig_new (fd, &xe_dev->hwconfig_size); + xe_dev->config =xe_query_device (fd,DRM_XE_DEVICE_QUERY_CONFIG ,NULL ); + xe_dev->hwconfig =xe_query_device_may_fail (fd,DRM_XE_DEVICE_QUERY_HWCONFIG , &xe_dev->hwconfig_size); xe_dev->va_bits = xe_dev->config->info[DRM_XE_QUERY_CONFIG_VA_BITS ]; xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID ] &0xffff ; - xe_dev->gt_list =xe_query_gt_list_new (fd); + xe_dev->gt_list =xe_query_device (fd,DRM_XE_DEVICE_QUERY_GT_LIST ,NULL );/* GT IDs may be non-consecutive; keep a mask of valid IDs */ for (int gt =0 ; gt < xe_dev->gt_list->num_gt; gt++)
@@ -427,10 +253,10 @@ struct xe_device *xe_device_get(int fd) xe_dev->tile_mask |= (1ull << xe_dev->gt_list->gt_list[gt].tile_id); xe_dev->memory_regions =__memory_regions (xe_dev->gt_list); - xe_dev->engines =xe_query_engines (fd); - xe_dev->mem_regions =xe_query_mem_regions_new (fd); - xe_dev->eu_stall =xe_query_eu_stall_new (fd); - xe_dev->oa_units =xe_query_oa_units_new (fd); + xe_dev->engines =xe_query_device (fd,DRM_XE_DEVICE_QUERY_ENGINES ,NULL ); + xe_dev->mem_regions =xe_query_device (fd,DRM_XE_DEVICE_QUERY_MEM_REGIONS ,NULL ); + xe_dev->eu_stall =xe_query_device_may_fail (fd,DRM_XE_DEVICE_QUERY_EU_STALL ,NULL ); + xe_dev->oa_units =xe_query_device_may_fail (fd,DRM_XE_DEVICE_QUERY_OA_UNITS ,NULL );/* * vram_size[] and visible_vram_size[] are indexed by uapi ID; ensure
@@ -860,7 +686,7 @@ static void __available_vram_size_snapshot(int fd, int gt, struct __available_vr mem_region = &xe_dev->mem_regions->mem_regions[region_idx];if (XE_IS_CLASS_VRAM (mem_region)) { - mem_regions =xe_query_mem_regions_new (fd); + mem_regions =xe_query_device (fd,DRM_XE_DEVICE_QUERY_MEM_REGIONS ,NULL );pthread_mutex_lock (&cache.cache_mutex); mem_region->used = mem_regions->mem_regions[region_idx].used; mem_region->cpu_visible_used =
Signature · 1 line
2.43.0
PATCH v4 5/6 lib/xe/xe_query: introduce iterator for GT topology masks
In reply to Andrzej HajdaTopology masks returned by device query DRM_XE_DEVICE_QUERY_GT_TOPOLOGY are placed sequentially in one blob of memory, moreover every mask can have different size as they contains flexible arrays.
--- lib/xe/xe_query.h | 6 ++++++ 1 file changed, 6 insertions(+)
lib/xe/xe_query.h +6 -0
@@ -97,6 +97,12 @@ struct xe_device {#define XE_IS_CLASS_SYSMEM (__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_SYSMEM)#define XE_IS_CLASS_VRAM (__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_VRAM) +#define xe_for_each_topology_mask (__masks, __size, __mask) \ + for (__mask = (__masks); \ + (void *)__mask->mask - (void *)(__masks) < (__size) && \ + (void *)&__mask->mask[__mask->num_bytes] - (void *)(__masks) <= (__size); \ + __mask = (void *)&__mask->mask[__mask->num_bytes]) +/* * Max possible engine instance in drm_xe_engine_class_instance::engine_instance. Only * used to declare arrays of drm_xe_engine_class_instance
Signature · 1 line
2.43.0
PATCH v4 6/6 xe/treewide: use xe_query helpers for query GT topology
In reply to Andrzej HajdaUsing xe_query_device and xe_for_each_topology_mask simplifies the code.
--- lib/xe/xe_oa.c | 37 ++++++---------------- tests/intel/xe_eudebug_online.c | 30 +++--------------- tests/intel/xe_query.c | 69 ++++++++++------------------------------- 3 files changed, 30 insertions(+), 106 deletions(-)
lib/xe/xe_oa.c +9 -28
@@ -450,15 +450,9 @@ xe_fill_topology_info(int drm_fd, uint32_t device_id, uint32_t *topology_size)const struct intel_device_info *devinfo =intel_get_device_info (device_id);struct intel_xe_topology_info topinfo = {};struct intel_xe_topology_info *ptopo; -struct drm_xe_query_topology_mask *xe_topo; -int pos =0 ; +struct drm_xe_query_topology_mask *xe_topo, *topo; +uint32_t size;u8 *ptr; -struct drm_xe_device_query query = { - .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_GT_TOPOLOGY , - .size =0 , - .data =0 , - };/* Only ADL-P, DG2 and newer ip support hwconfig, use hardcoded values for previous */ if (intel_graphics_ver (device_id) >=IP_VER (12 ,55 ) || devinfo->is_alderlake_p) {
@@ -485,31 +479,21 @@ xe_fill_topology_info(int drm_fd, uint32_t device_id, uint32_t *topology_size) ptr = (u8 *)ptopo +sizeof (topinfo); *ptr++ =0x1 ;/* slice mask */ -/* Get xe topology masks */ -igt_assert_eq (igt_ioctl (drm_fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); -igt_assert_neq (query.size,0 ); - - xe_topo =malloc (query.size); -igt_assert (xe_topo); + xe_topo =xe_query_device (drm_fd,DRM_XE_DEVICE_QUERY_GT_TOPOLOGY , &size); +igt_debug ("Topology size: %d\n" , size); - query.data =to_user_pointer (xe_topo); -igt_assert_eq (igt_ioctl (drm_fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); -igt_debug ("Topology size: %d\n" , query.size); - -while (query.size >=sizeof (struct drm_xe_query_topology_mask )) { -struct drm_xe_query_topology_mask *topo = - (struct drm_xe_query_topology_mask *)((unsigned char *)xe_topo + pos); -int i, sz =sizeof (struct drm_xe_query_topology_mask ) + topo->num_bytes; +xe_for_each_topology_mask (xe_topo, size, topo) {u64 geom_mask, compute_mask; -igt_debug (" gt_id: %d type: %d n:%d [%d] " , topo->gt_id, topo->type, topo->num_bytes, sz); +igt_debug (" gt_id: %d type: %d n:%d [%zd] " , topo->gt_id, topo->type, topo->num_bytes, +sizeof (struct drm_xe_query_topology_mask ) + topo->num_bytes);for (int j=0 ; j< topo->num_bytes; j++)igt_debug (" %02x" , topo->mask[j]);igt_debug ("\n" );/* i915 only returns topology for gt 0, do the same here */ if (topo->gt_id) - goto next; +continue ;/* Follow the same order as in xe query_gt_topology() */ switch (topo->type) {
@@ -525,7 +509,7 @@ xe_fill_topology_info(int drm_fd, uint32_t device_id, uint32_t *topology_size)break ;case DRM_XE_TOPO_EU_PER_DSS :case DRM_XE_TOPO_SIMD16_EU_PER_DSS : -for (i =0 ; i < ptopo->max_subslices; i++) { +for (int i =0 ; i < ptopo->max_subslices; i++) {memcpy (ptr, topo->mask, ptopo->eu_stride); ptr += ptopo->eu_stride; }
@@ -535,9 +519,6 @@ xe_fill_topology_info(int drm_fd, uint32_t device_id, uint32_t *topology_size)default :igt_assert (0 ); } -next: - query.size -= sz; - pos += sz; }free (xe_topo);
tests/intel/xe_eudebug_online.c +4 -26
@@ -1184,36 +1184,14 @@ static int query_attention_bitmask_size(int fd, int gt) {uint32_t threads_per_eu =xe_hwconfig_get_u32 (fd,INTEL_HWCONFIG_NUM_THREADS_PER_EU ,8 );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 ;
tests/intel/xe_query.c +17 -52
103 lines not on this page · raw message
Signature · 1 line
2.43.0
Patchwork
CI✗ Fi.CI.BUILD: failure for lib/xe/xe_query: implement few query helpers (rev4)
In reply to Andrzej Hajda== Series Details ==
== Series Details ==
Series: lib/xe/xe_query: implement few query helpers (rev4)
URL : https://patchwork.freedesktop.org/series/157140/
State : failure
== Summary ==
Applying: lib/xe_query: add helper to get first value of hwconfig Using index info to reconstruct a base tree...
M lib/xe/xe_query.c
M lib/xe/xe_query.h
Falling back to patching base and 3-way merge...
Auto-merging lib/xe/xe_query.h
CONFLICT (content): Merge conflict in lib/xe/xe_query.h Auto-merging lib/xe/xe_query.c
CONFLICT (content): Merge conflict in lib/xe/xe_query.c
Patch failed at 0001 lib/xe_query: add helper to get first value of hwconfig When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".