Message ID | 20220609231955.3632596-14-daniele.ceraolospurio@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | HuC loading for DG2 | expand |
On Thu, 2022-06-09 at 16:19 -0700, Ceraolo Spurio, Daniele wrote: > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c > index 075ec97b459d..33bfac91fa01 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c > @@ -426,7 +426,10 @@ int intel_huc_check_status(struct intel_huc *huc) > break; > } > > - return intel_huc_is_authenticated(huc); > + if (intel_huc_is_authenticated(huc)) > + return 1; > + > + return !i915_sw_fence_done(&huc->delayed_load.fence); > Are we sure we dont have a race condition here? Perhaps a less cleaner but might tigher check might be: if (i915_sw_fence_done(..) && intel_huc_is_authenticated(..)) return 1 else if (!i915_sw_fence_done(..)) return 1 return 0; To speed things up a little, please accept a conditional R-b if you can reply back with why we might not need to worry about the race condition or if i am just reading this incorrectly. Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com> > } > > static bool huc_has_delayed_load(struct intel_huc *huc) > -- > 2.25.1 >
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c index 075ec97b459d..33bfac91fa01 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c @@ -408,8 +408,8 @@ bool intel_huc_is_authenticated(struct intel_huc *huc) * * -EOPNOTSUPP if HuC firmware is disabled, * * -ENOPKG if HuC firmware was not installed, * * -ENOEXEC if HuC firmware is invalid or mismatched, - * * 0 if HuC firmware is not running, - * * 1 if HuC firmware is authenticated and running. + * * 1 if HuC firmware is authenticated and running or if delayed load is in progress, + * * 0 if HuC firmware is not running and delayed load is not in progress */ int intel_huc_check_status(struct intel_huc *huc) { @@ -426,7 +426,10 @@ int intel_huc_check_status(struct intel_huc *huc) break; } - return intel_huc_is_authenticated(huc); + if (intel_huc_is_authenticated(huc)) + return 1; + + return !i915_sw_fence_done(&huc->delayed_load.fence); } static bool huc_has_delayed_load(struct intel_huc *huc)
The media driver uses this only as an indication that HuC is enabled and they have a secondary check within their batches to verify if the HuC is indeed loaded or not. They have therefore requested us to report this as true if HuC loading is in progress. Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Tony Ye <tony.ye@intel.com> --- drivers/gpu/drm/i915/gt/uc/intel_huc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)