drm/i915/selftests: Teach guc to take intel_gt as its argument
diff mbox series

Message ID 20191016115311.12894-1-chris@chris-wilson.co.uk
State New
Headers show
Series
  • drm/i915/selftests: Teach guc to take intel_gt as its argument
Related show

Commit Message

Chris Wilson Oct. 16, 2019, 11:53 a.m. UTC
The guc selftests are hardware^W firmare centric and so want to use the
gt as its target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/gt/uc/selftest_guc.c | 42 ++++++++---------------
 1 file changed, 14 insertions(+), 28 deletions(-)

Comments

Tvrtko Ursulin Oct. 16, 2019, 12:43 p.m. UTC | #1
On 16/10/2019 12:53, Chris Wilson wrote:
> The guc selftests are hardware^W firmare centric and so want to use the

Typo in firmware.

> gt as its target.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/selftest_guc.c | 42 ++++++++---------------
>   1 file changed, 14 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
> index f927f851aadf..d8a80388bd31 100644
> --- a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
> @@ -108,22 +108,15 @@ static bool client_doorbell_in_sync(struct intel_guc_client *client)
>    * validating that the doorbells status expected by the driver matches what the
>    * GuC/HW have.
>    */
> -static int igt_guc_clients(void *args)
> +static int igt_guc_clients(void *arg)
>   {
> -	struct drm_i915_private *dev_priv = args;
> +	struct intel_gt *gt = arg;
> +	struct intel_guc *guc = &gt->uc.guc;
>   	intel_wakeref_t wakeref;
> -	struct intel_guc *guc;
>   	int err = 0;
>   
> -	GEM_BUG_ON(!HAS_GT_UC(dev_priv));
> -	wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
> -
> -	guc = &dev_priv->gt.uc.guc;
> -	if (!guc) {
> -		pr_err("No guc object!\n");
> -		err = -EINVAL;
> -		goto unlock;
> -	}

Must be some refactor caught someone of guard. :)

> +	GEM_BUG_ON(!HAS_GT_UC(gt->i915));
> +	wakeref = intel_runtime_pm_get(gt->uncore->rpm);
>   
>   	err = check_all_doorbells(guc);
>   	if (err)
> @@ -188,7 +181,7 @@ static int igt_guc_clients(void *args)
>   	guc_clients_create(guc);
>   	guc_clients_enable(guc);
>   unlock:
> -	intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
> +	intel_runtime_pm_put(gt->uncore->rpm, wakeref);
>   	return err;
>   }
>   
> @@ -199,21 +192,14 @@ static int igt_guc_clients(void *args)
>    */
>   static int igt_guc_doorbells(void *arg)
>   {
> -	struct drm_i915_private *dev_priv = arg;
> +	struct intel_gt *gt = arg;
> +	struct intel_guc *guc = &gt->uc.guc;
>   	intel_wakeref_t wakeref;
> -	struct intel_guc *guc;
>   	int i, err = 0;
>   	u16 db_id;
>   
> -	GEM_BUG_ON(!HAS_GT_UC(dev_priv));
> -	wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
> -
> -	guc = &dev_priv->gt.uc.guc;
> -	if (!guc) {
> -		pr_err("No guc object!\n");
> -		err = -EINVAL;
> -		goto unlock;
> -	}
> +	GEM_BUG_ON(!HAS_GT_UC(gt->i915));
> +	wakeref = intel_runtime_pm_get(gt->uncore->rpm);
>   
>   	err = check_all_doorbells(guc);
>   	if (err)
> @@ -295,19 +281,19 @@ static int igt_guc_doorbells(void *arg)
>   			guc_client_free(clients[i]);
>   		}
>   unlock:
> -	intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
> +	intel_runtime_pm_put(gt->uncore->rpm, wakeref);
>   	return err;
>   }
>   
> -int intel_guc_live_selftest(struct drm_i915_private *dev_priv)
> +int intel_guc_live_selftest(struct drm_i915_private *i915)
>   {
>   	static const struct i915_subtest tests[] = {
>   		SUBTEST(igt_guc_clients),
>   		SUBTEST(igt_guc_doorbells),
>   	};
>   
> -	if (!USES_GUC_SUBMISSION(dev_priv))
> +	if (!USES_GUC_SUBMISSION(i915))
>   		return 0;
>   
> -	return i915_subtests(tests, dev_priv);
> +	return intel_gt_live_subtests(tests, &i915->gt);
>   }
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
index f927f851aadf..d8a80388bd31 100644
--- a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
+++ b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
@@ -108,22 +108,15 @@  static bool client_doorbell_in_sync(struct intel_guc_client *client)
  * validating that the doorbells status expected by the driver matches what the
  * GuC/HW have.
  */
-static int igt_guc_clients(void *args)
+static int igt_guc_clients(void *arg)
 {
-	struct drm_i915_private *dev_priv = args;
+	struct intel_gt *gt = arg;
+	struct intel_guc *guc = &gt->uc.guc;
 	intel_wakeref_t wakeref;
-	struct intel_guc *guc;
 	int err = 0;
 
-	GEM_BUG_ON(!HAS_GT_UC(dev_priv));
-	wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
-
-	guc = &dev_priv->gt.uc.guc;
-	if (!guc) {
-		pr_err("No guc object!\n");
-		err = -EINVAL;
-		goto unlock;
-	}
+	GEM_BUG_ON(!HAS_GT_UC(gt->i915));
+	wakeref = intel_runtime_pm_get(gt->uncore->rpm);
 
 	err = check_all_doorbells(guc);
 	if (err)
@@ -188,7 +181,7 @@  static int igt_guc_clients(void *args)
 	guc_clients_create(guc);
 	guc_clients_enable(guc);
 unlock:
-	intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
+	intel_runtime_pm_put(gt->uncore->rpm, wakeref);
 	return err;
 }
 
@@ -199,21 +192,14 @@  static int igt_guc_clients(void *args)
  */
 static int igt_guc_doorbells(void *arg)
 {
-	struct drm_i915_private *dev_priv = arg;
+	struct intel_gt *gt = arg;
+	struct intel_guc *guc = &gt->uc.guc;
 	intel_wakeref_t wakeref;
-	struct intel_guc *guc;
 	int i, err = 0;
 	u16 db_id;
 
-	GEM_BUG_ON(!HAS_GT_UC(dev_priv));
-	wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
-
-	guc = &dev_priv->gt.uc.guc;
-	if (!guc) {
-		pr_err("No guc object!\n");
-		err = -EINVAL;
-		goto unlock;
-	}
+	GEM_BUG_ON(!HAS_GT_UC(gt->i915));
+	wakeref = intel_runtime_pm_get(gt->uncore->rpm);
 
 	err = check_all_doorbells(guc);
 	if (err)
@@ -295,19 +281,19 @@  static int igt_guc_doorbells(void *arg)
 			guc_client_free(clients[i]);
 		}
 unlock:
-	intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
+	intel_runtime_pm_put(gt->uncore->rpm, wakeref);
 	return err;
 }
 
-int intel_guc_live_selftest(struct drm_i915_private *dev_priv)
+int intel_guc_live_selftest(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_guc_clients),
 		SUBTEST(igt_guc_doorbells),
 	};
 
-	if (!USES_GUC_SUBMISSION(dev_priv))
+	if (!USES_GUC_SUBMISSION(i915))
 		return 0;
 
-	return i915_subtests(tests, dev_priv);
+	return intel_gt_live_subtests(tests, &i915->gt);
 }