diff mbox series

[13/15] drm/i915/huc: report HuC as loaded even if load still in progress

Message ID 20220609231955.3632596-14-daniele.ceraolospurio@intel.com (mailing list archive)
State New, archived
Headers show
Series HuC loading for DG2 | expand

Commit Message

Daniele Ceraolo Spurio June 9, 2022, 11:19 p.m. UTC
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(-)

Comments

Alan Previn July 6, 2022, 4:49 a.m. UTC | #1
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 mbox series

Patch

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)