There is no need to add engines to early uabi list one by one during engine setup, we can collect all engines while doing final renames at driver_register phase. This will also unblock us in case we would need to do some late modifications of the engine list after engine setup but before starting uabi registration. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx> --- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 1 - drivers/gpu/drm/i915/gt/intel_engine_user.c | 15 +++++++++++++-- drivers/gpu/drm/i915/gt/intel_engine_user.h | 1 - drivers/gpu/drm/i915/gt/mock_engine.c | 2 -- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index 9cc1ea6519ec..12056ad30b14 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -342,7 +342,6 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id) gt->engine_class[info->class][info->instance] = engine; gt->engine[id] = engine; - intel_engine_add_user(engine); gt->i915->engine[id] = engine; return 0; diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c index 7f7150a733f4..e9231e27cdf1 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_user.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c @@ -35,10 +35,20 @@ intel_engine_lookup_user(struct drm_i915_private *i915, u8 class, u8 instance) return NULL; } -void intel_engine_add_user(struct intel_engine_cs *engine) +static void add_engine(struct drm_i915_private *i915, + struct intel_engine_cs *engine) { llist_add((struct llist_node *)&engine->uabi_node, - (struct llist_head *)&engine->i915->uabi_engines); + (struct llist_head *)&i915->uabi_engines); +} + +static void add_engines(struct drm_i915_private *i915) +{ + struct intel_engine_cs *engine; + enum intel_engine_id id; + + for_each_engine(engine, i915, id) + add_engine(i915, engine); } static const u8 uabi_classes[] = { @@ -190,6 +200,7 @@ void intel_engines_driver_register(struct drm_i915_private *i915) struct rb_node **p, *prev; LIST_HEAD(engines); + add_engines(i915); sort_engines(i915, &engines); prev = NULL; diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.h b/drivers/gpu/drm/i915/gt/intel_engine_user.h index f845ea1cbfaa..7fb07fa98494 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_user.h +++ b/drivers/gpu/drm/i915/gt/intel_engine_user.h @@ -17,7 +17,6 @@ intel_engine_lookup_user(struct drm_i915_private *i915, u8 class, u8 instance); unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915); -void intel_engine_add_user(struct intel_engine_cs *engine); void intel_engines_driver_register(struct drm_i915_private *i915); const char *intel_engine_class_repr(u8 class); diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c index 83f549d203a0..c36490a00b5d 100644 --- a/drivers/gpu/drm/i915/gt/mock_engine.c +++ b/drivers/gpu/drm/i915/gt/mock_engine.c @@ -277,8 +277,6 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915, timer_setup(&engine->hw_delay, hw_delay_complete, 0); INIT_LIST_HEAD(&engine->hw_queue); - intel_engine_add_user(&engine->base); - return &engine->base; } -- 2.19.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx