On Tue, 2022-09-13 at 16:22 -0700, Ceraolo Spurio, Daniele wrote: > Wait on the fence to be signalled to avoid the submissions finding HuC > not yet loaded. > > v2: use dedicaded wait_queue_entry for waiting in HuC load, as submitq > can't be re-used for it. > > Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx> > Cc: Tony Ye <tony.ye@xxxxxxxxx> > Reviewed-by: Alan Previn <alan.previn.teres.alexis@xxxxxxxxx> #v1 > Acked-by: Tony Ye <tony.ye@xxxxxxxxx> > --- > drivers/gpu/drm/i915/gt/uc/intel_huc.h | 6 ++++++ > drivers/gpu/drm/i915/i915_request.c | 24 ++++++++++++++++++++++++ > drivers/gpu/drm/i915/i915_request.h | 5 +++++ > 3 files changed, 35 insertions(+) > [snip] > diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h > index 47041ec68df8..f5e1bb5e857a 100644 > --- a/drivers/gpu/drm/i915/i915_request.h > +++ b/drivers/gpu/drm/i915/i915_request.h > @@ -348,6 +348,11 @@ struct i915_request { > #define GUC_PRIO_FINI 0xfe > u8 guc_prio; > > + /** > + * @hucq: wait queue entry used to wait on the HuC load to complete > + */ > + wait_queue_entry_t hucq; > + > > I believe that in future if we have multiple engines that requires a similiar stalled initialization wait, we should have an array of ptrs here and a not-huc-specific-helper that can sort out adding fence-signalled-waiters. But for now this is a very rare race condition that only happens with HuC so this hucq specific wait-entry will do fine. Thus: Reviewed-by: Alan Previn <alan.previn.teres.alexis@xxxxxxxxx>