[Intel-gfx] [PATCH 01/11] drm/i915: Avoid rpm helpers in intel_guc_global_policies_update

Tilak Tangudu tilak.tangudu at intel.com
Tue Jun 21 12:35:06 UTC 2022


1. Removed rpm helpers in intel_guc_global_policies_update
and added rpm helpers in below higher level functions,
-intel_selftest_modify_policy
-intel_selftest_restore_policy
-notify_guc
-intel_uc_reset_finish calls intel_guc_global_policies_update
via intel_guc_submission_reset_finish

2. Removed rpm helpers in intel_guc_submission_reset_finish
and added rpm helpers in below higher level functions,
- at intel_uc_reset_finish in reset_finish
- intel_gt_resume (already rpm wakeref is available)

Signed-off-by: Tilak Tangudu <tilak.tangudu at intel.com>
---
 drivers/gpu/drm/i915/gt/intel_reset.c               |  4 +++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c          |  5 +----
 drivers/gpu/drm/i915/i915_debugfs_params.c          |  7 +++++--
 .../drm/i915/selftests/intel_scheduler_helpers.c    | 13 +++++++++++--
 4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index a5338c3fde7a..c8e05b48c14f 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -828,6 +828,7 @@ static void reset_finish(struct intel_gt *gt, intel_engine_mask_t awake)
 {
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
+	intel_wakeref_t wakeref;
 
 	for_each_engine(engine, gt, id) {
 		reset_finish_engine(engine);
@@ -835,7 +836,8 @@ static void reset_finish(struct intel_gt *gt, intel_engine_mask_t awake)
 			intel_engine_pm_put(engine);
 	}
 
-	intel_uc_reset_finish(&gt->uc);
+	with_intel_runtime_pm(gt->uncore->rpm, wakeref)
+		intel_uc_reset_finish(&gt->uc);
 }
 
 static void nop_submit_request(struct i915_request *request)
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
index ba7541f3ca61..3f24ad4cb2e1 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
@@ -182,9 +182,7 @@ static int guc_action_policies_update(struct intel_guc *guc, u32 policy_offset)
 
 int intel_guc_global_policies_update(struct intel_guc *guc)
 {
-	struct intel_gt *gt = guc_to_gt(guc);
 	u32 scheduler_policies;
-	intel_wakeref_t wakeref;
 	int ret;
 
 	if (iosys_map_is_null(&guc->ads_map))
@@ -198,8 +196,7 @@ int intel_guc_global_policies_update(struct intel_guc *guc)
 	if (!intel_guc_is_ready(guc))
 		return 0;
 
-	with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
-		ret = guc_action_policies_update(guc, scheduler_policies);
+	ret = guc_action_policies_update(guc, scheduler_policies);
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/i915/i915_debugfs_params.c b/drivers/gpu/drm/i915/i915_debugfs_params.c
index 783c8676eee2..cf92c98fa81a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs_params.c
+++ b/drivers/gpu/drm/i915/i915_debugfs_params.c
@@ -39,9 +39,12 @@ static int i915_param_int_open(struct inode *inode, struct file *file)
 static int notify_guc(struct drm_i915_private *i915)
 {
 	int ret = 0;
+	intel_wakeref_t wakeref;
 
-	if (intel_uc_uses_guc_submission(&to_gt(i915)->uc))
-		ret = intel_guc_global_policies_update(&to_gt(i915)->uc.guc);
+	if (intel_uc_uses_guc_submission(&to_gt(i915)->uc)) {
+		with_intel_runtime_pm(to_gt(i915)->uncore->rpm, wakeref)
+			ret = intel_guc_global_policies_update(&to_gt(i915)->uc.guc);
+	}
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c b/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
index 310fb83c527e..463a378f0abb 100644
--- a/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
+++ b/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
@@ -32,6 +32,7 @@ int intel_selftest_modify_policy(struct intel_engine_cs *engine,
 
 {
 	int err;
+	intel_wakeref_t wakeref;
 
 	saved->reset = engine->i915->params.reset;
 	saved->flags = engine->flags;
@@ -66,7 +67,9 @@ int intel_selftest_modify_policy(struct intel_engine_cs *engine,
 	if (!intel_engine_uses_guc(engine))
 		return 0;
 
-	err = intel_guc_global_policies_update(&engine->gt->uc.guc);
+	with_intel_runtime_pm(engine->gt->uncore->rpm, wakeref)
+		err = intel_guc_global_policies_update(&engine->gt->uc.guc);
+
 	if (err)
 		intel_selftest_restore_policy(engine, saved);
 
@@ -76,6 +79,9 @@ int intel_selftest_modify_policy(struct intel_engine_cs *engine,
 int intel_selftest_restore_policy(struct intel_engine_cs *engine,
 				  struct intel_selftest_saved_policy *saved)
 {
+	intel_wakeref_t wakeref;
+	int ret;
+
 	/* Restore the original policies */
 	engine->i915->params.reset = saved->reset;
 	engine->flags = saved->flags;
@@ -85,7 +91,10 @@ int intel_selftest_restore_policy(struct intel_engine_cs *engine,
 	if (!intel_engine_uses_guc(engine))
 		return 0;
 
-	return intel_guc_global_policies_update(&engine->gt->uc.guc);
+	with_intel_runtime_pm(engine->gt->uncore->rpm, wakeref)
+		ret = intel_guc_global_policies_update(&engine->gt->uc.guc);
+
+	return ret;
 }
 
 int intel_selftest_wait_for_rq(struct i915_request *rq)
-- 
2.25.1



More information about the Intel-gfx mailing list