uAPI Alignment - take 2
PATCH v3 43/57 xe: Get near_mem_region directly from engine_info.
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Start querying the engine_info instead of the eci.
The big advantage is that you get the near_mem_region directly instead of having to do yet another for_each_engine loop to get the right engine again.
Also, it is going to be useful as we get more information in the engine_info itself.
--- benchmarks/gem_wsim.c | 36 ++++--- lib/xe/xe_query.c | 33 ++---- lib/xe/xe_query.h | 4 +- lib/xe/xe_spin.c | 6 +- lib/xe/xe_spin.h | 2 +- tests/intel/xe_dma_buf_sync.c | 26 ++--- tests/intel/xe_evict.c | 46 ++++---- tests/intel/xe_exec_balancer.c | 39 ++++--- tests/intel/xe_exec_basic.c | 32 +++--- tests/intel/xe_exec_compute_mode.c | 26 ++--- tests/intel/xe_exec_fault_mode.c | 24 ++--- tests/intel/xe_exec_reset.c | 93 ++++++++-------- tests/intel/xe_exec_store.c | 4 +- tests/intel/xe_exec_threads.c | 38 ++++--- tests/intel/xe_guc_pc.c | 16 +-- tests/intel/xe_pm.c | 36 +++---- tests/intel/xe_pm_residency.c | 25 ++--- tests/intel/xe_vm.c | 168 ++++++++++++++--------------- 18 files changed, 335 insertions(+), 319 deletions(-)
benchmarks/gem_wsim.c +23 -13
@@ -214,6 +214,7 @@ struct xe_exec_queue {uint32_t id;unsigned int nr_ecis;struct drm_xe_engine_class_instance *eci_list; +uint32_t bo_placement; };struct ctx {
@@ -642,13 +643,14 @@ get_engine(enum intel_engine_id engine)return ci; } -static struct drm_xe_engine_class_instance -xe_get_engine (enum intel_engine_id engine) +static struct drm_xe_query_engine_info * +xe_get_engine (enum intel_engine_id engine_class) { +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci = {}, *eci1;bool found_physical = false; -switch (engine) { +switch (engine_class) {case RCS : eci.engine_class =DRM_XE_ENGINE_CLASS_RENDER ;break ;
@@ -669,17 +671,17 @@ xe_get_engine(enum intel_engine_id engine)igt_assert (0 ); }; -xe_for_each_engine_instance (fd, eci1) { +xe_for_each_engine (fd, engine) { + eci1 = &engine->instance;if (eci.engine_class == eci1->engine_class && eci.engine_instance == eci1->engine_instance) { - eci = *eci1; found_physical = true;break ; } }igt_assert (found_physical); -return eci; +return engine; } static struct drm_xe_engine_class_instance
@@ -1735,7 +1737,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)int i; w->bb_handle =xe_bo_create (fd, vm->id,PAGE_SIZE , -vram_near_eci_if_possible (fd, &eq->eci_list[0 ]), + eq->bo_placement,DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); w->xe.data =xe_bo_map (fd, w->bb_handle,PAGE_SIZE ); w->xe.exec.address =
@@ -2250,6 +2252,7 @@ static int prepare_contexts(unsigned int id, struct workload *wrk)static int xe_prepare_contexts (unsigned int id,struct workload *wrk) { +struct drm_xe_query_engine_info *engine;struct xe_exec_queue *eq;struct w_step *w;struct ctx *ctx;
@@ -2290,7 +2293,9 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk) eq->nr_ecis = ctx->engine_map_count; eq->eci_list =calloc (eq->nr_ecis,sizeof (*eq->eci_list));for (i =0 ; i < eq->nr_ecis; ++i) { - eq->eci_list[i] =xe_get_engine (ctx->engine_map[i]); + engine =xe_get_engine (ctx->engine_map[i]); + eq->eci_list[i] = engine->instance; + eq->bo_placement =vram_near_engine_if_possible (fd, engine);/* check no mixing classes and no duplicates */ for (int j =0 ; j < i; ++j) {
@@ -2339,12 +2344,17 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk) eq->nr_ecis =1 ; eq->eci_list =calloc (1 ,sizeof (*eq->eci_list)); -if (i ==DEFAULT ) +if (i ==DEFAULT ) { + engine =xe_engine (fd,0 ); eq->eci_list[0 ] =xe_get_default_engine (); -else if (i ==VCS ) - eq->eci_list[0 ] =xe_get_engine (VCS1 ); -else - eq->eci_list[0 ] =xe_get_engine (i); + }else if (i ==VCS ) { + engine =xe_get_engine (VCS1 ); + eq->eci_list[0 ] = engine->instance; + }else { + engine =xe_get_engine (i); + eq->eci_list[0 ] = engine->instance; + } + eq->bo_placement =vram_near_engine_if_possible (fd, engine);if (verbose >3 ) printf("%u ctx[%d] %s [%u:%u:%u]\n",
lib/xe/xe_query.c +10 -23
@@ -367,33 +367,20 @@ uint64_t any_vram(int fd) }/** -* vram_near_eci: +* vram_near_engine: * @fd: xe device fd -* @eci: engine class instance +* @engine: engine info * -* Returns memory bitmask for the vram region that is near the given @eci. +* Returns memory bitmask for the vram region that is near the given @engine. */ -uint64_t vram_near_eci (int fd,struct drm_xe_engine_class_instance *eci) +uint64_t vram_near_engine (int fd,struct drm_xe_query_engine_info *engine) {struct xe_device *xe_dev; -struct drm_xe_query_engine_info *engine; -struct drm_xe_engine_class_instance *eci1; - -if (!xe_has_vram (fd)) -return 0 ; xe_dev =find_in_cache (fd);igt_assert (xe_dev); -xe_for_each_engine (fd, engine) { - eci1 = &engine->instance; -if (eci1->engine_class == eci->engine_class && - eci1->engine_instance == eci->engine_instance && - eci1->gt_id == eci->gt_id) -return mem_region_near_engine (engine); - } - -return 0 ; +return xe_has_vram (fd) ?mem_region_near_engine (engine) :0 ; }/**
@@ -410,17 +397,17 @@ uint64_t any_vram_if_possible(int fd) }/** -* vram_near_eci_if_possible: +* vram_near_engine_if_possible: * @fd: xe device fd -* @eci: engine class instance +* @engine: engine info * * Returns a memory region bitmask. If possible, it returns a bitmask for a -* vram region near the given @eci. Otherwise it returns a bitmask for a +* vram region near the given @engine. Otherwise it returns a bitmask for a * system memory region. */ -uint64_t vram_near_eci_if_possible (int fd,struct drm_xe_engine_class_instance *eci) +uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_query_engine_info *engine) { -return vram_near_eci (fd, eci) ?:system_memory (fd); +return vram_near_engine (fd, engine) ?:system_memory (fd); }/**
lib/xe/xe_query.h +2 -2
@@ -77,9 +77,9 @@ unsigned int xe_number_gt(int fd);uint64_t all_memory_regions (int fd);uint64_t system_memory (int fd);uint64_t any_vram (int fd); -uint64_t vram_near_eci (int fd,struct drm_xe_engine_class_instance *eci); +uint64_t vram_near_engine (int fd,struct drm_xe_query_engine_info *engine);uint64_t any_vram_if_possible (int fd); -uint64_t vram_near_eci_if_possible (int fd,struct drm_xe_engine_class_instance *eci); +uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_query_engine_info *engine);struct drm_xe_query_engine_info *xe_engines (int fd);struct drm_xe_query_engine_info *xe_engine (int fd,int idx);struct drm_xe_query_mem_region *xe_mem_region (int fd,uint64_t region);
lib/xe/xe_spin.c +3 -3
@@ -282,7 +282,7 @@ void xe_spin_free(int fd, struct igt_spin *spin)free (spin); } -void xe_cork_init (int fd,struct drm_xe_engine_class_instance *eci, +void xe_cork_init (int fd,struct drm_xe_query_engine_info *engine,struct xe_cork *cork) {uint64_t addr =xe_get_default_alignment (fd);
@@ -301,13 +301,13 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *eci, vm =xe_vm_create (fd,0 ,0 ); - bo =xe_bo_create (fd, vm, bo_size,vram_near_eci_if_possible (fd, eci), + bo =xe_bo_create (fd, vm, bo_size,vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); spin =xe_bo_map (fd, bo,0x1000 );xe_vm_bind_sync (fd, vm, bo,0 , addr, bo_size); - exec_queue =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queue =xe_exec_queue_create (fd, vm, &engine->instance,0 ); syncobj =syncobj_create (fd,0 ); xe_spin_init_opts(spin, .addr = addr, .preempt = true);
lib/xe/xe_spin.h +1 -1
@@ -62,7 +62,7 @@ struct xe_cork {uint32_t syncobj; }; -void xe_cork_init (int fd,struct drm_xe_engine_class_instance *eci, +void xe_cork_init (int fd,struct drm_xe_query_engine_info *engine,struct xe_cork *cork);bool xe_cork_started (struct xe_cork *cork);void xe_cork_wait_started (struct xe_cork *cork);
tests/intel/xe_dma_buf_sync.c +14 -12
@@ -87,10 +87,12 @@ static bool sync_file_busy(int sync_file)*/ static void -test_export_dma_buf (struct drm_xe_engine_class_instance *eci0, -struct drm_xe_engine_class_instance *eci1, +test_export_dma_buf (struct drm_xe_query_engine_info *engine0, +struct drm_xe_query_engine_info *engine1,int n_bo,int flags) { +struct drm_xe_engine_class_instance *eci0 = &engine0->instance; +struct drm_xe_engine_class_instance *eci1 = &engine1->instance;uint64_t addr =0x1a0000 , base_addr =0x1a0000 ;int fd[N_FD ];uint32_t bo[MAX_N_BO ];
@@ -120,7 +122,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *eci0, xe_get_default_alignment(fd[0]));for (i =0 ; i < n_bo; ++i) { bo[i] =xe_bo_create (fd[0 ],0 , bo_size, -vram_near_eci_if_possible (fd[0 ], eci0), +vram_near_engine_if_possible (fd[0 ], engine0),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); dma_buf_fd[i] =prime_handle_to_fd (fd[0 ], bo[i]); import_bo[i] =prime_fd_to_handle (fd[1 ], dma_buf_fd[i]);
@@ -224,32 +226,32 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *eci0, igt_main { -struct drm_xe_engine_class_instance *eci, *eci0 =NULL , *eci1; +struct drm_xe_query_engine_info *engine, *engine0 =NULL , *engine1;int fd; igt_fixture { fd =drm_open_driver (DRIVER_XE ); -xe_for_each_engine_instance (fd, eci) -if (eci0 ==NULL ) { - eci0 = eci; +xe_for_each_engine (fd, engine) +if (engine0 ==NULL ) { + engine0 = engine; }else { - eci1 = eci; + engine1 = engine;break ; } } igt_subtest("export-dma-buf-once") -test_export_dma_buf (eci0, eci1,1 ,0 ); +test_export_dma_buf (engine0, engine1,1 ,0 ); igt_subtest("export-dma-buf-many") -test_export_dma_buf (eci0, eci1,16 ,0 ); +test_export_dma_buf (engine0, engine1,16 ,0 ); igt_subtest("export-dma-buf-once-read-sync") -test_export_dma_buf (eci0, eci1,1 ,READ_SYNC ); +test_export_dma_buf (engine0, engine1,1 ,READ_SYNC ); igt_subtest("export-dma-buf-many-read-sync") -test_export_dma_buf (eci0, eci1,16 ,READ_SYNC ); +test_export_dma_buf (engine0, engine1,16 ,READ_SYNC );igt_fixture drm_close_driver (fd );
tests/intel/xe_evict.c +23 -23
155 lines not on this page · raw message
tests/intel/xe_exec_balancer.c +24 -15
@@ -51,19 +51,22 @@ static void test_all_active(int fd, int gt, int class)uint32_t syncobjs[MAX_INSTANCE ];size_t bo_size;uint32_t bo =0 ; +uint32_t bo_placement;struct {struct xe_spin spin; } *data;struct xe_spin_opts spin_opts = { .preempt = false }; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, num_placements =0 ; -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->instance.gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_placements++] = engine->instance; + bo_placement =vram_near_engine_if_possible (fd, engine); }if (num_placements <2 )return ;
@@ -72,7 +75,7 @@ static void test_all_active(int fd, int gt, int class) bo_size =sizeof (*data) * num_placements; bo_size =ALIGN (bo_size +xe_cs_prefetch_size (fd),xe_get_default_alignment (fd)); - bo =xe_bo_create (fd, vm, bo_size,vram_near_eci_if_possible (fd, &eci_list[0 ]), + bo =xe_bo_create (fd, vm, bo_size, bo_placement,DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size);
@@ -192,22 +195,25 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,uint32_t syncobjs[MAX_N_EXEC_QUEUES ];size_t bo_size;uint32_t bo =0 ; +uint32_t bo_placement;struct {uint32_t batch[16 ];uint64_t pad;uint32_t data; } *data; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_placements =0 ;igt_assert (n_exec_queues <=MAX_N_EXEC_QUEUES ); -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->instance.gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_placements++] = engine->instance; + bo_placement =vram_near_engine_if_possible (fd, engine); }if (num_placements <2 )return ;
@@ -229,7 +235,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs, }memset (data,0 , bo_size); }else { - bo =xe_bo_create (fd, vm, bo_size,vram_near_eci_if_possible (fd, &eci_list[0 ]), + bo =xe_bo_create (fd, vm, bo_size, bo_placement,DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }
@@ -417,6 +423,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,uint32_t exec_queues[MAX_N_EXEC_QUEUES ];size_t bo_size;uint32_t bo =0 ; +uint32_t bo_placement;struct {uint32_t batch[16 ];uint64_t pad;
@@ -424,18 +431,20 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,uint64_t exec_sync;uint32_t data; } *data; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_placements =0 ;int map_fd =-1 ;igt_assert (n_exec_queues <=MAX_N_EXEC_QUEUES ); -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->instance.gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_placements++] = engine->instance; + bo_placement =vram_near_engine_if_possible (fd, engine); }if (num_placements <2 )return ;
@@ -459,7 +468,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,igt_assert (data); } }else { - bo =xe_bo_create (fd, vm, bo_size,vram_near_eci_if_possible (fd, &eci_list[0 ]), + bo =xe_bo_create (fd, vm, bo_size, bo_placement,DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }
tests/intel/xe_exec_basic.c +16 -16
@@ -77,7 +77,7 @@*/ static void -test_exec (int fd,struct drm_xe_engine_class_instance *eci, +test_exec (int fd,struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs,int n_vm,unsigned int flags) {struct drm_xe_sync sync[2 ] = {
@@ -143,7 +143,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, bo_flags |=DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING ; bo =xe_bo_create (fd, n_vm ==1 ? vm[0 ] :0 , bo_size, -vram_near_eci_if_possible (fd, eci), bo_flags); +vram_near_engine_if_possible (fd, engine), bo_flags);if (!(flags &DEFER_BIND )) data =xe_bo_map (fd, bo, bo_size); }
@@ -151,7 +151,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,for (i =0 ; i < n_exec_queues; i++) {uint32_t __vm = vm[i % n_vm]; - exec_queues[i] =xe_exec_queue_create (fd, __vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, __vm, &engine->instance,0 );if (flags &BIND_EXEC_QUEUE ) bind_exec_queues[i] = xe_bind_exec_queue_create(fd, __vm, 0,
@@ -304,7 +304,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine; const struct section { const char *name; unsigned int flags;
@@ -338,37 +338,37 @@ igt_mainfor (const struct section *s = sections; s->name; s++) { igt_subtest_f("once-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,1 ,1 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,1 ,1 , s->flags); igt_subtest_f("twice-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,2 ,1 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,2 ,1 , s->flags); igt_subtest_f("many-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 , s->flags & (REBIND |INVALIDATE ) ?64 :1024 ,1 , s->flags); igt_subtest_f("many-execqueues-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,16 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,16 , s->flags & (REBIND |INVALIDATE ) ?64 :1024 ,1 , s->flags); igt_subtest_f("many-execqueues-many-vm-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,16 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,16 , s->flags & (REBIND |INVALIDATE ) ?64 :1024 ,16 , s->flags); igt_subtest_f("no-exec-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,0 ,1 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,0 ,1 , s->flags); } igt_fixture
tests/intel/xe_exec_compute_mode.c +13 -13
@@ -81,7 +81,7 @@* @bindexecqueue-userptr-invalidate: bindexecqueue userptr invalidate */ static void -test_exec (int fd,struct drm_xe_engine_class_instance *eci, +test_exec (int fd,struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs,unsigned int flags) {uint32_t vm;
@@ -121,7 +121,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, xe_get_default_alignment(fd));for (i =0 ; (flags &EXEC_QUEUE_EARLY ) && i < n_exec_queues; i++) { - exec_queues[i] =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance,0 );if (flags &BIND_EXECQUEUE ) bind_exec_queues[i] =xe_bind_exec_queue_create (fd, vm,0 , true);
@@ -143,14 +143,14 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, } }else { bo =xe_bo_create (fd, flags &VM_FOR_BO ? vm :0 , - bo_size,vram_near_eci_if_possible (fd, eci), + bo_size,vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }memset (data,0 , bo_size);for (i =0 ; !(flags &EXEC_QUEUE_EARLY ) && i < n_exec_queues; i++) { - exec_queues[i] =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance,0 );if (flags &BIND_EXECQUEUE ) bind_exec_queues[i] =xe_bind_exec_queue_create (fd, vm,0 , true);
@@ -292,7 +292,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine; const struct section { const char *name; unsigned int flags;
@@ -322,16 +322,16 @@ igt_mainfor (const struct section *s = sections; s->name; s++) { igt_subtest_f("once-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,1 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,1 , s->flags); igt_subtest_f("twice-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,2 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,2 , s->flags); igt_subtest_f("many-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 , s->flags & (REBIND |INVALIDATE ) ?64 :128 , s->flags);
@@ -340,8 +340,8 @@ igt_maincontinue ; igt_subtest_f("many-execqueues-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,16 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,16 , s->flags & (REBIND |INVALIDATE ) ?64 :128 , s->flags);
tests/intel/xe_exec_fault_mode.c +12 -12
@@ -100,7 +100,7 @@*/ static void -test_exec (int fd,struct drm_xe_engine_class_instance *eci, +test_exec (int fd,struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs,unsigned int flags) {uint32_t vm;
@@ -158,14 +158,14 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM); else bo =xe_bo_create (fd,0 , bo_size, -vram_near_eci_if_possible (fd, eci), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }memset (data,0 , bo_size);for (i =0 ; i < n_exec_queues; i++) { - exec_queues[i] =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance,0 );if (flags &BIND_EXEC_QUEUE ) bind_exec_queues[i] =xe_bind_exec_queue_create (fd, vm,0 , true);
@@ -322,7 +322,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci, igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine; const struct section { const char *name; unsigned int flags;
@@ -387,23 +387,23 @@ igt_mainfor (const struct section *s = sections; s->name; s++) { igt_subtest_f("once-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,1 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,1 , s->flags); igt_subtest_f("twice-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 ,2 , s->flags); +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 ,2 , s->flags); igt_subtest_f("many-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,1 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,1 , s->flags & (REBIND |INVALIDATE ) ?64 :128 , s->flags); igt_subtest_f("many-execqueues-%s", s->name) -xe_for_each_engine_instance (fd, eci) -test_exec (fd, eci,16 , +xe_for_each_engine (fd, engine) +test_exec (fd, engine,16 , s->flags & (REBIND |INVALIDATE ) ?64 :128 , s->flags);
tests/intel/xe_exec_reset.c +48 -45
221 lines not on this page · raw message
tests/intel/xe_exec_store.c +2 -2
@@ -83,7 +83,7 @@ static void store(int fd) engine =xe_engine (fd,1 ); bo =xe_bo_create (fd, vm, bo_size, -vram_near_eci_if_possible (fd, &engine->instance), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM );xe_vm_bind_async (fd, vm, engine->instance.gt_id, bo,0 , addr, bo_size, &sync,1 );
@@ -155,7 +155,7 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,for (i =0 ; i < count; i++) { bo[i] =xe_bo_create (fd, vm, bo_size, -vram_near_eci_if_possible (fd, eci), +vram_near_engine_if_possible (fd, eci),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); bo_map[i] =xe_bo_map (fd, bo[i], bo_size); dst_offset[i] = intel_allocator_alloc_with_strategy(ahnd, bo[i],
tests/intel/xe_exec_threads.c +21 -17
@@ -61,12 +61,13 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,uint32_t syncobjs[MAX_N_EXEC_QUEUES ];size_t bo_size;uint32_t bo =0 ; +uint32_t bo_placement;struct {uint32_t batch[16 ];uint64_t pad;uint32_t data; } *data; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_placements =0 ;bool owns_vm = false, owns_fd = false;
@@ -83,11 +84,13 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, owns_vm = true; } -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->instance.gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_placements++] = engine->instance; + bo_placement =vram_near_engine_if_possible (fd, engine); }igt_assert (num_placements >1 );
@@ -109,7 +112,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, } }else { bo =xe_bo_create (fd, vm, bo_size, -vram_near_eci_if_possible (fd, &eci_list[0 ]), + bo_placement,DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }
@@ -252,7 +255,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,static void test_compute_mode (int fd,uint32_t vm,uint64_t addr,uint64_t userptr, -struct drm_xe_engine_class_instance *eci, +struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs,unsigned int flags) {#define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
@@ -312,14 +315,14 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, } }else { bo =xe_bo_create (fd,0 , bo_size, -vram_near_eci_if_possible (fd, eci), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }memset (data,0 , bo_size);for (i =0 ; i < n_exec_queues; i++) - exec_queues[i] =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance,0 );pthread_barrier_wait (&barrier);
@@ -458,7 +461,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,static void test_legacy_mode (int fd,uint32_t vm,uint64_t addr,uint64_t userptr, -struct drm_xe_engine_class_instance *eci,int n_exec_queues, +struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs,unsigned int flags) {struct drm_xe_sync sync[2 ] = {
@@ -518,7 +521,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, } }else { bo =xe_bo_create (fd, vm, bo_size, -vram_near_eci_if_possible (fd, eci), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); }
@@ -535,9 +538,9 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,uint64_t ext =to_user_pointer (&preempt_timeout);if (flags &HANG && i == hang_exec_queue) - exec_queues[i] =xe_exec_queue_create (fd, vm, eci, ext); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance, ext);else - exec_queues[i] =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance,0 );if (flags &BIND_EXEC_QUEUE ) bind_exec_queues[i] =xe_bind_exec_queue_create (fd, vm,0 , true);
@@ -703,7 +706,7 @@ struct thread_data {int gt;uint32_t vm_legacy_mode;uint32_t vm_compute_mode; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;int n_exec_queue;int n_exec;int flags;
@@ -725,11 +728,11 @@ static void *thread(void *data) t->flags); else if (t->flags & COMPUTE_MODE) test_compute_mode(t->fd, t->vm_compute_mode, t->addr, - t->userptr, t->eci, t->n_exec_queue, t->n_exec, + t->userptr, t->engine, t->n_exec_queue, t->n_exec, t->flags); else test_legacy_mode(t->fd, t->vm_legacy_mode, t->addr, t->userptr, - t->eci, t->n_exec_queue, t->n_exec, + t->engine, t->n_exec_queue, t->n_exec, t->flags);return NULL ;
@@ -969,6 +972,7 @@ static void *thread(void *data)static void threads (int fd,int flags) {struct thread_data *threads_data; +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance *eci;uint64_t addr =0x1a0000 ;uint64_t userptr =0x00007000eadbe000 ;
@@ -1017,7 +1021,7 @@ static void threads(int fd, int flags) 0); } -xe_for_each_engine_instance (fd, eci) { +xe_for_each_engine (fd, engine) { threads_data[i].mutex = &mutex; threads_data[i].cond = &cond;#define ADDRESS_SHIFT 39
@@ -1029,7 +1033,7 @@ static void threads(int fd, int flags) threads_data[i].fd = fd; threads_data[i].vm_legacy_mode = vm_legacy_mode; threads_data[i].vm_compute_mode = vm_compute_mode; - threads_data[i].eci = eci; + threads_data[i].engine = engine;#define N_EXEC_QUEUE 16 threads_data[i].n_exec_queue =N_EXEC_QUEUE ;#define N_EXEC 1024
tests/intel/xe_guc_pc.c +8 -8
@@ -31,7 +31,7 @@*/ #define ACT_FREQ_LATENCY_US 100000 -static void exec_basic (int fd,struct drm_xe_engine_class_instance *eci, +static void exec_basic (int fd,struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs) {uint32_t vm;
@@ -68,12 +68,12 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci, xe_get_default_alignment(fd)); bo =xe_bo_create (fd, vm, bo_size, -vram_near_eci_if_possible (fd, eci), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size);for (i =0 ; i < n_exec_queues; i++) { - exec_queues[i] =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (fd, vm, &engine->instance,0 ); bind_exec_queues[i] =0 ; syncobjs[i] =syncobj_create (fd,0 ); };
@@ -387,7 +387,7 @@ static void test_reset(int fd, int gt_id, int cycles) igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;int fd;int gt;int ncpus =sysconf (_SC_NPROCESSORS_ONLN);
@@ -417,10 +417,10 @@ igt_main igt_subtest("freq_fixed_exec") {xe_for_each_gt (fd, gt) { -xe_for_each_engine_instance (fd, eci) +xe_for_each_engine (fd, engine) igt_fork(child, ncpus) {igt_debug ("Execution Started\n" ); -exec_basic (fd, eci,MAX_N_EXEC_QUEUES ,16 ); +exec_basic (fd, engine,MAX_N_EXEC_QUEUES ,16 );igt_debug ("Execution Finished\n" ); }/* While exec in threads above, let's check the freq */
@@ -439,10 +439,10 @@ igt_main igt_subtest("freq_range_exec") {xe_for_each_gt (fd, gt) { -xe_for_each_engine_instance (fd, eci) +xe_for_each_engine (fd, engine) igt_fork(child, ncpus) {igt_debug ("Execution Started\n" ); -exec_basic (fd, eci,MAX_N_EXEC_QUEUES ,16 ); +exec_basic (fd, engine,MAX_N_EXEC_QUEUES ,16 );igt_debug ("Execution Finished\n" ); }/* While exec in threads above, let's check the freq */
tests/intel/xe_pm.c +18 -18
@@ -224,7 +224,7 @@ static bool out_of_d3(device_t device, enum igt_acpi_d_state state)*/ static void -test_exec (device_t device,struct drm_xe_engine_class_instance *eci, +test_exec (device_t device,struct drm_xe_query_engine_info *engine,int n_exec_queues,int n_execs,enum igt_suspend_state s_state,enum igt_acpi_d_state d_state) {
@@ -274,12 +274,12 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci, rpm_usage =igt_pm_get_runtime_usage (device.pci_xe); bo =xe_bo_create (device.fd_xe, vm, bo_size, -vram_near_eci_if_possible (device.fd_xe, eci), +vram_near_engine_if_possible (device.fd_xe, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (device.fd_xe, bo, bo_size);for (i =0 ; i < n_exec_queues; i++) { - exec_queues[i] =xe_exec_queue_create (device.fd_xe, vm, eci,0 ); + exec_queues[i] =xe_exec_queue_create (device.fd_xe, vm, &engine->instance,0 ); bind_exec_queues[i] =0 ; syncobjs[i] =syncobj_create (device.fd_xe,0 ); };
@@ -442,7 +442,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd) igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;device_t device;uint32_t d3cold_allowed;int sysfs_fd;
@@ -473,8 +473,8 @@ igt_mainigt_device_get_pci_slot_name (device.fd_xe, device.pci_slot_name);/* Always perform initial once-basic exec checking for health */ -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,1 ,1 ,NO_SUSPEND ,NO_RPM ); +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,1 ,1 ,NO_SUSPEND ,NO_RPM );igt_pm_get_d3cold_allowed (device.pci_slot_name, &d3cold_allowed);igt_assert (igt_setup_runtime_pm (device.fd_xe));
@@ -488,30 +488,30 @@ igt_main } igt_subtest_f("%s-basic-exec", s->name) { -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,1 ,2 , s->state, +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,1 ,2 , s->state,NO_RPM ); } igt_subtest_f("%s-exec-after", s->name) {igt_system_suspend_autoresume (s->state,SUSPEND_TEST_NONE ); -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,1 ,2 ,NO_SUSPEND , +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,1 ,2 ,NO_SUSPEND ,NO_RPM ); } igt_subtest_f("%s-multiple-execs", s->name) { -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,16 ,32 , s->state, +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,16 ,32 , s->state,NO_RPM ); }for (const struct d_state *d = d_states; d->name; d++) { igt_subtest_f("%s-%s-basic-exec", s->name, d->name) {igt_assert (setup_d3 (device, d->state)); -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,1 ,2 , s->state, +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,1 ,2 , s->state,NO_RPM ); } }
@@ -525,15 +525,15 @@ igt_main igt_subtest_f("%s-basic-exec", d->name) {igt_assert (setup_d3 (device, d->state)); -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,1 ,1 , +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,1 ,1 ,NO_SUSPEND , d->state); } igt_subtest_f("%s-multiple-execs", d->name) {igt_assert (setup_d3 (device, d->state)); -xe_for_each_engine_instance (device.fd_xe, eci) -test_exec (device, eci,16 ,32 , +xe_for_each_engine (device.fd_xe, engine) +test_exec (device, engine,16 ,32 ,NO_SUSPEND , d->state); } }
tests/intel/xe_pm_residency.c +13 -12
@@ -72,7 +72,7 @@ static void close_fw_handle(int sig)close (fw_handle); } -static void exec_load (int fd,struct drm_xe_engine_class_instance *eci,unsigned long *done) +static void exec_load (int fd,struct drm_xe_query_engine_info *engine,unsigned long *done) {uint32_t bo =0 ;uint32_t exec_queue, syncobj, vm;
@@ -98,11 +98,11 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *eci, unsigned }; vm =xe_vm_create (fd,0 ,0 ); - exec_queue =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queue =xe_exec_queue_create (fd, vm, &engine->instance,0 ); bo_size =xe_get_default_alignment (fd); bo =xe_bo_create (fd, vm, bo_size, -vram_near_eci_if_possible (fd, eci), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); data =xe_bo_map (fd, bo, bo_size); syncobj =syncobj_create (fd,0 );
@@ -226,7 +226,7 @@ static void test_idle_residency(int fd, int gt, enum test_type flag)assert_within_epsilon (residency_end - residency_start, elapsed_ms, tolerance); } -static void idle_residency_on_exec (int fd,struct drm_xe_engine_class_instance *eci) +static void idle_residency_on_exec (int fd,struct drm_xe_query_engine_info *engine) {const int tol =20 ;unsigned long *done;
@@ -234,18 +234,19 @@ static void idle_residency_on_exec(int fd, struct drm_xe_engine_class_instance *unsigned long elapsed_ms, residency_end, residency_start;igt_debug ("Running on %s:%d\n" , -xe_engine_class_string (eci->engine_class), eci->engine_instance); +xe_engine_class_string (engine->instance.engine_class), + engine->instance.engine_instance); done =mmap (0 ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 );igt_assert (done !=MAP_FAILED );memset (done,0 ,4096 ); igt_fork(child, 1) -exec_load (fd, eci, done); +exec_load (fd, engine, done); start =READ_ONCE (done[1 ]); - residency_start =read_idle_residency (fd, eci->gt_id); + residency_start =read_idle_residency (fd, engine->instance.gt_id); elapsed_ms =measured_usleep (SLEEP_DURATION *USEC_PER_SEC ) /1000 ; - residency_end =read_idle_residency (fd, eci->gt_id); + residency_end =read_idle_residency (fd, engine->instance.gt_id); end =READ_ONCE (done[1 ]); *done =1 ;
@@ -313,7 +314,7 @@ igt_mainuint32_t d3cold_allowed;int fd, gt;char pci_slot_name[NAME_MAX ]; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine; igt_fixture { fd =drm_open_driver (DRIVER_XE );
@@ -347,9 +348,9 @@ igt_mainigt_describe ("Validate idle residency on exec" ); igt_subtest("idle-residency-on-exec") {xe_for_each_gt (fd, gt) { -xe_for_each_engine_instance (fd, eci) { -if (gt == eci->gt_id && !eci->engine_instance) -idle_residency_on_exec (fd, eci); +xe_for_each_engine (fd, engine) { +if (gt == engine->instance.gt_id && !engine->instance.engine_instance) +idle_residency_on_exec (fd, engine); } } }
tests/intel/xe_vm.c +84 -84
442 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 44/57 drm-uapi/xe: Document the memory_region bitmask
In reply to Francois DugastAlign with kernel commit ("drm/xe/uapi: Document the memory_region bitmask")
--- include/drm-uapi/xe_drm.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
include/drm-uapi/xe_drm.h +18 -5
@@ -231,6 +231,10 @@ struct drm_xe_query_engine_info {/** * @near_mem_regions: Bit mask of instances from * drm_xe_query_mem_regions that is near this engine. +* Each index in this mask refers directly to the struct +* drm_xe_query_mem_regions' instance, no assumptions should +* be made about order. The type of each region is described +* by struct drm_xe_query_mem_regions' mem_class. */ __u64 near_mem_regions;/**
@@ -239,6 +243,10 @@ struct drm_xe_query_engine_info {* In general, it has extra indirections when compared to the * @near_mem_regions. For a discrete device this could mean system * memory and memory living in a different Tile. +* Each index in this mask refers directly to the struct +* drm_xe_query_mem_regions' instance, no assumptions should +* be made about order. The type of each region is described +* by struct drm_xe_query_mem_regions' mem_class. */ __u64 far_mem_regions;
@@ -272,10 +280,9 @@ struct drm_xe_query_mem_region {*/ __u16 mem_class;/** -* @instance: The instance for this region. -* -* The @mem_class and @instance taken together will always give -* a unique pair. +* @instance: The unique ID for this region, which serves as the +* index in the placement bitmask used as argument for +* &DRM_IOCTL_XE_GEM_CREATE */ __u16 instance;/** @pad: MBZ */
@@ -695,7 +702,13 @@ struct drm_xe_gem_create {*/ __u64 size; -/** @placement: A mask of memory instances of where GEM can be placed. */ +/** +* @placement: A mask of memory instances of where GEM can be placed. +* Each index in this mask refers directly to the struct +* drm_xe_query_mem_regions' instance, no assumptions should +* be made about order. The type of each region is described +* by struct drm_xe_query_mem_regions' mem_class. +*/ __u32 placement;#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (1 << 0)
Signature · 1 line
2.34.1
PATCH v3 45/57 drm-uapi/xe: Be more specific about vm_bind prefetch region
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Be more specific about the vm_bind prefetch region")
--- include/drm-uapi/xe_drm.h | 8 ++++++-- lib/intel_batchbuffer.c | 4 ++-- lib/xe/xe_ioctl.c | 8 ++++---- lib/xe/xe_ioctl.h | 2 +- lib/xe/xe_util.c | 2 +- tests/intel/xe_vm.c | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-)
include/drm-uapi/xe_drm.h +6 -2
@@ -873,8 +873,12 @@ struct drm_xe_vm_bind_op {/** @flags: Bind flags */ __u32 flags; -/** @region: Memory region to prefetch VMA to, instance not a mask */ -__u32 region; +/** +* @prefetch_mem_region_instance: Memory region to prefetch VMA to. +* It is a region instance, not a mask. +* To be used only with %DRM_XE_VM_BIND_OP_PREFETCH operation. +*/ +__u32 prefetch_mem_region_instance;/** @reserved: Reserved */ __u64 reserved[2 ];
lib/intel_batchbuffer.c +2 -2
@@ -1283,7 +1283,7 @@ void intel_bb_destroy(struct intel_bb *ibb)static struct drm_xe_vm_bind_op *xe_alloc_bind_ops (struct intel_bb *ibb,uint32_t op,uint32_t flags, -uint32_t region) +uint32_t prefetch_region) {struct drm_i915_gem_exec_object2 **objects = ibb->objects;struct drm_xe_vm_bind_op *bind_ops, *ops;
@@ -1304,7 +1304,7 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct intel_bb *ibb, ops->obj_offset =0 ; ops->addr = objects[i]->offset; ops->range = objects[i]->rsvd1; - ops->region = region; + ops->prefetch_mem_region_instance = prefetch_region;igt_debug (" [%d]: handle: %u, offset: %llx, size: %llx\n" , i, ops->obj, (long long )ops->addr, (long long )ops->range);
lib/xe/xe_ioctl.c +4 -4
@@ -92,7 +92,7 @@ void xe_vm_bind_array(int fd, uint32_t vm, uint32_t exec_queue,int __xe_vm_bind (int fd,uint32_t vm,uint32_t exec_queue,uint32_t bo,uint64_t offset,uint64_t addr,uint64_t size,uint32_t op,uint32_t flags,struct drm_xe_sync *sync,uint32_t num_syncs, -uint32_t region,uint64_t ext) +uint32_t prefetch_region,uint64_t ext) {struct drm_xe_vm_bind bind = { .extensions = ext,
@@ -104,7 +104,7 @@ int __xe_vm_bind(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo, .bind.addr = addr, .bind.op = op, .bind.flags = flags, - .bind.region = region, + .bind.prefetch_mem_region_instance = prefetch_region, .num_syncs = num_syncs, .syncs = (uintptr_t)sync, .exec_queue_id = exec_queue,
@@ -119,10 +119,10 @@ int __xe_vm_bind(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,void __xe_vm_bind_assert (int fd,uint32_t vm,uint32_t exec_queue,uint32_t bo,uint64_t offset,uint64_t addr,uint64_t size,uint32_t op,uint32_t flags,struct drm_xe_sync *sync, -uint32_t num_syncs,uint32_t region,uint64_t ext) +uint32_t num_syncs,uint32_t prefetch_region,uint64_t ext) {igt_assert_eq (__xe_vm_bind (fd, vm, exec_queue, bo, offset, addr, size, - op, flags, sync, num_syncs, region, ext),0 ); + op, flags, sync, num_syncs, prefetch_region, ext),0 ); } void xe_vm_bind(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
lib/xe/xe_ioctl.h +1 -1
@@ -24,7 +24,7 @@ int __xe_vm_bind(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,void __xe_vm_bind_assert (int fd,uint32_t vm,uint32_t exec_queue,uint32_t bo,uint64_t offset,uint64_t addr,uint64_t size,uint32_t op,uint32_t flags,struct drm_xe_sync *sync, -uint32_t num_syncs,uint32_t region,uint64_t ext); +uint32_t num_syncs,uint32_t prefetch_region,uint64_t ext);void xe_vm_bind (int fd,uint32_t vm,uint32_t bo,uint64_t offset,uint64_t addr,uint64_t size,struct drm_xe_sync *sync,uint32_t num_syncs);
lib/xe/xe_util.c +1 -1
@@ -147,7 +147,7 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct igt_list_head *obj_lis ops->obj_offset =0 ; ops->addr = obj->offset; ops->range = obj->size; - ops->region =0 ; + ops->prefetch_mem_region_instance =0 ; bind_info(" [%d]: [%6s] handle: %u, offset: %llx, size: %llx\n", i, obj->bind_op == XE_OBJECT_BIND ? "BIND" : "UNBIND",
tests/intel/xe_vm.c +1 -1
@@ -807,7 +807,7 @@ test_bind_array(int fd, struct drm_xe_query_engine_info *engine, int n_execs, bind_ops[i].tile_mask =0x1 << engine->instance.gt_id; bind_ops[i].op =DRM_XE_VM_BIND_OP_MAP ; bind_ops[i].flags =DRM_XE_VM_BIND_FLAG_ASYNC ; - bind_ops[i].region =0 ; + bind_ops[i].prefetch_mem_region_instance =0 ; bind_ops[i].reserved[0 ] =0 ; bind_ops[i].reserved[1 ] =0 ;
Signature · 1 line
2.34.1
PATCH v3 46/57 drm-uapi/xe: Convert tile_mask to a pt_placement_hint
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Convert tile_mask to a pt_placement_hint")
--- include/drm-uapi/xe_drm.h | 16 +++++++++++++--- tests/intel/xe_vm.c | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-)
include/drm-uapi/xe_drm.h +13 -3
@@ -853,10 +853,20 @@ struct drm_xe_vm_bind_op {__u64 addr;/** -* @tile_mask: Mask for which tiles to create binds for, 0 == All tiles, -* only applies to creating new VMAs +* @pt_placement_hint: An optional memory_region bit-mask hint, which +* only applies when creating new VMAs. Default value '0' is the +* recommended value. +* +* It hints the optimal placement for the page-table tree for this VMA. +* For instance, when userspace is using engines living in a secondary +* tile with allocated BOs near those engines, that same +* @near_mem_region could be used in this hint field. +* +* Since it is a hint, the Xe kernel driver is free to ignore this mask +* and choose the best location for the page-table, taking into +* consideration the running hardware and runtime constrains. */ -__u64 tile_mask; +__u64 pt_placement_hint;#define DRM_XE_VM_BIND_OP_MAP 0x0#define DRM_XE_VM_BIND_OP_UNMAP 0x1
tests/intel/xe_vm.c +1 -1
@@ -804,7 +804,7 @@ test_bind_array(int fd, struct drm_xe_query_engine_info *engine, int n_execs, bind_ops[i].obj_offset =0 ; bind_ops[i].range = bo_size; bind_ops[i].addr = addr; - bind_ops[i].tile_mask =0x1 << engine->instance.gt_id; + bind_ops[i].pt_placement_hint =vram_near_engine_if_possible (fd, engine); bind_ops[i].op =DRM_XE_VM_BIND_OP_MAP ; bind_ops[i].flags =DRM_XE_VM_BIND_FLAG_ASYNC ; bind_ops[i].prefetch_mem_region_instance =0 ;
Signature · 1 line
2.34.1
PATCH v3 47/57 drm-uapi/xe: Exec queue documentation and variable renaming
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Exec queue documentation and variable renaming")
--- benchmarks/gem_wsim.c | 4 +- include/drm-uapi/xe_drm.h | 84 ++++++++++++++++++++++++++++++--- lib/xe/xe_ioctl.c | 12 ++--- tests/intel/xe_access_counter.c | 4 +- tests/intel/xe_create.c | 4 +- tests/intel/xe_exec_balancer.c | 48 +++++++++---------- tests/intel/xe_exec_reset.c | 22 ++++----- tests/intel/xe_exec_store.c | 16 +++---- tests/intel/xe_exec_threads.c | 26 +++++----- tests/intel/xe_perf_pmu.c | 20 ++++---- tests/intel/xe_spin_batch.c | 14 +++--- 11 files changed, 162 insertions(+), 92 deletions(-)
benchmarks/gem_wsim.c +2 -2
@@ -2038,8 +2038,8 @@ static void xe_exec_queue_create_(struct ctx *ctx, struct xe_exec_queue *eq) {struct drm_xe_exec_queue_create create = { .vm_id = ctx->xe.vm->id, - .width =1 , - .num_placements = eq->nr_ecis, + .num_bb_per_exec =1 , + .num_eng_per_bb = eq->nr_ecis, .instances =to_user_pointer (eq->eci_list), };
include/drm-uapi/xe_drm.h +77 -7
109 lines not on this page · raw message
lib/xe/xe_ioctl.c +6 -6
@@ -283,8 +283,8 @@ uint32_t xe_bind_exec_queue_create(int fd, uint32_t vm, uint64_t ext, bool asyncstruct drm_xe_exec_queue_create create = { .extensions = ext, .vm_id = vm, - .width =1 , - .num_placements =1 , + .num_bb_per_exec =1 , + .num_eng_per_bb =1 , .instances =to_user_pointer (&instance), };
@@ -300,8 +300,8 @@ uint32_t xe_exec_queue_create(int fd, uint32_t vm,struct drm_xe_exec_queue_create create = { .extensions = ext, .vm_id = vm, - .width =1 , - .num_placements =1 , + .num_bb_per_exec =1 , + .num_eng_per_bb =1 , .instances =to_user_pointer (instance), };
@@ -319,8 +319,8 @@ uint32_t xe_exec_queue_create_class(int fd, uint32_t vm, uint16_t class) };struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width =1 , - .num_placements =1 , + .num_bb_per_exec =1 , + .num_eng_per_bb =1 , .instances =to_user_pointer (&instance), };
tests/intel/xe_access_counter.c +2 -2
@@ -55,8 +55,8 @@ igt_mainstruct drm_xe_exec_queue_create create = { .extensions =to_user_pointer (&ext), .vm_id =xe_vm_create (fd,0 ,0 ), - .width =1 , - .num_placements =1 , + .num_bb_per_exec =1 , + .num_eng_per_bb =1 , .instances =to_user_pointer (&instance), };
tests/intel/xe_create.c +2 -2
@@ -100,8 +100,8 @@ static uint32_t __xe_exec_queue_create(int fd, uint32_t vm,struct drm_xe_exec_queue_create create = { .extensions = ext, .vm_id = vm, - .width =1 , - .num_placements =1 , + .num_bb_per_exec =1 , + .num_eng_per_bb =1 , .instances =to_user_pointer (instance), };int err =0 ;
tests/intel/xe_exec_balancer.c +24 -24
155 lines not on this page · raw message
tests/intel/xe_exec_reset.c +11 -11
@@ -166,7 +166,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,struct xe_spin_opts spin_opts = { .preempt = false };struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ]; -int i, j, b, num_placements =0 , bad_batches =1 ; +int i, j, b, num_eng_per_bb =0 , bad_batches =1 ;igt_assert (n_exec_queues <=MAX_N_EXECQUEUES );
@@ -178,10 +178,10 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs, engine->instance.gt_id != gt)continue ; - eci_list[num_placements++] = engine->instance; + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); } -if (num_placements <2 ) +if (num_eng_per_bb <2 )return ; vm =xe_vm_create (fd,DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ,0 );
@@ -208,8 +208,8 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs, };struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width = flags &PARALLEL ? num_placements :1 , - .num_placements = flags &PARALLEL ?1 : num_placements, + .num_bb_per_exec = flags &PARALLEL ? num_eng_per_bb :1 , + .num_eng_per_bb = flags &PARALLEL ?1 : num_eng_per_bb, .instances =to_user_pointer (eci_list), };
@@ -223,14 +223,14 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs, exec_queues[i] = create.exec_queue_id; syncobjs[i] =syncobj_create (fd,0 ); }; - exec.num_batch_buffer = flags &PARALLEL ? num_placements :1 ; + exec.num_batch_buffer = flags &PARALLEL ? num_eng_per_bb :1 ; sync[0 ].handle =syncobj_create (fd,0 );xe_vm_bind_async (fd, vm,0 , bo,0 , addr, bo_size, sync,1 );if (flags &VIRTUAL && (flags &CAT_ERROR || flags &EXEC_QUEUE_RESET || flags >_RESET )) - bad_batches = num_placements; + bad_batches = num_eng_per_bb;for (i =0 ; i < n_execs; i++) { uint64_t base_addr = flags & CAT_ERROR && i < bad_batches ?
@@ -244,7 +244,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,uint64_t batches[MAX_INSTANCE ];int e = i % n_exec_queues; -for (j =0 ; j < num_placements && flags &PARALLEL ; ++j) +for (j =0 ; j < num_eng_per_bb && flags &PARALLEL ; ++j) batches[j] = batch_addr;if (i < bad_batches) {
@@ -263,7 +263,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs, exec_addr = batch_addr; } -for (j =0 ; j < num_placements && flags &PARALLEL ; ++j) +for (j =0 ; j < num_eng_per_bb && flags &PARALLEL ; ++j) batches[j] = exec_addr; sync[0 ].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL ;
@@ -690,8 +690,8 @@ static void submit_jobs(struct gt_thread_data *t) };struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width =1 , - .num_placements =1 , + .num_bb_per_exec =1 , + .num_eng_per_bb =1 , .instances =to_user_pointer (&instance), };struct drm_xe_exec exec;
tests/intel/xe_exec_store.c +8 -8
@@ -235,7 +235,7 @@ static void store_all(int fd, int gt, int class)uint32_t bo =0 ;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];struct drm_xe_engine_class_instance *eci; -int i, num_placements =0 ; +int i, num_eng_per_bb =0 ; vm =xe_vm_create (fd,DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ,0 ); bo_size =sizeof (*data);
@@ -250,16 +250,16 @@ static void store_all(int fd, int gt, int class)xe_for_each_engine_instance (fd, eci) {if (eci->engine_class != class || eci->gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_eng_per_bb++] = *eci; } -igt_require (num_placements); +igt_require (num_eng_per_bb); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width =1 , - .num_placements = num_placements, + .num_bb_per_exec =1 , + .num_eng_per_bb = num_eng_per_bb, .instances =to_user_pointer (eci_list), };
@@ -272,7 +272,7 @@ static void store_all(int fd, int gt, int class) sync[0 ].handle =syncobj_create (fd,0 );xe_vm_bind_async (fd, vm,0 , bo,0 , addr, bo_size, sync,1 ); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {store_dword_batch (data, addr, i); sync[0 ].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL ;
@@ -292,7 +292,7 @@ static void store_all(int fd, int gt, int class)munmap (data, bo_size);gem_close (fd, bo); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {syncobj_destroy (fd, syncobjs[i]);xe_exec_queue_destroy (fd, exec_queues[i]); }
tests/intel/xe_exec_threads.c +13 -13
@@ -69,7 +69,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, } *data;struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ]; -int i, j, b, num_placements =0 ; +int i, j, b, num_eng_per_bb =0 ;bool owns_vm = false, owns_fd = false;igt_assert (n_exec_queues <=MAX_N_EXEC_QUEUES );
@@ -89,10 +89,10 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, engine->instance.gt_id != gt)continue ; - eci_list[num_placements++] = engine->instance; + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); } -igt_assert (num_placements >1 ); +igt_assert (num_eng_per_bb >1 ); bo_size =sizeof (*data) * n_execs; bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
@@ -122,8 +122,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,for (i =0 ; i < n_exec_queues; i++) {struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width = flags &PARALLEL ? num_placements :1 , - .num_placements = flags &PARALLEL ?1 : num_placements, + .num_bb_per_exec = flags &PARALLEL ? num_eng_per_bb :1 , + .num_eng_per_bb = flags &PARALLEL ?1 : num_eng_per_bb, .instances =to_user_pointer (eci_list), };
@@ -134,7 +134,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr, sync_all[i].type =DRM_XE_SYNC_TYPE_SYNCOBJ ; sync_all[i].handle = syncobjs[i]; }; - exec.num_batch_buffer = flags &PARALLEL ? num_placements :1 ; + exec.num_batch_buffer = flags &PARALLEL ? num_eng_per_bb :1 ;pthread_barrier_wait (&barrier);
@@ -153,7 +153,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,uint64_t batches[MAX_INSTANCE ];int e = i % n_exec_queues; -for (j =0 ; j < num_placements && flags &PARALLEL ; ++j) +for (j =0 ; j < num_eng_per_bb && flags &PARALLEL ; ++j) batches[j] = batch_addr; b =0 ;
@@ -991,16 +991,16 @@ static void threads(int fd, int flags)if (flags &BALANCER ) {xe_for_each_gt (fd, gt)xe_for_each_engine_class (class) { -int num_placements =0 ; +int num_eng_per_bb =0 ;xe_for_each_engine_instance (fd, eci) {if (eci->engine_class != class || eci->gt_id != gt)continue ; - ++num_placements; + ++num_eng_per_bb; } -if (num_placements >1 ) +if (num_eng_per_bb >1 ) n_engines +=2 ; } }
@@ -1055,16 +1055,16 @@ static void threads(int fd, int flags)if (flags &BALANCER ) {xe_for_each_gt (fd, gt)xe_for_each_engine_class (class) { -int num_placements =0 ; +int num_eng_per_bb =0 ;xe_for_each_engine_instance (fd, eci) {if (eci->engine_class != class || eci->gt_id != gt)continue ; - ++num_placements; + ++num_eng_per_bb; } -if (num_placements >1 ) { +if (num_eng_per_bb >1 ) { threads_data[i].mutex = &mutex; threads_data[i].cond = &cond;if (flags &SHARED_VM )
tests/intel/xe_perf_pmu.c +10 -10
@@ -204,7 +204,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *nastruct xe_spin_opts spin_opts = { .addr = addr, .preempt = false };struct drm_xe_engine_class_instance *eci;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ]; -int num_placements =0 ; +int num_eng_per_bb =0 ;uint64_t config, count, idle; config =engine_group_get_config (gt, class);
@@ -213,24 +213,24 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *naif (eci->engine_class != class || eci->gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_eng_per_bb++] = *eci; } -igt_skip_on_f (!num_placements,"Engine class:%d gt:%d not enabled on this platform\n" , +igt_skip_on_f (!num_eng_per_bb,"Engine class:%d gt:%d not enabled on this platform\n" , class, gt); vm =xe_vm_create (fd,DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ,0 ); - bo_size =sizeof (*data) * num_placements; + bo_size =sizeof (*data) * num_eng_per_bb; bo_size =ALIGN (bo_size +xe_cs_prefetch_size (fd),xe_get_default_alignment (fd)); bo =xe_bo_create (fd, vm, bo_size,any_vram_if_possible (fd),0 ); data =xe_bo_map (fd, bo, bo_size); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width =1 , - .num_placements = num_placements, + .num_bb_per_exec =1 , + .num_eng_per_bb = num_eng_per_bb, .instances =to_user_pointer (eci_list), };
@@ -247,7 +247,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na idle =pmu_read (pmu_fd);igt_assert (!idle); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) { spin_opts.addr = addr + (char *)&data[i].spin - (char *)data;xe_spin_init (&data[i].spin, &spin_opts); sync[0 ].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL ;
@@ -260,7 +260,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *naxe_spin_wait_started (&data[i].spin); } -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {xe_spin_end (&data[i].spin);igt_assert (syncobj_wait (fd, &syncobjs[i],1 ,INT64_MAX ,0 ,NULL ));
@@ -274,7 +274,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *nasyncobj_destroy (fd, sync[0 ].handle); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {syncobj_destroy (fd, syncobjs[i]);xe_exec_queue_destroy (fd, exec_queues[i]); }
tests/intel/xe_spin_batch.c +7 -7
@@ -97,7 +97,7 @@ static void spin_all(int fd, int gt, int class) {uint64_t ahnd;uint32_t exec_queues[MAX_INSTANCE ], vm; -int i, num_placements =0 ; +int i, num_eng_per_bb =0 ;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];igt_spin_t *spin[MAX_INSTANCE ];struct drm_xe_engine_class_instance *eci;
@@ -107,17 +107,17 @@ static void spin_all(int fd, int gt, int class)xe_for_each_engine_instance (fd, eci) {if (eci->engine_class != class || eci->gt_id != gt)continue ; - eci_list[num_placements++] = *eci; + eci_list[num_eng_per_bb++] = *eci; } -if (num_placements <2 ) +if (num_eng_per_bb <2 )return ; vm =xe_vm_create (fd,0 ,0 ); -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {struct drm_xe_exec_queue_create create = { .vm_id = vm, - .width =1 , - .num_placements = num_placements, + .num_bb_per_exec =1 , + .num_eng_per_bb = num_eng_per_bb, .instances =to_user_pointer (eci_list), };
@@ -127,7 +127,7 @@ static void spin_all(int fd, int gt, int class) spin[i] = igt_spin_new(fd, .ahnd = ahnd, .engine = exec_queues[i], .vm = vm); } -for (i =0 ; i < num_placements; i++) { +for (i =0 ; i < num_eng_per_bb; i++) {igt_spin_free (fd, spin[i]);xe_exec_queue_destroy (fd, exec_queues[i]); }
Signature · 1 line
2.34.1
PATCH v3 48/57 drm-uapi/xe: Refactor engine information
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Refactor engine information")
--- benchmarks/gem_wsim.c | 12 ++++++----- include/drm-uapi/xe_drm.h | 10 +++++++-- lib/xe/xe_ioctl.c | 2 +- lib/xe/xe_query.c | 2 +- tests/intel/xe_exec_balancer.c | 24 +++++++++++++++++++--- tests/intel/xe_exec_reset.c | 14 +++++++++---- tests/intel/xe_exec_store.c | 36 ++++++++++++++++++++------------- tests/intel/xe_exec_threads.c | 37 +++++++++++++++++++++++++--------- tests/intel/xe_huc_copy.c | 12 +++++------ tests/intel/xe_perf_pmu.c | 27 ++++++++++++++++--------- tests/intel/xe_pm_residency.c | 6 +++--- tests/intel/xe_query.c | 10 +++++---- tests/intel/xe_spin_batch.c | 16 +++++++++++---- 13 files changed, 141 insertions(+), 67 deletions(-)
benchmarks/gem_wsim.c +7 -5
@@ -214,6 +214,7 @@ struct xe_exec_queue {uint32_t id;unsigned int nr_ecis;struct drm_xe_engine_class_instance *eci_list; +uint16_t gt_id;uint32_t bo_placement; };
@@ -1746,7 +1747,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)xe_vm_bind_sync (fd, vm->id, w->bb_handle,0 , w->xe.exec.address,PAGE_SIZE ); xe_spin_init_opts(&w->xe.data->spin, .addr = w->xe.exec.address, .preempt = (w->preempt_us > 0), - .ctx_ticks =duration_to_ctx_ticks (fd, eq->eci_list[0 ].gt_id, + .ctx_ticks =duration_to_ctx_ticks (fd, eq->gt_id,1000LL *get_duration (wrk, w))); w->xe.exec.exec_queue_id = eq->id; w->xe.exec.num_batch_buffer =1 ;
@@ -2296,7 +2297,8 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk) engine =xe_get_engine (ctx->engine_map[i]); eq->eci_list[i] = engine->instance; eq->bo_placement =vram_near_engine_if_possible (fd, engine); - +igt_assert ((i && eq->gt_id == engine->gt_id) || i ==0 ); + eq->gt_id = engine->gt_id;/* check no mixing classes and no duplicates */ for (int j =0 ; j < i; ++j) { if (eq->eci_list[j].engine_class !=
@@ -2321,7 +2323,7 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk) id, ctx_idx, ring_str_map[ctx->engine_map[i]], eq->eci_list[i].engine_class, eq->eci_list[i].engine_instance, - eq->eci_list[i].gt_id); + eq->eci_list[i].sched_group_id); }xe_exec_queue_create_ (ctx, eq);
@@ -2361,7 +2363,7 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk) id, ctx_idx, ring_str_map[i], eq->eci_list[0 ].engine_class, eq->eci_list[0 ].engine_instance, - eq->eci_list[0].gt_id); + eq->eci_list[0].sched_group_id);xe_exec_queue_create_ (ctx, eq); }
@@ -2571,7 +2573,7 @@ static void do_xe_exec(struct workload *wrk, struct w_step *w) xe_spin_init_opts(&w->xe.data->spin, .addr = w->xe.exec.address, .preempt = (w->preempt_us > 0), - .ctx_ticks =duration_to_ctx_ticks (fd, eq->eci_list[0 ].gt_id, + .ctx_ticks =duration_to_ctx_ticks (fd, eq->gt_id,1000LL *get_duration (wrk, w)));xe_exec (fd, &w->xe.exec); }
include/drm-uapi/xe_drm.h +8 -2
@@ -211,8 +211,8 @@ struct drm_xe_engine_class_instance {__u16 engine_class;/** @engine_instance: Engine instance */ __u16 engine_instance; -/** @gt_id: GT ID the instance is associated with */ -__u16 gt_id; +/** @sched_group_id: Scheduling Group ID for this engine instance */ +__u16 sched_group_id;/** @pad: MBZ */ __u16 pad; };
@@ -228,6 +228,12 @@ struct drm_xe_query_engine_info {/** @instance: The @drm_xe_engine_class_instance */ struct drm_xe_engine_class_instance instance; +/** @tile_id: Tile ID where this Engine lives */ +__u16 tile_id; + +/** @gt_id: GT ID where this Engine lives */ +__u16 gt_id; +/** * @near_mem_regions: Bit mask of instances from * drm_xe_query_mem_regions that is near this engine.
lib/xe/xe_ioctl.c +1 -1
@@ -315,7 +315,7 @@ uint32_t xe_exec_queue_create_class(int fd, uint32_t vm, uint16_t class)struct drm_xe_engine_class_instance instance = { .engine_class = class, .engine_instance =0 , - .gt_id =0 , + .sched_group_id =0 , };struct drm_xe_exec_queue_create create = { .vm_id = vm,
lib/xe/xe_query.c +1 -1
@@ -569,7 +569,7 @@ uint64_t xe_vram_size_region_near_gt(int fd, int gt)igt_assert (xe_dev);xe_for_each_engine (fd, engine) { -if (gt == engine->instance.gt_id) +if (gt == engine->gt_id)for (int i =0 ; i < xe_dev->mem_regions->num_regions; i++) if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]) && ((1 << xe_dev->mem_regions->regions[i].instance) &
tests/intel/xe_exec_balancer.c +21 -3
@@ -59,12 +59,18 @@ static void test_all_active(int fd, int gt, int class)struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, num_eng_per_bb =0 ; +int sched_id =-1 ;xe_for_each_engine (fd, engine) {if (engine->instance.engine_class != class || - engine->instance.gt_id != gt) + engine->gt_id != gt)continue ; +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); }
@@ -204,14 +210,20 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 ; +int sched_id =-1 ;igt_assert (n_exec_queues <=MAX_N_EXEC_QUEUES );xe_for_each_engine (fd, engine) {if (engine->instance.engine_class != class || - engine->instance.gt_id != gt) + engine->gt_id != gt)continue ; +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); }
@@ -435,14 +447,20 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 ;int map_fd =-1 ; +int sched_id =-1 ;igt_assert (n_exec_queues <=MAX_N_EXEC_QUEUES );xe_for_each_engine (fd, engine) {if (engine->instance.engine_class != class || - engine->instance.gt_id != gt) + engine->gt_id != gt)continue ; +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); }
tests/intel/xe_exec_reset.c +10 -4
@@ -167,6 +167,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 , bad_batches =1 ; +int sched_id =-1 ;igt_assert (n_exec_queues <=MAX_N_EXECQUEUES );
@@ -175,9 +176,14 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,xe_for_each_engine (fd, engine) {if (engine->instance.engine_class != class || - engine->instance.gt_id != gt) + engine->gt_id != gt)continue ; +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); }
@@ -449,7 +455,7 @@ test_legacy_mode(int fd, struct drm_xe_query_engine_info *engine, }if (flags >_RESET ) -xe_force_gt_reset (fd, engine->instance.gt_id); +xe_force_gt_reset (fd, engine->gt_id);if (flags &CLOSE_FD ) {if (flags &CLOSE_EXEC_QUEUES ) {
@@ -613,7 +619,7 @@ test_compute_mode(int fd, struct drm_xe_query_engine_info *engine, }if (flags >_RESET ) -xe_force_gt_reset (fd, engine->instance.gt_id); +xe_force_gt_reset (fd, engine->gt_id);if (flags &CLOSE_FD ) {if (flags &CLOSE_EXEC_QUEUES ) {
@@ -686,7 +692,7 @@ static void submit_jobs(struct gt_thread_data *t)struct drm_xe_engine_class_instance instance = { .engine_class =DRM_XE_ENGINE_CLASS_COPY , .engine_instance =0 , - .gt_id =0 , + .sched_group_id =0 , };struct drm_xe_exec_queue_create create = { .vm_id = vm,
tests/intel/xe_exec_store.c +22 -14
@@ -86,7 +86,7 @@ static void store(int fd)vram_near_engine_if_possible (fd, engine), DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM); -xe_vm_bind_async (fd, vm, engine->instance.gt_id, bo,0 , addr, bo_size, &sync,1 ); +xe_vm_bind_async (fd, vm, engine->gt_id, bo,0 , addr, bo_size, &sync,1 ); data =xe_bo_map (fd, bo, bo_size);store_dword_batch (data, addr, value);
@@ -119,7 +119,7 @@ static void store(int fd)* @cachelines: cachelines * @page-sized: page-sized */ -static void store_cachelines (int fd,struct drm_xe_engine_class_instance *eci, +static void store_cachelines (int fd,struct drm_xe_query_engine_info *engine,unsigned int flags) {struct drm_xe_sync sync[2 ] = {
@@ -149,19 +149,19 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci, bo_size =ALIGN (bo_size,xe_get_default_alignment (fd)); vm =xe_vm_create (fd,DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ,0 ); ahnd =intel_allocator_open (fd,0 ,INTEL_ALLOCATOR_SIMPLE ); - exec_queues =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queues =xe_exec_queue_create (fd, vm, &engine->instance,0 ); syncobjs =syncobj_create (fd,0 ); sync[0 ].handle =syncobj_create (fd,0 );for (i =0 ; i < count; i++) { bo[i] =xe_bo_create (fd, vm, bo_size, -vram_near_engine_if_possible (fd, eci), +vram_near_engine_if_possible (fd, engine),DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ); bo_map[i] =xe_bo_map (fd, bo[i], bo_size); dst_offset[i] =intel_allocator_alloc_with_strategy (ahnd, bo[i], bo_size,0 ,ALLOC_STRATEGY_LOW_TO_HIGH ); -xe_vm_bind_async (fd, vm, eci->gt_id, bo[i],0 , dst_offset[i], bo_size, sync,1 ); +xe_vm_bind_async (fd, vm, engine->gt_id, bo[i],0 , dst_offset[i], bo_size, sync,1 ); } batch_map =xe_bo_map (fd, bo[i-1 ], bo_size);
@@ -234,8 +234,9 @@ static void store_all(int fd, int gt, int class)uint64_t addr =0x100000 ;uint32_t bo =0 ;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ]; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;int i, num_eng_per_bb =0 ; +int sched_id =-1 ; vm =xe_vm_create (fd,DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ,0 ); bo_size =sizeof (*data);
@@ -247,10 +248,17 @@ static void store_all(int fd, int gt, int class) DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM); data =xe_bo_map (fd, bo, bo_size); -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->gt_id != gt)continue ; - eci_list[num_eng_per_bb++] = *eci; + +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + + eci_list[num_eng_per_bb++] = engine->instance; }igt_require (num_eng_per_bb);
@@ -301,7 +309,7 @@ static void store_all(int fd, int gt, int class) igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;int fd, class, gt; igt_fixture {
@@ -319,12 +327,12 @@ igt_main } igt_subtest("cachelines") -xe_for_each_engine_instance (fd, eci) -store_cachelines (fd, eci,0 ); +xe_for_each_engine (fd, engine) +store_cachelines (fd, engine,0 ); igt_subtest("page-sized") -xe_for_each_engine_instance (fd, eci) -store_cachelines (fd, eci,PAGES ); +xe_for_each_engine (fd, engine) +store_cachelines (fd, engine,PAGES ); igt_fixture {xe_device_put (fd);
tests/intel/xe_exec_threads.c +27 -10
@@ -71,6 +71,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 ;bool owns_vm = false, owns_fd = false; +int sched_id =-1 ;igt_assert (n_exec_queues <=MAX_N_EXEC_QUEUES );
@@ -86,9 +87,14 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,xe_for_each_engine (fd, engine) {if (engine->instance.engine_class != class || - engine->instance.gt_id != gt) + engine->gt_id != gt)continue ; +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + eci_list[num_eng_per_bb++] = engine->instance; bo_placement =vram_near_engine_if_possible (fd, engine); }
@@ -973,7 +979,6 @@ static void threads(int fd, int flags) {struct thread_data *threads_data;struct drm_xe_query_engine_info *engine; -struct drm_xe_engine_class_instance *eci;uint64_t addr =0x1a0000 ;uint64_t userptr =0x00007000eadbe000 ;pthread_mutex_t mutex;
@@ -985,24 +990,30 @@ static void threads(int fd, int flags)int n_threads =0 ;int gt; -xe_for_each_engine_instance (fd, eci) +xe_for_each_engine (fd, engine) ++n_engines;if (flags &BALANCER ) {xe_for_each_gt (fd, gt)xe_for_each_engine_class (class) {int num_eng_per_bb =0 ; +int sched_id =-1 ; -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || - eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->gt_id != gt)continue ; + +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); ++num_eng_per_bb; }if (num_eng_per_bb >1 ) n_engines +=2 ; - } + } } threads_data =calloc (n_engines,sizeof (*threads_data));
@@ -1056,11 +1067,17 @@ static void threads(int fd, int flags)xe_for_each_gt (fd, gt)xe_for_each_engine_class (class) {int num_eng_per_bb =0 ; +int sched_id =-1 ; -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || - eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->gt_id != gt)continue ; + +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); ++num_eng_per_bb; }
tests/intel/xe_huc_copy.c +6 -6
@@ -153,17 +153,17 @@ __test_huc_copy(int fd, uint32_t vm, struct drm_xe_engine_class_instance *hwe)static void test_huc_copy (int fd) { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;uint32_t vm;uint32_t tested_gts =0 ; vm =xe_vm_create (fd,DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ,0 ); -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class ==DRM_XE_ENGINE_CLASS_VIDEO_DECODE && - !(tested_gts &BIT (eci->gt_id))) { - tested_gts |=BIT (eci->gt_id); -__test_huc_copy (fd, vm, eci); +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class ==DRM_XE_ENGINE_CLASS_VIDEO_DECODE && + !(tested_gts &BIT (engine->gt_id))) { + tested_gts |=BIT (engine->gt_id); +__test_huc_copy (fd, vm, &engine->instance); } }
tests/intel/xe_perf_pmu.c +17 -10
@@ -76,7 +76,7 @@ static uint64_t engine_group_get_config(int gt, int class)* Run type: FULL * */ -static void test_any_engine_busyness (int fd,struct drm_xe_engine_class_instance *eci) +static void test_any_engine_busyness (int fd,struct drm_xe_query_engine_info *engine) {uint32_t vm;uint64_t addr =0x1a0000 ;
@@ -106,13 +106,13 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance bo =xe_bo_create (fd, vm, bo_size,any_vram_if_possible (fd),0 ); spin =xe_bo_map (fd, bo, bo_size); - exec_queue =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queue =xe_exec_queue_create (fd, vm, &engine->instance,0 ); syncobj =syncobj_create (fd,0 ); sync[0 ].handle =syncobj_create (fd,0 );xe_vm_bind_async (fd, vm,0 , bo,0 , addr, bo_size, sync,1 ); - pmu_fd =open_pmu (fd,DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY (eci->gt_id)); + pmu_fd =open_pmu (fd,DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY (engine->gt_id)); idle =pmu_read (pmu_fd);igt_assert (!idle);
@@ -202,18 +202,25 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *nastruct xe_spin spin; } *data;struct xe_spin_opts spin_opts = { .addr = addr, .preempt = false }; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int num_eng_per_bb =0 ;uint64_t config, count, idle; +int sched_id =-1 ; config =engine_group_get_config (gt, class); -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->gt_id != gt)continue ; - eci_list[num_eng_per_bb++] = *eci; +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + + eci_list[num_eng_per_bb++] = engine->instance; } igt_skip_on_f(!num_eng_per_bb, "Engine class:%d gt:%d not enabled on this platform\n",
@@ -291,7 +298,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na igt_main { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine; const struct section { const char *name; int class;
@@ -321,8 +328,8 @@ igt_main } igt_subtest("any-engine-group-busy") -xe_for_each_engine_instance (fd, eci) -test_any_engine_busyness (fd, eci); +xe_for_each_engine (fd, engine) +test_any_engine_busyness (fd, engine); igt_fixture {xe_device_put (fd);
tests/intel/xe_pm_residency.c +3 -3
@@ -244,9 +244,9 @@ static void idle_residency_on_exec(int fd, struct drm_xe_query_engine_info *engiexec_load (fd, engine, done); start =READ_ONCE (done[1 ]); - residency_start =read_idle_residency (fd, engine->instance.gt_id); + residency_start =read_idle_residency (fd, engine->gt_id); elapsed_ms =measured_usleep (SLEEP_DURATION *USEC_PER_SEC ) /1000 ; - residency_end =read_idle_residency (fd, engine->instance.gt_id); + residency_end =read_idle_residency (fd, engine->gt_id); end =READ_ONCE (done[1 ]); *done =1 ;
@@ -349,7 +349,7 @@ igt_main igt_subtest("idle-residency-on-exec") {xe_for_each_gt (fd, gt) {xe_for_each_engine (fd, engine) { -if (gt == engine->instance.gt_id && !engine->instance.engine_instance) +if (gt == engine->gt_id && !engine->instance.engine_instance)idle_residency_on_exec (fd, engine); } }
tests/intel/xe_query.c +6 -4
@@ -201,10 +201,12 @@ test_query_engines(int fd)for (i =0 ; i < num_engines; i++) { eci = &engines[i].instance;igt_assert (eci); -igt_info ("engine %d: %s, engine instance: %d, gt: GT-%d\n" , i, +igt_info ("engine %d: %s, tile: TILE-%d, gt: GT-%d, engine instance: %d, scheduling group:%d\n" , i,xe_engine_class_string (eci->engine_class), + engines[i].tile_id, + engines[i].gt_id, eci->engine_instance, - eci->gt_id); + eci->sched_group_id);igt_info ("near_mem_regions: 0x%016llx\n" , engines[i].near_mem_regions); igt_info("far_mem_regions: 0x%016llx\n",
@@ -664,8 +666,8 @@ static void test_engine_cycles_invalid(int fd)do_ioctl_err (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query,EINVAL ); ts.eci = *eci; -/* bad gt */ - ts.eci.gt_id =0xffff ; +/* bad sched group */ + ts.eci.sched_group_id =0xffff ;do_ioctl_err (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query,EINVAL ); ts.eci = *eci;
tests/intel/xe_spin_batch.c +12 -4
@@ -100,14 +100,22 @@ static void spin_all(int fd, int gt, int class)int i, num_eng_per_bb =0 ;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];igt_spin_t *spin[MAX_INSTANCE ]; -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine; +int sched_id =-1 ; ahnd =intel_allocator_open (fd,0 ,INTEL_ALLOCATOR_RELOC ); -xe_for_each_engine_instance (fd, eci) { -if (eci->engine_class != class || eci->gt_id != gt) +xe_for_each_engine (fd, engine) { +if (engine->instance.engine_class != class || + engine->gt_id != gt)continue ; - eci_list[num_eng_per_bb++] = *eci; + +if (sched_id ==-1 ) + sched_id = engine->instance.sched_group_id; +else +igt_assert_eq (sched_id, engine->instance.sched_group_id); + + eci_list[num_eng_per_bb++] = engine->instance; }if (num_eng_per_bb <2 )return ;
Signature · 1 line
2.34.1
PATCH v3 49/57 drm-uapi/xe: Crystal Reference Clock updates
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Crystal Reference Clock updates")
--- include/drm-uapi/xe_drm.h | 11 ++++------- lib/xe/xe_query.c | 19 +++++++++++++++++++ lib/xe/xe_query.h | 1 + lib/xe/xe_spin.c | 12 +----------- tests/intel/xe_query.c | 39 +++++++++++++++++++++------------------ 5 files changed, 46 insertions(+), 36 deletions(-)
include/drm-uapi/xe_drm.h +4 -7
@@ -429,8 +429,8 @@ struct drm_xe_query_gt {__u16 type;/** @gt_id: Unique ID of this GT within the PCI Device */ __u16 gt_id; -/** @clock_freq: A clock frequency for timestamp */ -__u32 clock_freq; +/** @reference_clock: A clock frequency for timestamp */ +__u32 reference_clock;/** @reserved: Reserved */ __u64 reserved[8 ]; };
@@ -504,8 +504,8 @@ struct drm_xe_query_topology_mask {* in .data. struct drm_xe_query_engine_cycles is allocated by the user and * .data points to this allocated structure. * -* The query returns the engine cycles and the frequency that can -* be used to calculate the engine timestamp. In addition the +* The query returns the engine cycles, which along with GT's @reference_clock, +* can be used to calculate the engine timestamp. In addition the * query returns a set of cpu timestamps that indicate when the command * streamer cycle count was captured. */
@@ -533,9 +533,6 @@ struct drm_xe_query_engine_cycles {*/ __u64 engine_cycles; -/** @engine_frequency: Frequency of the engine cycles in Hz. */ -__u64 engine_frequency; -/** * @cpu_timestamp: CPU timestamp in ns. The timestamp is captured before * reading the engine_cycles register using the reference clockid set by the
lib/xe/xe_query.c +19 -0
@@ -580,6 +580,25 @@ uint64_t xe_vram_size_region_near_gt(int fd, int gt)return 0 ; } +/** +* xe_gt_reference_clock: +* @fd: xe device fd +* @gt: gt ID +* +* Returns GT's reference crystal clock. +*/ +uint32_t xe_gt_reference_clock (int fd,int gt) +{ +struct xe_device *xe_dev; + + xe_dev =find_in_cache (fd); +igt_assert (xe_dev); + +igt_assert (gt >=0 && gt <xe_number_gt (fd)); + +return xe_dev->gt_list->gt_list[gt].reference_clock; +} +/** * xe_visible_vram_size_any_region: * @fd: xe device fd
lib/xe/xe_query.h +1 -0
@@ -91,6 +91,7 @@ unsigned int xe_number_engines(int fd);bool xe_has_vram (int fd);uint64_t xe_vram_size_any_region (int fd);uint64_t xe_vram_size_region_near_gt (int fd,int gt); +uint32_t xe_gt_reference_clock (int fd,int gt);uint64_t xe_visible_vram_size_any_region (int fd);uint64_t xe_vram_available_any_region (int fd);uint64_t xe_visible_vram_size_region_near_gt (int fd,int gt);
lib/xe/xe_spin.c +1 -11
@@ -16,16 +16,6 @@#include "xe_ioctl.h" #include "xe_spin.h" -static uint32_t read_timestamp_frequency (int fd,int gt_id) -{ -struct xe_device *dev =xe_device_get (fd); - -igt_assert (dev && dev->gt_list && dev->gt_list->num_gt); -igt_assert (gt_id >=0 && gt_id <= dev->gt_list->num_gt); - -return dev->gt_list->gt_list[gt_id].clock_freq; -} -static uint64_t div64_u64_round_up (const uint64_t x,const uint64_t y) {igt_assert (y >0 );
@@ -43,7 +33,7 @@ static uint64_t div64_u64_round_up(const uint64_t x, const uint64_t y)*/ uint32_t duration_to_ctx_ticks (int fd,int gt_id,uint64_t duration_ns) { -uint32_t f =read_timestamp_frequency (fd, gt_id); +uint32_t f =xe_gt_reference_clock (fd, gt_id);uint64_t ctx_ticks =div64_u64_round_up (duration_ns * f,NSEC_PER_SEC );igt_assert_lt_u64 (ctx_ticks,XE_SPIN_MAX_CTX_TICKS );
tests/intel/xe_query.c +21 -18
@@ -306,7 +306,7 @@ test_query_gt_list(int fd)for (i =0 ; i < gt_list->num_gt; i++) {igt_info ("type: %d\n" , gt_list->gt_list[i].type);igt_info ("gt_id: %d\n" , gt_list->gt_list[i].gt_id); -igt_info ("clock_freq: %u\n" , gt_list->gt_list[i].clock_freq); +igt_info ("reference_clock: %u\n" , gt_list->gt_list[i].reference_clock); } }
@@ -519,7 +519,7 @@ query_engine_cycles(int fd, struct drm_xe_query_engine_cycles *resp) }static void -__engine_cycles (int fd,struct drm_xe_engine_class_instance *eci) +__engine_cycles (int fd,struct drm_xe_query_engine_info *engine) {struct drm_xe_query_engine_cycles ts1 = {};struct drm_xe_query_engine_cycles ts2 = {};
@@ -528,7 +528,7 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *eci)int i, usable =0 ;igt_spin_t *spin;uint64_t ahnd; -uint32_t vm; +uint32_t vm, ref_clock;struct {int32_t id;const char *name;
@@ -541,11 +541,14 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *eci) };igt_debug ("engine[%u:%u]\n" , - eci->engine_class, - eci->engine_instance); + engine->instance.engine_class, + engine->instance.engine_instance); + + ref_clock =xe_gt_reference_clock (fd, engine->gt_id); +igt_debug ("GT reference_clock %u\n" , ref_clock); vm =xe_vm_create (fd,0 ,0 ); - exec_queue =xe_exec_queue_create (fd, vm, eci,0 ); + exec_queue =xe_exec_queue_create (fd, vm, &engine->instance,0 ); ahnd =intel_allocator_open (fd,0 ,INTEL_ALLOCATOR_RELOC ); spin = igt_spin_new(fd, .ahnd = ahnd, .engine = exec_queue, .vm = vm);
@@ -554,10 +557,10 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *eci)for (i =0 ; i <NUM_SNAPSHOTS *ARRAY_SIZE (clock); i++) {int index = i /NUM_SNAPSHOTS ; - ts1.eci = *eci; + ts1.eci = engine->instance; ts1.clockid = clock[index].id; - ts2.eci = *eci; + ts2.eci = engine->instance; ts2.clockid = clock[index].id;query_engine_cycles (fd, &ts1);
@@ -566,23 +569,23 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *eci)igt_debug ("[1] cpu_ts before %llu, reg read time %llu\n" , ts1.cpu_timestamp, ts1.cpu_delta); -igt_debug ("[1] engine_ts %llu, freq %llu Hz, width %u\n" , - ts1.engine_cycles, ts1.engine_frequency, ts1.width); +igt_debug ("[1] engine_ts %llu, width %u\n" , + ts1.engine_cycles, ts1.width);igt_debug ("[2] cpu_ts before %llu, reg read time %llu\n" , ts2.cpu_timestamp, ts2.cpu_delta); -igt_debug ("[2] engine_ts %llu, freq %llu Hz, width %u\n" , - ts2.engine_cycles, ts2.engine_frequency, ts2.width); +igt_debug ("[2] engine_ts %llu, width %u\n" , + ts2.engine_cycles, ts2.width); delta_cpu = ts2.cpu_timestamp - ts1.cpu_timestamp;if (ts2.engine_cycles >= ts1.engine_cycles) delta_cs = (ts2.engine_cycles - ts1.engine_cycles) * -NSEC_PER_SEC / ts1.engine_frequency; +NSEC_PER_SEC / ref_clock;else delta_cs = (((1 << ts2.width) - ts2.engine_cycles) + ts1.engine_cycles) * -NSEC_PER_SEC / ts1.engine_frequency; +NSEC_PER_SEC / ref_clock;igt_debug ("delta_cpu[%lu], delta_cs[%lu]\n" , delta_cpu, delta_cs);
@@ -620,13 +623,13 @@ __engine_cycles(int fd, struct drm_xe_engine_class_instance *eci)*/ static void test_query_engine_cycles (int fd) { -struct drm_xe_engine_class_instance *eci; +struct drm_xe_query_engine_info *engine;igt_require (query_engine_cycles_supported (fd)); -xe_for_each_engine_instance (fd, eci) { -igt_assert (eci); -__engine_cycles (fd, eci); +xe_for_each_engine (fd, engine) { +igt_assert (engine); +__engine_cycles (fd, engine); } }
Signature · 1 line
2.34.1
PATCH v3 50/57 drm-uapi/xe: Add Tile ID information to the GT info query
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Add Tile ID information to the GT info query")
--- include/drm-uapi/xe_drm.h | 2 ++ tests/intel/xe_query.c | 1 + 2 files changed, 3 insertions(+)
include/drm-uapi/xe_drm.h +2 -0
@@ -427,6 +427,8 @@ struct drm_xe_query_gt {#define DRM_XE_QUERY_GT_TYPE_MEDIA 1/** @type: GT type: Main or Media */ __u16 type; +/** @tile_id: Tile ID where this GT lives (Information only) */ +__u16 tile_id;/** @gt_id: Unique ID of this GT within the PCI Device */ __u16 gt_id;/** @reference_clock: A clock frequency for timestamp */
tests/intel/xe_query.c +1 -0
@@ -305,6 +305,7 @@ test_query_gt_list(int fd)for (i =0 ; i < gt_list->num_gt; i++) {igt_info ("type: %d\n" , gt_list->gt_list[i].type); +igt_info ("tile_id: %d\n" , gt_list->gt_list[i].tile_id);igt_info ("gt_id: %d\n" , gt_list->gt_list[i].gt_id);igt_info ("reference_clock: %u\n" , gt_list->gt_list[i].reference_clock); }
Signature · 1 line
2.34.1
Re: [igt-dev] [PATCH v3 50/57] drm-uapi/xe: Add Tile ID information to the GT info query
Quoted 11 lines
-----Original Message-----
From: igt-dev <[email protected]> On Behalf Of Francois Dugast
Sent: Thursday, November 9, 2023 9:24 PM
To: [email protected]
Cc: Vivi, Rodrigo <[email protected]>
Subject: [igt-dev] [PATCH v3 50/57] drm-uapi/xe: Add Tile ID information to the GT info query
Quoted 6 lines
From: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Add Tile ID information to the GT info query")
Signed-off-by Rodrigo Vivi <[email protected]>
Quoted 33 lines
--- include/drm-uapi/xe_drm.h | 2 ++ tests/intel/xe_query.c | 1 + 2 files changed, 3 insertions(+)include/drm-uapi/xe_drm.h index renamed from include/drm-uapi/xe_drm.h +0
-0
3881f8a94..a18c141b1100644include/drm-uapi/xe_drm.h +2
-0@@ -427,6 +427,8 @@ struct drm_xe_query_gt {#define DRM_XE_QUERY_GT_TYPE_MEDIA 1/** @type: GT type: Main or Media */ __u16 type; +/** @tile_id: Tile ID where this GT lives (Information only) */ +__u16 tile_id;/** @gt_id: Unique ID of this GT within the PCI Device */ __u16 gt_id; /** @reference_clock: A clock frequency for timestamp */ diff --git
a/tests/intel/xe_query.cb/tests/intel/xe_query.cindex524a1949b..6ccfb0a65100644tests/intel/xe_query.c +1
-0@@ -305,6 +305,7 @@ test_query_gt_list(int fd)for (i =0 ; i < gt_list->num_gt; i++) {igt_info ("type: %d\n" , gt_list->gt_list[i].type); +igt_info ("tile_id: %d\n" , gt_list->gt_list[i].tile_id);igt_info ("gt_id: %d\n" , gt_list->gt_list[i].gt_id);igt_info ("reference_clock: %u\n" , gt_list- >gt_list[i].reference_clock);}
--
2.34.1
PATCH v3 51/57 lib/xe/xe_query: Fix improper handling of GT vs Tile
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Now that we converted all mem_region selection from GT to Engine, and that we have the tile_id in the engine, we can fix the confusion here and convert the last case from near_gt to near_tile.
--- lib/xe/xe_query.c | 10 +++++----- lib/xe/xe_query.h | 2 +- tests/intel/xe_sysfs_tile.c | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-)
lib/xe/xe_query.c +5 -5
@@ -554,13 +554,13 @@ uint64_t xe_vram_size_any_region(int fd) }/** -* xe_vram_size_region_near_gt: +* xe_vram_size_region_near_tile: * @fd: xe device fd -* @gt: gt +* @tile: tile * -* Returns size of vram region given a @gt id of this device. +* Returns size of vram region given a @tile id of this device. */ -uint64_t xe_vram_size_region_near_gt (int fd,int gt) +uint64_t xe_vram_size_region_near_tile (int fd,int tile) {struct xe_device *xe_dev;struct drm_xe_query_engine_info *engine;
@@ -569,7 +569,7 @@ uint64_t xe_vram_size_region_near_gt(int fd, int gt)igt_assert (xe_dev);xe_for_each_engine (fd, engine) { -if (gt == engine->gt_id) +if (tile == engine->tile_id)for (int i =0 ; i < xe_dev->mem_regions->num_regions; i++) if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]) && ((1 << xe_dev->mem_regions->regions[i].instance) &
lib/xe/xe_query.h +1 -1
@@ -90,7 +90,7 @@ struct drm_xe_query_config *xe_config(int fd);unsigned int xe_number_engines (int fd);bool xe_has_vram (int fd);uint64_t xe_vram_size_any_region (int fd); -uint64_t xe_vram_size_region_near_gt (int fd,int gt); +uint64_t xe_vram_size_region_near_tile (int fd,int tile);uint32_t xe_gt_reference_clock (int fd,int gt);uint64_t xe_visible_vram_size_any_region (int fd);uint64_t xe_vram_available_any_region (int fd);
tests/intel/xe_sysfs_tile.c +1 -2
@@ -47,8 +47,7 @@ igt_main igt_subtest("physical_vram_size_bytes") {igt_require (xe_has_vram (fd));for_each_sysfs_tile_dirfd (fd, tilefd, tile) { -/* FIXME: Tile and GT mixed misusage */ - vram_size =xe_vram_size_region_near_gt (fd, tile); + vram_size =xe_vram_size_region_near_tile (fd, tile);test_vram_physical_vram_size_bytes (tilefd, tile, vram_size); } }
Signature · 1 line
2.34.1
PATCH v3 52/57 drm-uapi/xe: Remove bogus engine list from the wait_user_fence IOCTL
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Align with kernel commit ("drm/xe/uapi: Remove bogus engine list from the wait_user_fence IOCTL")
--- include/drm-uapi/xe_drm.h | 17 ++--------------- lib/xe/xe_ioctl.c | 9 +-------- lib/xe/xe_ioctl.h | 2 -- tests/intel/xe_evict.c | 4 ++-- tests/intel/xe_exec_balancer.c | 12 ++++++------ tests/intel/xe_exec_compute_mode.c | 12 ++++++------ tests/intel/xe_exec_fault_mode.c | 14 +++++++------- tests/intel/xe_exec_reset.c | 6 +++--- tests/intel/xe_exec_threads.c | 12 ++++++------ tests/intel/xe_waitfence.c | 4 ++-- 10 files changed, 35 insertions(+), 57 deletions(-)
include/drm-uapi/xe_drm.h +2 -15
@@ -1279,8 +1279,7 @@ struct drm_xe_wait_user_fence {/** @op: wait operation (type of comparison) */ __u16 op; -#define DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP (1 << 0)/* e.g. Wait on VM bind */ -#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 1) +#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 0)/** @flags: wait flags */ __u16 flags;
@@ -1313,20 +1312,8 @@ struct drm_xe_wait_user_fence {*/ __s64 timeout; -/** -* @num_engines: number of engine instances to wait on, must be zero -* when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set -*/ -__u64 num_engines; - -/** -* @instances: user pointer to array of drm_xe_engine_class_instance to -* wait on, must be NULL when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set -*/ -__u64 instances; -/** @reserved: Reserved */ -__u64 reserved[2 ]; +__u64 reserved[4 ]; };/**
lib/xe/xe_ioctl.c +1 -8
@@ -417,18 +417,14 @@ void xe_exec_wait(int fd, uint32_t exec_queue, uint64_t addr) }int64_t xe_wait_ufence (int fd,uint64_t *addr,uint64_t value, -struct drm_xe_engine_class_instance *eci,int64_t timeout) {struct drm_xe_wait_user_fence wait = { .addr =to_user_pointer (addr), .op =DRM_XE_UFENCE_WAIT_OP_EQ , - .flags = !eci ?DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP :0 , .value = value, .mask =DRM_XE_UFENCE_WAIT_MASK_U64 , .timeout = timeout, - .num_engines = eci ?1 :0 , - .instances = eci ?to_user_pointer (eci) :0 , };igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_WAIT_USER_FENCE , &wait),0 );
@@ -449,18 +445,15 @@ int64_t xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,* Returns elapsed time in nanoseconds if user fence was signalled. */ int64_t xe_wait_ufence_abstime (int fd,uint64_t *addr,uint64_t value, -struct drm_xe_engine_class_instance *eci,int64_t timeout) {struct drm_xe_wait_user_fence wait = { .addr =to_user_pointer (addr), .op =DRM_XE_UFENCE_WAIT_OP_EQ , - .flags = !eci ?DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP |DRM_XE_UFENCE_WAIT_FLAG_ABSTIME :0 , + .flags =DRM_XE_UFENCE_WAIT_FLAG_ABSTIME , .value = value, .mask =DRM_XE_UFENCE_WAIT_MASK_U64 , .timeout = timeout, - .num_engines = eci ?1 :0 , - .instances = eci ?to_user_pointer (eci) :0 , };struct timespec ts;
lib/xe/xe_ioctl.h +0 -2
@@ -84,10 +84,8 @@ void xe_exec_sync(int fd, uint32_t exec_queue, uint64_t addr, struct drm_xe_sync *sync, uint32_t num_syncs);void xe_exec_wait (int fd,uint32_t exec_queue,uint64_t addr);int64_t xe_wait_ufence (int fd,uint64_t *addr,uint64_t value, -struct drm_xe_engine_class_instance *eci,int64_t timeout);int64_t xe_wait_ufence_abstime (int fd,uint64_t *addr,uint64_t value, -struct drm_xe_engine_class_instance *eci,int64_t timeout);void xe_force_gt_reset (int fd,int gt);
tests/intel/xe_evict.c +2 -2
@@ -320,7 +320,7 @@ test_evict_cm(int fd, struct drm_xe_query_engine_info *engine, }#define TWENTY_SEC MS_TO_NS(20000)xe_wait_ufence (fd, &data[i].vm_sync,USER_FENCE_VALUE , -NULL ,TWENTY_SEC ); +TWENTY_SEC ); } sync[0 ].addr = addr + (char *)&data[i].exec_sync - (char *)data;
@@ -355,7 +355,7 @@ test_evict_cm(int fd, struct drm_xe_query_engine_info *engine, data =xe_bo_map (fd, __bo,ALIGN (sizeof (*data) * n_execs,0x1000 ));xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , -NULL ,TWENTY_SEC ); +TWENTY_SEC );igt_assert_eq (data[i].data,0xc0ffee ); }munmap (data,ALIGN (sizeof (*data) * n_execs,0x1000 ));
tests/intel/xe_exec_balancer.c +6 -6
@@ -515,7 +515,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs, bo_size, sync, 1);#define ONE_SEC MS_TO_NS(1000) -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL ,ONE_SEC ); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,ONE_SEC ); data[0 ].vm_sync =0 ;for (i =0 ; i < n_execs; i++) {
@@ -546,7 +546,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,if (flags &REBIND && i +1 != n_execs) {xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , -NULL ,ONE_SEC ); +ONE_SEC );xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size,NULL ,0 );
@@ -561,7 +561,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs, addr, bo_size, sync, 1);xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , -NULL ,ONE_SEC ); +ONE_SEC ); data[0 ].vm_sync =0 ; }
@@ -574,7 +574,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,* an invalidate. */ xe_wait_ufence (fd, &data[i].exec_sync, -USER_FENCE_VALUE ,NULL ,ONE_SEC ); +USER_FENCE_VALUE ,ONE_SEC );igt_assert_eq (data[i].data,0xc0ffee ); }else if (i *2 != n_execs) {/*
@@ -603,7 +603,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs, j = flags &INVALIDATE && n_execs ? n_execs -1 :0 ;for (i = j; i < n_execs; i++) -xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE ,NULL , +xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE ,ONE_SEC );/* Wait for all execs to complete */
@@ -612,7 +612,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs, sync[0 ].addr =to_user_pointer (&data[0 ].vm_sync);xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size, sync,1 ); -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL ,ONE_SEC ); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,ONE_SEC );for (i = (flags &INVALIDATE && n_execs) ? n_execs -1 :0 ; i < n_execs; i++)
tests/intel/xe_exec_compute_mode.c +6 -6
@@ -171,7 +171,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, fence_timeout =igt_run_in_simulation () ?HUNDRED_SEC :ONE_SEC ; -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL , +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , fence_timeout); data[0 ].vm_sync =0 ;
@@ -198,7 +198,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine,if (flags &REBIND && i +1 != n_execs) {xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , -NULL , fence_timeout); + fence_timeout);xe_vm_unbind_async (fd, vm, bind_exec_queues[e],0 , addr, bo_size,NULL ,0 );
@@ -214,7 +214,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, addr, bo_size, sync, 1);xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , -NULL , fence_timeout); + fence_timeout); data[0 ].vm_sync =0 ; }
@@ -227,7 +227,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine,* an invalidate. */ xe_wait_ufence (fd, &data[i].exec_sync, -USER_FENCE_VALUE ,NULL , +USER_FENCE_VALUE , fence_timeout);igt_assert_eq (data[i].data,0xc0ffee ); }else if (i *2 != n_execs) {
@@ -257,7 +257,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, j = flags &INVALIDATE ? n_execs -1 :0 ;for (i = j; i < n_execs; i++) -xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE ,NULL , +xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , fence_timeout);/* Wait for all execs to complete */
@@ -267,7 +267,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, sync[0 ].addr =to_user_pointer (&data[0 ].vm_sync);xe_vm_unbind_async (fd, vm, bind_exec_queues[0 ],0 , addr, bo_size, sync,1 ); -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL , +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , fence_timeout);for (i = j; i < n_execs; i++)
tests/intel/xe_exec_fault_mode.c +7 -7
@@ -195,14 +195,14 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, }#define ONE_SEC MS_TO_NS(1000) -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL ,ONE_SEC ); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,ONE_SEC ); data[0 ].vm_sync =0 ;if (flags &PREFETCH ) {/* Should move to system memory */ xe_vm_prefetch_async (fd, vm, bind_exec_queues[0 ],0 , addr, bo_size, sync,1 ,0 ); -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL , +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,ONE_SEC ); data[0 ].vm_sync =0 ; }
@@ -230,7 +230,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine,if (flags &REBIND && i +1 != n_execs) {xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , -NULL ,ONE_SEC ); +ONE_SEC );xe_vm_unbind_async (fd, vm, bind_exec_queues[e],0 , addr, bo_size,NULL ,0 );
@@ -246,7 +246,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, addr, bo_size, sync, 1);xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , -NULL ,ONE_SEC ); +ONE_SEC ); data[0 ].vm_sync =0 ; }
@@ -259,7 +259,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine,* an invalidate. */ xe_wait_ufence (fd, &data[i].exec_sync, -USER_FENCE_VALUE ,NULL ,ONE_SEC ); +USER_FENCE_VALUE ,ONE_SEC );igt_assert_eq (data[i].data,0xc0ffee ); }else if (i *2 != n_execs) {/*
@@ -290,13 +290,13 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, j = flags &INVALIDATE ? n_execs -1 :0 ;for (i = j; i < n_execs; i++)xe_wait_ufence (fd, &data[i].exec_sync, -USER_FENCE_VALUE ,NULL ,ONE_SEC ); +USER_FENCE_VALUE ,ONE_SEC ); } sync[0 ].addr =to_user_pointer (&data[0 ].vm_sync);xe_vm_unbind_async (fd, vm, bind_exec_queues[0 ],0 , addr, bo_size, sync,1 ); -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL ,ONE_SEC ); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,ONE_SEC );if (!(flags &INVALID_FAULT )) {for (i = j; i < n_execs; i++)
tests/intel/xe_exec_reset.c +3 -3
@@ -580,7 +580,7 @@ test_compute_mode(int fd, struct drm_xe_query_engine_info *engine,xe_vm_bind_async (fd, vm,0 , bo,0 , addr, bo_size, sync,1 );#define THREE_SEC MS_TO_NS(3000) -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL ,THREE_SEC ); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,THREE_SEC ); data[0 ].vm_sync =0 ;for (i =0 ; i < n_execs; i++) {
@@ -634,11 +634,11 @@ test_compute_mode(int fd, struct drm_xe_query_engine_info *engine,for (i =1 ; i < n_execs; i++)xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , -NULL ,THREE_SEC ); +THREE_SEC ); sync[0 ].addr =to_user_pointer (&data[0 ].vm_sync);xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size, sync,1 ); -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL ,THREE_SEC ); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,THREE_SEC );for (i =1 ; i < n_execs; i++)igt_assert_eq (data[i].data,0xc0ffee );
tests/intel/xe_exec_threads.c +6 -6
@@ -343,7 +343,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, fence_timeout =igt_run_in_simulation () ?THIRTY_SEC :THREE_SEC ; -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL , fence_timeout); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , fence_timeout); data[0 ].vm_sync =0 ;for (i =0 ; i < n_execs; i++) {
@@ -371,7 +371,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,for (j = i -0x20 ; j <= i; ++j)xe_wait_ufence (fd, &data[j].exec_sync,USER_FENCE_VALUE , -NULL , fence_timeout); + fence_timeout);xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size,NULL ,0 );
@@ -386,7 +386,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, addr, bo_size, sync, 1);xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , -NULL , fence_timeout); + fence_timeout); data[0 ].vm_sync =0 ; }
@@ -401,7 +401,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,for (j = i ==0x20 ?0 : i -0x1f ; j <= i; ++j)xe_wait_ufence (fd, &data[j].exec_sync,USER_FENCE_VALUE , -NULL , fence_timeout); + fence_timeout);igt_assert_eq (data[i].data,0xc0ffee ); }else if (i *2 != n_execs) {/*
@@ -433,7 +433,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, j = flags &INVALIDATE ? (flags &RACE ? n_execs /2 +1 : n_execs -1 ) :0 ;for (i = j; i < n_execs; i++) -xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE ,NULL , +xe_wait_ufence (fd, &data[i].exec_sync,USER_FENCE_VALUE , fence_timeout);/* Wait for all execs to complete */
@@ -442,7 +442,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr, sync[0 ].addr =to_user_pointer (&data[0 ].vm_sync);xe_vm_unbind_async (fd, vm,0 ,0 , addr, bo_size, sync,1 ); -xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE ,NULL , fence_timeout); +xe_wait_ufence (fd, &data[0 ].vm_sync,USER_FENCE_VALUE , fence_timeout);for (i = j; i < n_execs; i++)igt_assert_eq (data[i].data,0xc0ffee );
tests/intel/xe_waitfence.c +2 -2
@@ -80,7 +80,7 @@ waitfence(int fd, enum waittype wt)do_bind (fd, vm, bo_7,0 ,0xeffff0000 ,0x10000 ,7 );if (wt ==RELTIME ) { - timeout =xe_wait_ufence (fd, &wait_fence,7 ,NULL ,MS_TO_NS (10 )); + timeout =xe_wait_ufence (fd, &wait_fence,7 ,MS_TO_NS (10 ));igt_debug ("wait type: RELTIME - timeout: %ld, timeout left: %ld\n" ,MS_TO_NS (10 ), timeout); }else {
@@ -90,7 +90,7 @@ waitfence(int fd, enum waittype wt)clock_gettime (CLOCK_MONOTONIC , &ts); current = ts.tv_sec *1e9 + ts.tv_nsec; timeout = current +MS_TO_NS (10 ); - signalled =xe_wait_ufence_abstime (fd, &wait_fence,7 ,NULL , timeout); + signalled =xe_wait_ufence_abstime (fd, &wait_fence,7 , timeout); igt_debug("wait type: ABSTIME - timeout: %" PRId64 ", signalled: %" PRId64 ", elapsed: %" PRId64 "\n",
Signature · 1 line
2.34.1
PATCH v3 53/57 drm-uapi/xe: Align on a common way to return arrays (memory regions)
In reply to Francois DugastAlign with commit ("drm/xe/uapi: Align on a common way to return arrays (memory regions)")
--- include/drm-uapi/xe_drm.h | 38 ++++++++++---------- lib/xe/xe_query.c | 72 ++++++++++++++++++------------------- lib/xe/xe_query.h | 4 +-- lib/xe/xe_util.c | 6 ++-- tests/intel/xe_create.c | 2 +- tests/intel/xe_drm_fdinfo.c | 8 ++--- tests/intel/xe_pm.c | 12 +++---- tests/intel/xe_query.c | 44 +++++++++++------------ tests/kms_plane.c | 2 +- 9 files changed, 94 insertions(+), 94 deletions(-)
include/drm-uapi/xe_drm.h +19 -19
@@ -236,23 +236,23 @@ struct drm_xe_query_engine_info {/** * @near_mem_regions: Bit mask of instances from -* drm_xe_query_mem_regions that is near this engine. +* drm_xe_query_mem_region that is near this engine. * Each index in this mask refers directly to the struct -* drm_xe_query_mem_regions' instance, no assumptions should +* drm_xe_query_mem_region's instance, no assumptions should * be made about order. The type of each region is described -* by struct drm_xe_query_mem_regions' mem_class. +* by struct drm_xe_mem_region's mem_class. */ __u64 near_mem_regions;/** * @far_mem_regions: Bit mask of instances from -* drm_xe_query_mem_regions that is far from this engine. +* drm_xe_query_mem_region that is far from this engine. * In general, it has extra indirections when compared to the * @near_mem_regions. For a discrete device this could mean system * memory and memory living in a different Tile. * Each index in this mask refers directly to the struct -* drm_xe_query_mem_regions' instance, no assumptions should +* drm_xe_query_mem_region's instance, no assumptions should * be made about order. The type of each region is described -* by struct drm_xe_query_mem_regions' mem_class. +* by struct drm_xe_mem_region's mem_class. */ __u64 far_mem_regions;
@@ -275,10 +275,10 @@ enum drm_xe_memory_class { };/** -* struct drm_xe_query_mem_region - Describes some region as known to +* struct drm_xe_mem_region - Describes some region as known to * the driver. */ -struct drm_xe_query_mem_region { +struct drm_xe_mem_region {/** * @mem_class: The memory class describing this region. *
@@ -353,19 +353,19 @@ struct drm_xe_query_mem_region { };/** -* struct drm_xe_query_mem_regions - describe memory regions +* struct drm_xe_query_mem_region - describe memory regions * * If a query is made with a struct drm_xe_device_query where .query -* is equal to DRM_XE_DEVICE_QUERY_MEM_REGIONS, then the reply uses -* struct drm_xe_query_mem_regions in .data. +* is equal to DRM_XE_DEVICE_QUERY_MEM_REGION, then the reply uses +* struct drm_xe_query_mem_region in .data. */ -struct drm_xe_query_mem_regions { -/** @num_regions: number of memory regions returned in @regions */ -__u32 num_regions; +struct drm_xe_query_mem_region { +/** @num_mem_regions: number of memory regions returned in @mem_regions */ +__u32 num_mem_regions;/** @pad: MBZ */ __u32 pad; -/** @regions: The returned regions for this device */ -struct drm_xe_query_mem_region regions[]; +/** @mem_regions: The returned memory regions for this device */ +struct drm_xe_mem_region mem_regions[]; };/**
@@ -653,7 +653,7 @@ struct drm_xe_device_query {__u64 extensions;#define DRM_XE_DEVICE_QUERY_ENGINES 0 -#define DRM_XE_DEVICE_QUERY_MEM_REGIONS 1 +#define DRM_XE_DEVICE_QUERY_MEM_REGION 1#define DRM_XE_DEVICE_QUERY_CONFIG 2#define DRM_XE_DEVICE_QUERY_GT_LIST 3#define DRM_XE_DEVICE_QUERY_HWCONFIG 4
@@ -710,9 +710,9 @@ struct drm_xe_gem_create {/** * @placement: A mask of memory instances of where GEM can be placed. * Each index in this mask refers directly to the struct -* drm_xe_query_mem_regions' instance, no assumptions should +* drm_xe_query_mem_region's instance, no assumptions should * be made about order. The type of each region is described -* by struct drm_xe_query_mem_regions' mem_class. +* by struct drm_xe_mem_region's mem_class. */ __u32 placement;
lib/xe/xe_query.c +36 -36
163 lines not on this page · raw message
lib/xe/xe_query.h +2 -2
@@ -39,7 +39,7 @@ struct xe_device {unsigned int number_engines;/** @mem_regions: regions memory information and usage */ -struct drm_xe_query_mem_regions *mem_regions; +struct drm_xe_query_mem_region *mem_regions;/** @default_alignment: safe alignment regardless region location */ uint32_t default_alignment;
@@ -82,7 +82,7 @@ uint64_t any_vram_if_possible(int fd);uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_query_engine_info *engine);struct drm_xe_query_engine_info *xe_engines (int fd);struct drm_xe_query_engine_info *xe_engine (int fd,int idx); -struct drm_xe_query_mem_region *xe_mem_region (int fd,uint64_t region); +struct drm_xe_mem_region *xe_mem_region (int fd,uint64_t region);const char *xe_region_name (uint64_t region);uint16_t xe_region_class (int fd,uint64_t region);uint32_t xe_min_page_size (int fd,uint64_t region);
lib/xe/xe_util.c +3 -3
@@ -10,7 +10,7 @@#include "xe/xe_query.h" #include "xe/xe_util.h" -static bool __region_belongs_to_regions_type (struct drm_xe_query_mem_region *region, +static bool __region_belongs_to_regions_type (struct drm_xe_mem_region *region,uint32_t *mem_regions_type,int num_regions) {
@@ -23,7 +23,7 @@ static bool __region_belongs_to_regions_type(struct drm_xe_query_mem_region *regstruct igt_collection *__xe_get_memory_region_set (int xe,uint32_t *mem_regions_type,int num_regions) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;struct igt_collection *set =NULL ;uint64_t memreg =all_memory_regions (xe), region;int count =0 , pos =0 ;
@@ -78,7 +78,7 @@ char *xe_memregion_dynamic_subtest_name(int xe, struct igt_collection *set)igt_assert (name);for_each_collection_data (data, set) { -struct drm_xe_query_mem_region *memreg; +struct drm_xe_mem_region *memreg;int r; region = data->value;
tests/intel/xe_create.c +1 -1
@@ -48,7 +48,7 @@ static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t placement,*/ static void create_invalid_size (int fd) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (fd), region;uint32_t vm;uint32_t handle;
tests/intel/xe_drm_fdinfo.c +4 -4
@@ -42,7 +42,7 @@ IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption using fdinfo/* Subtests */ static void test_active (int fd,struct drm_xe_query_engine_info *engine) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (fd), region;struct drm_client_fdinfo info = { };uint32_t vm;
@@ -171,7 +171,7 @@ static void test_active(int fd, struct drm_xe_query_engine_info *engine)static void test_shared (int xe) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (xe), region;struct drm_client_fdinfo info = { };struct drm_gem_flink flink;
@@ -216,7 +216,7 @@ static void test_shared(int xe)static void test_total_resident (int xe) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (xe), region;struct drm_client_fdinfo info = { };uint32_t vm;
@@ -264,7 +264,7 @@ static void test_total_resident(int xe)static void basic (int xe) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (xe), region;struct drm_client_fdinfo info = { };unsigned int ret;
tests/intel/xe_pm.c +6 -6
@@ -375,10 +375,10 @@ NULL));*/ static void test_vram_d3cold_threshold (device_t device,int sysfs_fd) { -struct drm_xe_query_mem_regions *mem_regions; +struct drm_xe_query_mem_region *mem_regions;struct drm_xe_device_query query = { .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_MEM_REGIONS , + .query =DRM_XE_DEVICE_QUERY_MEM_REGION , .size =0 , .data =0 , };
@@ -402,10 +402,10 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd) query.data =to_user_pointer (mem_regions);igt_assert_eq (igt_ioctl (device.fd_xe,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); -for (i =0 ; i < mem_regions->num_regions; i++) { -if (mem_regions->regions[i].mem_class ==DRM_XE_MEM_REGION_CLASS_VRAM ) { - vram_used_mb += (mem_regions->regions[i].used / (1024 *1024 )); - vram_total_mb += (mem_regions->regions[i].total_size / (1024 *1024 )); +for (i =0 ; i < mem_regions->num_mem_regions; i++) { +if (mem_regions->mem_regions[i].mem_class ==DRM_XE_MEM_REGION_CLASS_VRAM ) { + vram_used_mb += (mem_regions->mem_regions[i].used / (1024 *1024 )); + vram_total_mb += (mem_regions->mem_regions[i].total_size / (1024 *1024 )); } }
tests/intel/xe_query.c +22 -22
66 lines not on this page · raw message
tests/kms_plane.c +1 -1
@@ -458,7 +458,7 @@ test_plane_panning(data_t *data, enum pipe pipe) }if (is_xe_device (data->drm_fd)) { -struct drm_xe_query_mem_region *memregion; +struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (data->drm_fd), region;xe_for_each_mem_region (data->drm_fd, memreg, region) {
Signature · 1 line
2.34.1
PATCH v3 54/57 drm-uapi/xe: Align on a common way to return arrays (gt)
In reply to Francois DugastAlign with commit ("drm/xe/uapi: Align on a common way to return arrays (gt)")
--- include/drm-uapi/xe_drm.h | 20 ++++++++++---------- lib/xe/xe_query.c | 16 ++++++++-------- lib/xe/xe_query.h | 4 ++-- tests/intel-ci/xe-fast-feedback.testlist | 2 +- tests/intel/xe_query.c | 12 ++++++------ 5 files changed, 27 insertions(+), 27 deletions(-)
include/drm-uapi/xe_drm.h +10 -10
@@ -415,14 +415,14 @@ struct drm_xe_query_config { };/** -* struct drm_xe_query_gt - describe an individual GT. +* struct drm_xe_gt - describe an individual GT. * -* To be used with drm_xe_query_gt_list, which will return a list with all the +* To be used with drm_xe_query_gt, which will return a list with all the * existing GT individual descriptions. * Graphics Technology (GT) is a subset of a GPU/tile that is responsible for * implementing graphics and/or media operations. */ -struct drm_xe_query_gt { +struct drm_xe_gt {#define DRM_XE_QUERY_GT_TYPE_MAIN 0#define DRM_XE_QUERY_GT_TYPE_MEDIA 1/** @type: GT type: Main or Media */
@@ -438,19 +438,19 @@ struct drm_xe_query_gt { };/** -* struct drm_xe_query_gt_list - A list with GT description items. +* struct drm_xe_query_gt - A list with GT description items. * * If a query is made with a struct drm_xe_device_query where .query -* is equal to DRM_XE_DEVICE_QUERY_GT_LIST, then the reply uses struct -* drm_xe_query_gt_list in .data. +* is equal to DRM_XE_DEVICE_QUERY_GT, then the reply uses struct +* drm_xe_query_gt in .data. */ -struct drm_xe_query_gt_list { +struct drm_xe_query_gt {/** @num_gt: number of GT items returned in gt_list */ __u32 num_gt;/** @pad: MBZ */ __u32 pad;/** @gt_list: The GT list returned for this device */ -struct drm_xe_query_gt gt_list[]; +struct drm_xe_gt gt_list[]; };/**
@@ -605,7 +605,7 @@ struct drm_xe_query_uc_fw_version {* - %DRM_XE_DEVICE_QUERY_ENGINES * - %DRM_XE_DEVICE_QUERY_MEM_REGIONS * - %DRM_XE_DEVICE_QUERY_CONFIG -* - %DRM_XE_DEVICE_QUERY_GT_LIST - Query type to retrieve the hardware +* - %DRM_XE_DEVICE_QUERY_GT - Query type to retrieve the hardware * configuration of the device such as information on slices, memory, * caches, and so on. It is provided as a table of key / value * attributes.
@@ -655,7 +655,7 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_ENGINES 0#define DRM_XE_DEVICE_QUERY_MEM_REGION 1#define DRM_XE_DEVICE_QUERY_CONFIG 2 -#define DRM_XE_DEVICE_QUERY_GT_LIST 3 +#define DRM_XE_DEVICE_QUERY_GT 3#define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6
lib/xe/xe_query.c +8 -8
@@ -39,12 +39,12 @@ static struct drm_xe_query_config *xe_query_config_new(int fd)return config; } -static struct drm_xe_query_gt_list *xe_query_gt_list_new (int fd) +static struct drm_xe_query_gt *xe_query_gt_new (int fd) { -struct drm_xe_query_gt_list *gt_list; +struct drm_xe_query_gt *gt_list;struct drm_xe_device_query query = { .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_GT_LIST , + .query =DRM_XE_DEVICE_QUERY_GT , .size =0 , .data =0 , };
@@ -196,7 +196,7 @@ static struct xe_device *find_in_cache(int fd)static void xe_device_free (struct xe_device *xe_dev) {free (xe_dev->config); -free (xe_dev->gt_list); +free (xe_dev->gt);free (xe_dev->engines);free (xe_dev->mem_regions);free (xe_dev);
@@ -226,7 +226,7 @@ struct xe_device *xe_device_get(int fd) xe_dev->config =xe_query_config_new (fd); 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 =xe_query_gt_new (fd); xe_dev->engines =xe_query_engines (fd, &xe_dev->number_engines); xe_dev->mem_regions =xe_query_mem_regions_new (fd); xe_dev->all_memory_regions_mask =__all_memory_regions (xe_dev->mem_regions);
@@ -321,9 +321,9 @@ _TYPE _NAME(int fd) \* xe_number_gt: * @fd: xe device fd * -* Return number of gt_list for xe device fd. +* Return number of gt for xe device fd. */ -xe_dev_FN(xe_number_gt, gt_list->num_gt, unsigned int); +xe_dev_FN(xe_number_gt, gt->num_gt, unsigned int);/** * all_memory_regions:
@@ -596,7 +596,7 @@ uint32_t xe_gt_reference_clock(int fd, int gt)igt_assert (gt >=0 && gt <xe_number_gt (fd)); -return xe_dev->gt_list->gt_list[gt].reference_clock; +return xe_dev->gt->gt_list[gt].reference_clock; }/**
lib/xe/xe_query.h +2 -2
@@ -26,8 +26,8 @@ struct xe_device {/** @config: xe configuration */ struct drm_xe_query_config *config; -/** @gt_list: gt info */ -struct drm_xe_query_gt_list *gt_list; +/** @gt: gt info */ +struct drm_xe_query_gt *gt;/** @gt_list: bitmask of all memory regions */ uint64_t all_memory_regions_mask;
tests/intel-ci/xe-fast-feedback.testlist +1 -1
@@ -116,7 +116,7 @@ igt@xe_prime_self_import@basic-with_fd_dup #igt@xe_prime_self_import@basic-llseek-size igt@xe_query@query-engines igt@xe_query@query-mem-usage -igt@xe_query@query-gt-list +igt@xe_query@query-gt igt@xe_query@query-config igt@xe_query@query-hwconfig igt@xe_query@query-topology
tests/intel/xe_query.c +6 -6
@@ -278,17 +278,17 @@ test_query_mem_regions(int fd) }/** -* SUBTEST: query-gt-list +* SUBTEST: query-gt * Test category: functionality test * Description: Display information about available GT components for xe device. */ static void -test_query_gt_list (int fd) +test_query_gt (int fd) { -struct drm_xe_query_gt_list *gt_list; +struct drm_xe_query_gt *gt_list;struct drm_xe_device_query query = { .extensions =0 , - .query =DRM_XE_DEVICE_QUERY_GT_LIST , + .query =DRM_XE_DEVICE_QUERY_GT , .size =0 , .data =0 , };
@@ -697,8 +697,8 @@ igt_main igt_subtest("query-mem-usage")test_query_mem_regions (xe); - igt_subtest("query-gt-list") -test_query_gt_list (xe); + igt_subtest("query-gt") +test_query_gt (xe); igt_subtest("query-config")test_query_config (xe);
Signature · 1 line
2.34.1
PATCH v3 55/57 drm-uapi/xe: Align on a common way to return arrays (engines)
In reply to Francois DugastAlign with commit ("drm/xe/uapi: Align on a common way to return arrays (engines)")
--- benchmarks/gem_wsim.c | 6 +-- include/drm-uapi/xe_drm.h | 78 ++++++++++++++++++------------ lib/xe/xe_query.c | 32 ++++++------ lib/xe/xe_query.h | 15 +++--- lib/xe/xe_spin.c | 2 +- lib/xe/xe_spin.h | 2 +- tests/intel/xe_create.c | 2 +- tests/intel/xe_dma_buf_sync.c | 6 +-- tests/intel/xe_drm_fdinfo.c | 2 +- tests/intel/xe_evict.c | 10 ++-- tests/intel/xe_exec_balancer.c | 6 +-- tests/intel/xe_exec_basic.c | 4 +- tests/intel/xe_exec_compute_mode.c | 4 +- tests/intel/xe_exec_fault_mode.c | 4 +- tests/intel/xe_exec_reset.c | 10 ++-- tests/intel/xe_exec_store.c | 8 +-- tests/intel/xe_exec_threads.c | 10 ++-- tests/intel/xe_guc_pc.c | 4 +- tests/intel/xe_huc_copy.c | 2 +- tests/intel/xe_noexec_ping_pong.c | 2 +- tests/intel/xe_perf_pmu.c | 6 +-- tests/intel/xe_pm.c | 4 +- tests/intel/xe_pm_residency.c | 6 +-- tests/intel/xe_query.c | 6 +-- tests/intel/xe_spin_batch.c | 2 +- tests/intel/xe_vm.c | 16 +++--- 26 files changed, 129 insertions(+), 120 deletions(-)
benchmarks/gem_wsim.c +3 -3
@@ -644,10 +644,10 @@ get_engine(enum intel_engine_id engine)return ci; } -static struct drm_xe_query_engine_info * +static struct drm_xe_engine *xe_get_engine (enum intel_engine_id engine_class) { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci = {}, *eci1;bool found_physical = false;
@@ -2253,7 +2253,7 @@ static int prepare_contexts(unsigned int id, struct workload *wrk)static int xe_prepare_contexts (unsigned int id,struct workload *wrk) { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct xe_exec_queue *eq;struct w_step *w;struct ctx *ctx;
include/drm-uapi/xe_drm.h +47 -31
103 lines not on this page · raw message
lib/xe/xe_query.c +14 -18
@@ -70,10 +70,9 @@ static uint64_t __all_memory_regions(struct drm_xe_query_mem_region *mem_regionsreturn regions; } -static struct drm_xe_query_engine_info * -xe_query_engines (int fd,unsigned int *num_engines) +static struct drm_xe_query_engine *xe_query_engines (int fd) { -struct drm_xe_query_engine_info *engines; +struct drm_xe_query_engine *engines;struct drm_xe_device_query query = { .extensions =0 , .query =DRM_XE_DEVICE_QUERY_ENGINES ,
@@ -81,7 +80,6 @@ xe_query_engines(int fd, unsigned int *num_engines) .data = 0, }; -igt_assert (num_engines);igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); engines =malloc (query.size);
@@ -90,8 +88,6 @@ xe_query_engines(int fd, unsigned int *num_engines) query.data =to_user_pointer (engines);igt_assert_eq (igt_ioctl (fd,DRM_IOCTL_XE_DEVICE_QUERY , &query),0 ); - *num_engines = query.size /sizeof (*engines); -return engines; }
@@ -116,7 +112,7 @@ static struct drm_xe_query_mem_region *xe_query_mem_regions_new(int fd)return mem_regions; } -static uint64_t mem_region_near_engine (struct drm_xe_query_engine_info *engine) +static uint64_t mem_region_near_engine (struct drm_xe_engine *engine) {uint64_t region;
@@ -227,7 +223,7 @@ struct xe_device *xe_device_get(int fd) 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 =xe_query_gt_new (fd); - xe_dev->engines =xe_query_engines (fd, &xe_dev->number_engines); + xe_dev->engines =xe_query_engines (fd); xe_dev->mem_regions =xe_query_mem_regions_new (fd); xe_dev->all_memory_regions_mask =__all_memory_regions (xe_dev->mem_regions); xe_dev->default_alignment =__mem_default_alignment (xe_dev->mem_regions);
@@ -373,7 +369,7 @@ uint64_t any_vram(int fd)* * Returns memory bitmask for the vram region that is near the given @engine. */ -uint64_t vram_near_engine (int fd,struct drm_xe_query_engine_info *engine) +uint64_t vram_near_engine (int fd,struct drm_xe_engine *engine) {struct xe_device *xe_dev;
@@ -405,7 +401,7 @@ uint64_t any_vram_if_possible(int fd)* vram region near the given @engine. Otherwise it returns a bitmask for a * system memory region. */ -uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_query_engine_info *engine) +uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_engine *engine) {return vram_near_engine (fd, engine) ?:system_memory (fd); }
@@ -416,7 +412,7 @@ uint64_t vram_near_engine_if_possible(int fd, struct drm_xe_query_engine_info *e* * Returns engines array of xe device @fd. */ -xe_dev_FN(xe_engines, engines, struct drm_xe_query_engine_info *); +xe_dev_FN(xe_engines, engines->engines, struct drm_xe_engine *);/** * xe_engine:
@@ -425,15 +421,15 @@ xe_dev_FN(xe_engines, engines, struct drm_xe_query_engine_info *);* * Returns engine info of xe device @fd and @idx. */ -struct drm_xe_query_engine_info *xe_engine (int fd,int idx) +struct drm_xe_engine *xe_engine (int fd,int idx) {struct xe_device *xe_dev; xe_dev =find_in_cache (fd);igt_assert (xe_dev); -igt_assert (idx >=0 && idx < xe_dev->number_engines); +igt_assert (idx >=0 && idx < xe_dev->engines->num_engines); -return &xe_dev->engines[idx]; +return &xe_dev->engines->engines[idx]; }/**
@@ -523,7 +519,7 @@ xe_dev_FN(xe_config, config, struct drm_xe_query_config *);* * Returns number of hw engines of xe device @fd. */ -xe_dev_FN(xe_number_engines, number_engines, unsigned int); +xe_dev_FN(xe_number_engines, engines->num_engines, unsigned int);/** * xe_has_vram:
@@ -563,7 +559,7 @@ uint64_t xe_vram_size_any_region(int fd)uint64_t xe_vram_size_region_near_tile (int fd,int tile) {struct xe_device *xe_dev; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; xe_dev =find_in_cache (fd);igt_assert (xe_dev);
@@ -694,8 +690,8 @@ bool xe_has_engine_class(int fd, uint16_t engine_class) xe_dev =find_in_cache (fd);igt_assert (xe_dev); -for (int i =0 ; i < xe_dev->number_engines; i++) -if (xe_dev->engines[i].instance.engine_class == engine_class) +for (int i =0 ; i < xe_dev->engines->num_engines; i++) +if (xe_dev->engines->engines[i].instance.engine_class == engine_class)return true;return false;
lib/xe/xe_query.h +6 -9
@@ -32,11 +32,8 @@ struct xe_device {/** @gt_list: bitmask of all memory regions */ uint64_t all_memory_regions_mask; -/** @engines: array of hardware engines */ -struct drm_xe_query_engine_info *engines; - -/** @number_engines: length of hardware engines array */ -unsigned int number_engines; +/** @engines: hardware engines */ +struct drm_xe_query_engine *engines;/** @mem_regions: regions memory information and usage */ struct drm_xe_query_mem_region *mem_regions;
@@ -77,11 +74,11 @@ unsigned int xe_number_gt(int fd);uint64_t all_memory_regions (int fd);uint64_t system_memory (int fd);uint64_t any_vram (int fd); -uint64_t vram_near_engine (int fd,struct drm_xe_query_engine_info *engine); +uint64_t vram_near_engine (int fd,struct drm_xe_engine *engine);uint64_t any_vram_if_possible (int fd); -uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_query_engine_info *engine); -struct drm_xe_query_engine_info *xe_engines (int fd); -struct drm_xe_query_engine_info *xe_engine (int fd,int idx); +uint64_t vram_near_engine_if_possible (int fd,struct drm_xe_engine *engine); +struct drm_xe_engine *xe_engines (int fd); +struct drm_xe_engine *xe_engine (int fd,int idx);struct drm_xe_mem_region *xe_mem_region (int fd,uint64_t region);const char *xe_region_name (uint64_t region);uint16_t xe_region_class (int fd,uint64_t region);
lib/xe/xe_spin.c +1 -1
@@ -272,7 +272,7 @@ void xe_spin_free(int fd, struct igt_spin *spin)free (spin); } -void xe_cork_init (int fd,struct drm_xe_query_engine_info *engine, +void xe_cork_init (int fd,struct drm_xe_engine *engine,struct xe_cork *cork) {uint64_t addr =xe_get_default_alignment (fd);
lib/xe/xe_spin.h +1 -1
@@ -62,7 +62,7 @@ struct xe_cork {uint32_t syncobj; }; -void xe_cork_init (int fd,struct drm_xe_query_engine_info *engine, +void xe_cork_init (int fd,struct drm_xe_engine *engine,struct xe_cork *cork);bool xe_cork_started (struct xe_cork *cork);void xe_cork_wait_started (struct xe_cork *cork);
tests/intel/xe_create.c +1 -1
@@ -148,7 +148,7 @@ static void create_execqueues(int fd, enum exec_queue_destroy ed)igt_nsec_elapsed (&tv); igt_fork(n, nproc) { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;uint32_t exec_queue, exec_queues[exec_queues_per_process];int idx, err, i;
tests/intel/xe_dma_buf_sync.c +3 -3
@@ -87,8 +87,8 @@ static bool sync_file_busy(int sync_file)*/ static void -test_export_dma_buf (struct drm_xe_query_engine_info *engine0, -struct drm_xe_query_engine_info *engine1, +test_export_dma_buf (struct drm_xe_engine *engine0, +struct drm_xe_engine *engine1,int n_bo,int flags) {struct drm_xe_engine_class_instance *eci0 = &engine0->instance;
@@ -226,7 +226,7 @@ test_export_dma_buf(struct drm_xe_query_engine_info *engine0, igt_main { -struct drm_xe_query_engine_info *engine, *engine0 =NULL , *engine1; +struct drm_xe_engine *engine, *engine0 =NULL , *engine1;int fd; igt_fixture {
tests/intel/xe_drm_fdinfo.c +1 -1
@@ -40,7 +40,7 @@ IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption using fdinfo#define BO_SIZE (65536)/* Subtests */ -static void test_active (int fd,struct drm_xe_query_engine_info *engine) +static void test_active (int fd,struct drm_xe_engine *engine) {struct drm_xe_mem_region *memregion;uint64_t memreg =all_memory_regions (fd), region;
tests/intel/xe_evict.c +5 -5
@@ -30,7 +30,7 @@#define BIND_EXEC_QUEUE (0x1 << 6)static void -test_evict (int fd,struct drm_xe_query_engine_info *engine, +test_evict (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,size_t bo_size,unsigned long flags,pthread_barrier_t *barrier) {
@@ -212,7 +212,7 @@ test_evict(int fd, struct drm_xe_query_engine_info *engine, }static void -test_evict_cm (int fd,struct drm_xe_query_engine_info *engine, +test_evict_cm (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,size_t bo_size,unsigned long flags,pthread_barrier_t *barrier) {
@@ -382,7 +382,7 @@ struct thread_data {pthread_cond_t *cond;pthread_barrier_t *barrier;int fd; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;int n_exec_queues;int n_execs;uint64_t bo_size;
@@ -410,7 +410,7 @@ static void *thread(void *data) }static void -threads (int fd,struct drm_xe_query_engine_info *engine, +threads (int fd,struct drm_xe_engine *engine,int n_threads,int n_exec_queues,int n_execs,size_t bo_size,unsigned long flags) {
@@ -634,7 +634,7 @@ static uint64_t calc_bo_size(uint64_t vram_size, int mul, int div)*/ igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; const struct section { const char *name; int n_exec_queues;
tests/intel/xe_exec_balancer.c +3 -3
@@ -56,7 +56,7 @@ static void test_all_active(int fd, int gt, int class)struct xe_spin spin; } *data;struct xe_spin_opts spin_opts = { .preempt = false }; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, num_eng_per_bb =0 ;int sched_id =-1 ;
@@ -207,7 +207,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,uint64_t pad;uint32_t data; } *data; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 ;int sched_id =-1 ;
@@ -443,7 +443,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,uint64_t exec_sync;uint32_t data; } *data; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 ;int map_fd =-1 ;
tests/intel/xe_exec_basic.c +2 -2
@@ -77,7 +77,7 @@*/ static void -test_exec (int fd,struct drm_xe_query_engine_info *engine, +test_exec (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,int n_vm,unsigned int flags) {struct drm_xe_sync sync[2 ] = {
@@ -304,7 +304,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; const struct section { const char *name; unsigned int flags;
tests/intel/xe_exec_compute_mode.c +2 -2
@@ -81,7 +81,7 @@* @bindexecqueue-userptr-invalidate: bindexecqueue userptr invalidate */ static void -test_exec (int fd,struct drm_xe_query_engine_info *engine, +test_exec (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,unsigned int flags) {uint32_t vm;
@@ -292,7 +292,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; const struct section { const char *name; unsigned int flags;
tests/intel/xe_exec_fault_mode.c +2 -2
@@ -100,7 +100,7 @@*/ static void -test_exec (int fd,struct drm_xe_query_engine_info *engine, +test_exec (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,unsigned int flags) {uint32_t vm;
@@ -322,7 +322,7 @@ test_exec(int fd, struct drm_xe_query_engine_info *engine, igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; const struct section { const char *name; unsigned int flags;
tests/intel/xe_exec_reset.c +5 -5
@@ -25,7 +25,7 @@* SUBTEST: spin * Description: test spin */ -static void test_spin (int fd,struct drm_xe_query_engine_info *engine) +static void test_spin (int fd,struct drm_xe_engine *engine) {uint32_t vm;uint64_t addr =0x1a0000 ;
@@ -164,7 +164,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,uint32_t data; } *data;struct xe_spin_opts spin_opts = { .preempt = false }; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 , bad_batches =1 ;int sched_id =-1 ;
@@ -345,7 +345,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,*/ static void -test_legacy_mode (int fd,struct drm_xe_query_engine_info *engine, +test_legacy_mode (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,unsigned int flags) {uint32_t vm;
@@ -512,7 +512,7 @@ test_legacy_mode(int fd, struct drm_xe_query_engine_info *engine,*/ static void -test_compute_mode (int fd,struct drm_xe_query_engine_info *engine, +test_compute_mode (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,unsigned int flags) {uint32_t vm;
@@ -789,7 +789,7 @@ gt_reset(int fd, int n_threads, int n_sec) igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; const struct section { const char *name; unsigned int flags;
tests/intel/xe_exec_store.c +4 -4
@@ -64,7 +64,7 @@ static void store(int fd) .syncs = to_user_pointer(&sync), };struct data *data; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;uint32_t vm;uint32_t exec_queue;uint32_t syncobj;
@@ -119,7 +119,7 @@ static void store(int fd)* @cachelines: cachelines * @page-sized: page-sized */ -static void store_cachelines (int fd,struct drm_xe_query_engine_info *engine, +static void store_cachelines (int fd,struct drm_xe_engine *engine,unsigned int flags) {struct drm_xe_sync sync[2 ] = {
@@ -234,7 +234,7 @@ static void store_all(int fd, int gt, int class)uint64_t addr =0x100000 ;uint32_t bo =0 ;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ]; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;int i, num_eng_per_bb =0 ;int sched_id =-1 ;
@@ -309,7 +309,7 @@ static void store_all(int fd, int gt, int class) igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;int fd, class, gt; igt_fixture {
tests/intel/xe_exec_threads.c +5 -5
@@ -67,7 +67,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,uint64_t pad;uint32_t data; } *data; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int i, j, b, num_eng_per_bb =0 ;bool owns_vm = false, owns_fd = false;
@@ -261,7 +261,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,static void test_compute_mode (int fd,uint32_t vm,uint64_t addr,uint64_t userptr, -struct drm_xe_query_engine_info *engine, +struct drm_xe_engine *engine,int n_exec_queues,int n_execs,unsigned int flags) {#define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
@@ -467,7 +467,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,static void test_legacy_mode (int fd,uint32_t vm,uint64_t addr,uint64_t userptr, -struct drm_xe_query_engine_info *engine,int n_exec_queues, +struct drm_xe_engine *engine,int n_exec_queues,int n_execs,unsigned int flags) {struct drm_xe_sync sync[2 ] = {
@@ -712,7 +712,7 @@ struct thread_data {int gt;uint32_t vm_legacy_mode;uint32_t vm_compute_mode; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;int n_exec_queue;int n_exec;int flags;
@@ -978,7 +978,7 @@ static void *thread(void *data)static void threads (int fd,int flags) {struct thread_data *threads_data; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;uint64_t addr =0x1a0000 ;uint64_t userptr =0x00007000eadbe000 ;pthread_mutex_t mutex;
tests/intel/xe_guc_pc.c +2 -2
@@ -31,7 +31,7 @@*/ #define ACT_FREQ_LATENCY_US 100000 -static void exec_basic (int fd,struct drm_xe_query_engine_info *engine, +static void exec_basic (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs) {uint32_t vm;
@@ -387,7 +387,7 @@ static void test_reset(int fd, int gt_id, int cycles) igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;int fd;int gt;int ncpus =sysconf (_SC_NPROCESSORS_ONLN);
tests/intel/xe_huc_copy.c +1 -1
@@ -153,7 +153,7 @@ __test_huc_copy(int fd, uint32_t vm, struct drm_xe_engine_class_instance *hwe)static void test_huc_copy (int fd) { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;uint32_t vm;uint32_t tested_gts =0 ;
tests/intel/xe_noexec_ping_pong.c +1 -1
@@ -43,7 +43,7 @@* there is worked queued on one of the VM's compute exec_queues. */ -static void test_ping_pong (int fd,struct drm_xe_query_engine_info *engine) +static void test_ping_pong (int fd,struct drm_xe_engine *engine) {size_t vram_size =xe_vram_size_any_region (fd);size_t align =xe_get_default_alignment (fd);
tests/intel/xe_perf_pmu.c +3 -3
@@ -76,7 +76,7 @@ static uint64_t engine_group_get_config(int gt, int class)* Run type: FULL * */ -static void test_any_engine_busyness (int fd,struct drm_xe_query_engine_info *engine) +static void test_any_engine_busyness (int fd,struct drm_xe_engine *engine) {uint32_t vm;uint64_t addr =0x1a0000 ;
@@ -202,7 +202,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *nastruct xe_spin spin; } *data;struct xe_spin_opts spin_opts = { .addr = addr, .preempt = false }; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];int num_eng_per_bb =0 ;uint64_t config, count, idle;
@@ -298,7 +298,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; const struct section { const char *name; int class;
tests/intel/xe_pm.c +2 -2
@@ -224,7 +224,7 @@ static bool out_of_d3(device_t device, enum igt_acpi_d_state state)*/ static void -test_exec (device_t device,struct drm_xe_query_engine_info *engine, +test_exec (device_t device,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,enum igt_suspend_state s_state,enum igt_acpi_d_state d_state) {
@@ -442,7 +442,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd) igt_main { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;device_t device;uint32_t d3cold_allowed;int sysfs_fd;
tests/intel/xe_pm_residency.c +3 -3
@@ -72,7 +72,7 @@ static void close_fw_handle(int sig)close (fw_handle); } -static void exec_load (int fd,struct drm_xe_query_engine_info *engine,unsigned long *done) +static void exec_load (int fd,struct drm_xe_engine *engine,unsigned long *done) {uint32_t bo =0 ;uint32_t exec_queue, syncobj, vm;
@@ -226,7 +226,7 @@ static void test_idle_residency(int fd, int gt, enum test_type flag)assert_within_epsilon (residency_end - residency_start, elapsed_ms, tolerance); } -static void idle_residency_on_exec (int fd,struct drm_xe_query_engine_info *engine) +static void idle_residency_on_exec (int fd,struct drm_xe_engine *engine) {const int tol =20 ;unsigned long *done;
@@ -314,7 +314,7 @@ igt_mainuint32_t d3cold_allowed;int fd, gt;char pci_slot_name[NAME_MAX ]; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine; igt_fixture { fd =drm_open_driver (DRIVER_XE );
tests/intel/xe_query.c +3 -3
@@ -178,7 +178,7 @@ const char *get_topo_name(int value)static void test_query_engines (int fd) { -struct drm_xe_query_engine_info *engines; +struct drm_xe_engine *engines;struct drm_xe_engine_class_instance *eci;struct drm_xe_device_query query = { .extensions =0 ,
@@ -520,7 +520,7 @@ query_engine_cycles(int fd, struct drm_xe_query_engine_cycles *resp) }static void -__engine_cycles (int fd,struct drm_xe_query_engine_info *engine) +__engine_cycles (int fd,struct drm_xe_engine *engine) {struct drm_xe_query_engine_cycles ts1 = {};struct drm_xe_query_engine_cycles ts2 = {};
@@ -624,7 +624,7 @@ __engine_cycles(int fd, struct drm_xe_query_engine_info *engine)*/ static void test_query_engine_cycles (int fd) { -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;igt_require (query_engine_cycles_supported (fd));
tests/intel/xe_spin_batch.c +1 -1
@@ -100,7 +100,7 @@ static void spin_all(int fd, int gt, int class)int i, num_eng_per_bb =0 ;struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE ];igt_spin_t *spin[MAX_INSTANCE ]; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;int sched_id =-1 ; ahnd =intel_allocator_open (fd,0 ,INTEL_ALLOCATOR_RELOC );
tests/intel/xe_vm.c +8 -8
@@ -385,7 +385,7 @@ struct shared_pte_page_data {#define MAX_N_EXEC_QUEUES 4static void -shared_pte_page (int fd,struct drm_xe_query_engine_info *engine,int n_bo, +shared_pte_page (int fd,struct drm_xe_engine *engine,int n_bo,uint64_t addr_stride) {uint32_t vm;
@@ -571,7 +571,7 @@ shared_pte_page(int fd, struct drm_xe_query_engine_info *engine, int n_bo,#define CONFLICT (0x1 << 0)static void -test_bind_execqueues_independent (int fd,struct drm_xe_query_engine_info *engine, +test_bind_execqueues_independent (int fd,struct drm_xe_engine *engine,unsigned int flags) {uint32_t vm;
@@ -756,7 +756,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_query_engine_info *engine* Test category: functionality test */ static void -test_bind_array (int fd,struct drm_xe_query_engine_info *engine,int n_execs, +test_bind_array (int fd,struct drm_xe_engine *engine,int n_execs,unsigned int flags) {uint32_t vm;
@@ -948,7 +948,7 @@ test_bind_array(int fd, struct drm_xe_query_engine_info *engine, int n_execs,*/ static void -test_large_binds (int fd,struct drm_xe_query_engine_info *engine, +test_large_binds (int fd,struct drm_xe_engine *engine,int n_exec_queues,int n_execs,size_t bo_size,unsigned int flags) {
@@ -1107,7 +1107,7 @@ struct thread_data {int fd;uint32_t vm;uint64_t addr; -struct drm_xe_query_engine_info *engine; +struct drm_xe_engine *engine;void *map;int *exit; };
@@ -1235,7 +1235,7 @@ static void *hammer_thread(void *tdata)*/ static void -test_munmap_style_unbind (int fd,struct drm_xe_query_engine_info *engine, +test_munmap_style_unbind (int fd,struct drm_xe_engine *engine,int bo_n_pages,int n_binds,int unbind_n_page_offset,int unbind_n_pages,unsigned int flags)
@@ -1539,7 +1539,7 @@ try_again_after_invalidate:*/ static void -test_mmap_style_bind (int fd,struct drm_xe_query_engine_info *engine, +test_mmap_style_bind (int fd,struct drm_xe_engine *engine,int bo_n_pages,int n_binds,int unbind_n_page_offset,int unbind_n_pages,unsigned int flags) {
@@ -1771,7 +1771,7 @@ test_mmap_style_bind(int fd, struct drm_xe_query_engine_info *engine, igt_main { -struct drm_xe_query_engine_info *engine, *engine_non_copy =NULL ; +struct drm_xe_engine *engine, *engine_non_copy =NULL ;uint64_t bind_size;int fd; const struct section {
Signature · 1 line
2.34.1
PATCH v3 56/57 drm-uapi/xe: Add block diagram of a device
In reply to Francois DugastAlign with commit ("drm/xe/uapi: Add block diagram of a device")
--- include/drm-uapi/xe_drm.h | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
include/drm-uapi/xe_drm.h +41 -0
@@ -26,6 +26,47 @@ extern "C" {* */ +/** +* DOC: Xe Device Block Diagram +* +* The diagram below represents a high-level simplification of a discrete +* GPU supported by the Xe driver. It shows some device components which +* are necessary to understand this API, as well as how their relations +* to each other. This diagram does not represent real hardware:: +* +* ┌──────────────────────────────────────────────────────────────────┐ +* │ ┌──────────────────────────────────────────────────┐ ┌─────────┐ │ +* │ │ ┌───────────────────────┐ │ │ ┌─────┐ │ │ +* │ │ │ VRAM0 │ │ │ │VRAM1│ │ │ +* │ │ └───────────┬───────────┘ │ │ └──┬──┘ │ │ +* │ │ ┌────────────────────────┴─────────────────────┐ │ │ ┌──┴──┐ │ │ +* │ │ │ ┌─────────────────────┐ ┌─────────────────┐ │ │ │ │ │ │ │ +* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │ +* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │RCS0 │ │BCS0 │ │ │ │ │ │ │ │ │ +* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │ +* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │ +* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │VCS0 │ │VCS1 │ │ │ │ │ │ │ │ │ +* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │ +* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │ +* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │VECS0│ │VECS1│ │ │ │ │ │ ... │ │ │ +* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │ +* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │ +* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │CCS0 │ │CCS1 │ │ │ │ │ │ │ │ │ +* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │ +* │ │ │ └─────────DSS─────────┘ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │ +* │ │ │ │ │CCS2 │ │CCS3 │ │ │ │ │ │ │ │ │ +* │ │ │ ┌─────┐ ┌─────┐ ┌─────┐ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │ +* │ │ │ │ ... │ │ ... │ │ ... │ │ │ │ │ │ │ │ │ │ +* │ │ │ └─DSS─┘ └─DSS─┘ └─DSS─┘ └─────Engines─────┘ │ │ │ │ │ │ │ +* │ │ └───────────────────────────GT0────────────────┘ │ │ └─GT1─┘ │ │ +* │ └────────────────────────────Tile0─────────────────┘ └─ Tile1──┘ │ +* └─────────────────────────────Device0───────┬──────────────────────┘ +* │ +* │ +* ───────────────────────┴────────── PCI bus +* +*/ +/** * DOC: Xe uAPI Overview *
Signature · 1 line
2.34.1
PATCH v3 57/57 drm-uapi/xe: Add examples of user space code
In reply to Francois DugastAlign with commit ("drm/xe/uapi: Add examples of user space code")
--- include/drm-uapi/xe_drm.h | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
include/drm-uapi/xe_drm.h +84 -0
@@ -958,6 +958,30 @@ struct drm_xe_vm_bind_op {/** * struct drm_xe_vm_bind - Input of &DRM_IOCTL_XE_VM_BIND +* +* Below is an example of a minimal use of @drm_xe_vm_bind to +* asynchronously bind the buffer `data` at address `BIND_ADDRESS` to +* illustrate `userptr`. It can be synchronized by using the example +* provided for @drm_xe_sync. +* +* .. code-block:: C +* +* data = aligned_alloc(ALIGNMENT, BO_SIZE); +* struct drm_xe_vm_bind bind = { +* .vm_id = vm, +* .num_binds = 1, +* .bind.obj = 0, +* .bind.obj_offset = to_user_pointer(data), +* .bind.range = BO_SIZE, +* .bind.addr = BIND_ADDRESS, +* .bind.op = DRM_XE_VM_BIND_OP_MAP_USERPTR, +* .bind.flags = DRM_XE_VM_BIND_FLAG_ASYNC, +* .num_syncs = 1, +* .syncs = &sync, +* .exec_queue_id = 0, +* }; +* ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind); +* */ struct drm_xe_vm_bind {/** @extensions: Pointer to the first extension struct, if any */
@@ -1030,6 +1054,30 @@ struct drm_xe_vm_bind {* The @flags can be: * - %DRM_XE_SYNC_FLAG_SIGNAL * +* A minimal use of @drm_xe_sync looks like this: +* +* .. code-block:: C +* +* struct drm_xe_sync sync = { +* .flags = DRM_XE_SYNC_FLAG_SIGNAL, +* .type = DRM_XE_SYNC_TYPE_SYNCOBJ, +* }; +* struct drm_syncobj_create syncobj_create = { 0 }; +* ioctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &syncobj_create); +* sync.handle = syncobj_create.handle; +* ... +* use of &sync in drm_xe_exec or drm_xe_vm_bind +* ... +* struct drm_syncobj_wait wait = { +* .handles = &sync.handle, +* .timeout_nsec = INT64_MAX, +* .count_handles = 1, +* .flags = 0, +* .first_signaled = 0, +* .pad = 0, +* }; +* ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait); +* */ struct drm_xe_sync {/** @extensions: Pointer to the first extension struct, if any */
@@ -1134,6 +1182,25 @@ struct drm_xe_sync {/** * struct drm_xe_exec_queue_create - Input of &DRM_IOCTL_XE_EXEC_QUEUE_CREATE +* +* The example below shows how to use @drm_xe_exec_queue_create to create +* a simple exec_queue (no parallel submission) of class +* &DRM_XE_ENGINE_CLASS_RENDER. +* +* .. code-block:: C +* +* struct drm_xe_engine_class_instance instance = { +* .engine_class = DRM_XE_ENGINE_CLASS_RENDER, +* }; +* struct drm_xe_exec_queue_create exec_queue_create = { +* .extensions = 0, +* .vm_id = vm, +* .num_bb_per_exec = 1, +* .num_eng_per_bb = 1, +* .instances = to_user_pointer(&instance), +* }; +* ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &exec_queue_create); +* */ struct drm_xe_exec_queue_create {#define DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY 0
@@ -1256,6 +1323,23 @@ struct drm_xe_exec_queue_get_property {/** * struct drm_xe_exec - Input of &DRM_IOCTL_XE_EXEC +* +* This is an example to use @drm_xe_exec for execution of the object +* at BIND_ADDRESS (see example in @drm_xe_vm_bind) by an exec_queue +* (see example in @drm_xe_exec_queue_create). It can be synchronized +* by using the example provided for @drm_xe_sync. +* +* .. code-block:: C +* +* struct drm_xe_exec exec = { +* .exec_queue_id = exec_queue, +* .syncs = &sync, +* .num_syncs = 1, +* .address = BIND_ADDRESS, +* .num_batch_buffer = 1, +* }; +* ioctl(fd, DRM_IOCTL_XE_EXEC, &exec); +* */ struct drm_xe_exec {/** @extensions: Pointer to the first extension struct, if any */
Signature · 1 line
2.34.1
Patchwork
CI[igt-dev] ✗ Fi.CI.BUILD: failure for uAPI Alignment - take 2
In reply to Francois Dugast== Series Details ==
== Series Details ==
Series: uAPI Alignment - take 2
URL : https://patchwork.freedesktop.org/series/126204/
State : failure
== Summary ==
Applying: drm-uapi/xe: Add check for access counter granularity
Applying: drm-uapi/xe: Add documentation for query
Applying: drm-uapi/xe: Extend drm_xe_vm_bind_op
Applying: drm-uapi/xe: Add uAPI to query micro-controler firmware version
Applying: drm-uapi/xe: Document DRM_XE_DEVICE_QUERY_HWCONFIG
Applying: drm-uapi/xe: Extend uAPI to query HuC micro-controler firmware version
Applying: drm-uapi/xe: Remove useless XE_QUERY_CONFIG_NUM_PARAM
Applying: drm-uapi/xe: Add missing DRM_ prefix in uAPI constants
Applying: drm-uapi/xe: Add _FLAG to uAPI constants usable for flags
Applying: drm-uapi/xe: Make constant comments visible in kernel doc
Applying: drm-uapi/xe: Change rsvd to pad in struct drm_xe_class_instance
Applying: drm-uapi/xe: Remove GT_TYPE_REMOTE.
Applying: drm-uapi/xe: Kill VM_MADVISE IOCTL and the atomic tests
Applying: drm/xe_query: Remove backward compatibility of vram_visible_size.
Applying: xe_ioctl: Converge bo_create to the most used version
Applying: xe_ioctl: Rename *xe_bo_create_flags to simply xe_bo_create Patch failed at 0016 xe_ioctl: Rename *xe_bo_create_flags to simply xe_bo_create 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".