Hi Nirmoy, [...] > ce = create_kernel_context(engine); > if (IS_ERR(ce)) > return PTR_ERR(ce); > + /* > + * Create a separate pinned context for GGTT update with blitter engine > + * if a platform require such service. MI_UPDATE_GTT works on other > + * engines as well but BCS should be less busy engine so pick that for > + * GGTT updates. > + */ > + if (engine->id == BCS0) { > + bce = create_ggtt_bind_context(engine); > + if (IS_ERR(bce)) { > + intel_engine_destroy_pinned_context(ce); > + return PTR_ERR(bce); goto err_context. > + } > + } > > ret = measure_breadcrumb_dw(ce); > if (ret < 0) > @@ -1464,11 +1491,14 @@ static int engine_init_common(struct intel_engine_cs *engine) > > engine->emit_fini_breadcrumb_dw = ret; > engine->kernel_context = ce; > + engine->bind_context = bce; > > return 0; > > err_context: > intel_engine_destroy_pinned_context(ce); > + if (bce) > + intel_engine_destroy_pinned_context(ce); You can make a goto err_bce_context here > return ret; > } > > @@ -1536,6 +1566,9 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine) > > if (engine->kernel_context) > intel_engine_destroy_pinned_context(engine->kernel_context); > + if (engine->bind_context) > + intel_engine_destroy_pinned_context(engine->bind_context); > + > blank line > GEM_BUG_ON(!llist_empty(&engine->barrier_tasks)); > cleanup_status_page(engine); > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h > index a7e677598004..a8f527fab0f0 100644 > --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h > +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h > @@ -416,6 +416,9 @@ struct intel_engine_cs { > struct llist_head barrier_tasks; > > struct intel_context *kernel_context; /* pinned */ > + struct intel_context *bind_context; /* pinned, only for BCS0 */ > + /* mark the bind context's availability status */ > + bool bind_context_ready; So... this is used only once, set to ready and move forward... this would never be false, otherwise it means that we failed to create the bind_context... > /** > * pinned_contexts_list: List of pinned contexts. This list is only > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c > index 449f0b7fc843..cd0ff1597db9 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt.c > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c > @@ -1019,3 +1019,21 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt, > else > return I915_MAP_WC; > } > + > +void intel_gt_bind_context_set_ready(struct intel_gt *gt, bool ready) > +{ > + struct intel_engine_cs *engine = gt->engine[BCS0]; > + > + if (engine && engine->bind_context) > + engine->bind_context_ready = ready; > +} > + > +bool intel_gt_is_bind_context_ready(struct intel_gt *gt) > +{ > + struct intel_engine_cs *engine = gt->engine[BCS0]; > + > + if (engine) > + return engine->bind_context_ready; ... can't we just use the bind_context being NULL as a boolean meaning and save this extra boolean that will always stay there and always hold the same value? > + return false; > +} > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h > index 239848bcb2a4..9e70e625cebc 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt.h > +++ b/drivers/gpu/drm/i915/gt/intel_gt.h > @@ -180,4 +180,6 @@ enum i915_map_type intel_gt_coherent_map_type(struct intel_gt *gt, > struct drm_i915_gem_object *obj, > bool always_coherent); > > +void intel_gt_bind_context_set_ready(struct intel_gt *gt, bool ready); > +bool intel_gt_is_bind_context_ready(struct intel_gt *gt); I think there is no mention anywhere of these two functions. Can we add some comments or some description in the log? Thanks, Andi > #endif /* __INTEL_GT_H__ */ > -- > 2.41.0