Skip to contentSkip to conversation

drm/i915/selftests: Re-enable power gating after live_selftest

PATCH In review [email protected] 2 participants 3 messages Feb 20, 2025 – Mar 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/selftests: Re-enable power gating after live_selftest

From: Sk Anirban <[email protected]>

The current implementation of live_rc6_manual disables power gating after execution due to the deactivation of RC6.
This update aims to re-enable power gating following the completion of the self-test. However, as a temporary workaround
for forcewake timeouts, power gating will remain disabled for MTL.

---
 drivers/gpu/drm/i915/gt/selftest_rc6.c | 37 ++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/gpu/drm/i915/gt/selftest_rc6.c +37 -0
index 30bc2ff040ce..b24d3d7de67b 100644
@@ -34,6 +34,7 @@ int live_rc6_manual(void *arg)
 	struct intel_gt *gt = arg;
 	struct intel_rc6 *rc6 = &gt->rc6;
 	struct intel_rps *rps = &gt->rps;
+	struct intel_uncore *uncore = rc6_to_uncore(rc6);
 	intel_wakeref_t wakeref;
 	u64 sleep_time = 1000;
 	u32 rc0_freq = 0;
@@ -42,10 +43,12 @@ int live_rc6_manual(void *arg)
 	u64 rc6_power[3];
 	bool has_power;
 	u64 threshold;
+	u32 pg_enable;
 	ktime_t dt;
 	u64 res[2];
 	int err = 0;
 	u64 diff;
+	int i;
 
 
 	/*
@@ -148,6 +151,40 @@ int live_rc6_manual(void *arg)
 	intel_rc6_unpark(rc6);
 
 out_unlock:
+	if (GRAPHICS_VER(gt->i915) >= 9) {
+		if (!intel_guc_rc_enable(gt_to_guc(gt)))
+			rc6->ctl_enable = GEN6_RC_CTL_RC6_ENABLE;
+		else
+			rc6->ctl_enable =
+				GEN6_RC_CTL_HW_ENABLE |
+				GEN6_RC_CTL_RC6_ENABLE |
+				GEN6_RC_CTL_EI_MODE(1);
+
+		if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 74)))
+			pg_enable =
+				GEN9_MEDIA_PG_ENABLE |
+				GEN11_MEDIA_SAMPLER_PG_ENABLE;
+		else
+			pg_enable =
+				GEN9_RENDER_PG_ENABLE |
+				GEN9_MEDIA_PG_ENABLE |
+				GEN11_MEDIA_SAMPLER_PG_ENABLE;
+
+		if (GRAPHICS_VER(gt->i915) >= 12 && !IS_DG1(gt->i915)) {
+			for (i = 0; i < I915_MAX_VCS; i++)
+				if (HAS_ENGINE(gt, _VCS(i)))
+					pg_enable |= (VDN_HCP_POWERGATE_ENABLE(i) |
+								VDN_MFX_POWERGATE_ENABLE(i));
+		}
+
+		if (!NEEDS_WaRsDisableCoarsePowerGating(rc6_to_i915(rc6)) &&
+		    GRAPHICS_VER(gt->i915) < 11)
+			intel_uncore_write_fw(uncore, GEN9_PG_ENABLE,
+					      GEN9_RENDER_PG_ENABLE | GEN9_MEDIA_PG_ENABLE);
+		else
+			intel_uncore_write_fw(uncore, GEN9_PG_ENABLE, pg_enable);
+	}
+
 	intel_runtime_pm_put(gt->uncore->rpm, wakeref);
 	return err;
 }
Signature · 1 line
2.34.1
#1 lore raw

✗ Fi.CI.BUILD: failure for drm/i915/selftests: Re-enable power gating after live_selftest

== Series Details ==

== Series Details ==

Series: drm/i915/selftests: Re-enable power gating after live_selftest
URL : https://patchwork.freedesktop.org/series/145144/
State : failure

== Summary ==

Error: patch https://patchwork.freedesktop.org/api/1.0/series/145144/revisions/1/mbox/ not applied
Applying: drm/i915/selftests: Re-enable power gating after live_selftest
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gt/selftest_rc6.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/selftest_rc6.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/selftest_rc6.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915/selftests: Re-enable power gating after live_selftest When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced

#2 lore raw
In reply to [email protected]

++

________________________________
From: Anirban, Sk <[email protected]>
Sent: Thursday, February 20, 2025 12:10 PM
To: [email protected] <[email protected]>
Cc: Gupta, Anshuman <[email protected]>; Nilawar, Badal <[email protected]>; Tauro, Riana <[email protected]>; Poosa, Karthik <[email protected]>; Gupta, Varun <[email protected]>; Anirban, Sk <[email protected]>
Subject: [PATCH] drm/i915/selftests: Re-enable power gating after live_selftest

From: Sk Anirban <[email protected]>

The current implementation of live_rc6_manual disables power gating after execution due to the deactivation of RC6.
This update aims to re-enable power gating following the completion of the self-test. However, as a temporary workaround
for forcewake timeouts, power gating will remain disabled for MTL.

---
 drivers/gpu/drm/i915/gt/selftest_rc6.c | 37 ++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/gpu/drm/i915/gt/selftest_rc6.c +37 -0
index 30bc2ff040ce..b24d3d7de67b 100644
@@ -34,6 +34,7 @@ int live_rc6_manual(void *arg)
         struct intel_gt *gt = arg;
         struct intel_rc6 *rc6 = &gt->rc6;
         struct intel_rps *rps = &gt->rps;
+       struct intel_uncore *uncore = rc6_to_uncore(rc6);
         intel_wakeref_t wakeref;
         u64 sleep_time = 1000;
         u32 rc0_freq = 0;
@@ -42,10 +43,12 @@ int live_rc6_manual(void *arg)
         u64 rc6_power[3];
         bool has_power;
         u64 threshold;
+       u32 pg_enable;
         ktime_t dt;
         u64 res[2];
         int err = 0;
         u64 diff;
+       int i;
 
 
         /*
@@ -148,6 +151,40 @@ int live_rc6_manual(void *arg)
         intel_rc6_unpark(rc6);
 
 out_unlock:
+       if (GRAPHICS_VER(gt->i915) >= 9) {
+               if (!intel_guc_rc_enable(gt_to_guc(gt)))
+                       rc6->ctl_enable = GEN6_RC_CTL_RC6_ENABLE;
+               else
+                       rc6->ctl_enable =
+                               GEN6_RC_CTL_HW_ENABLE |
+                               GEN6_RC_CTL_RC6_ENABLE |
+                               GEN6_RC_CTL_EI_MODE(1);
+
+               if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 74)))
+                       pg_enable =
+                               GEN9_MEDIA_PG_ENABLE |
+                               GEN11_MEDIA_SAMPLER_PG_ENABLE;
+               else
+                       pg_enable =
+                               GEN9_RENDER_PG_ENABLE |
+                               GEN9_MEDIA_PG_ENABLE |
+                               GEN11_MEDIA_SAMPLER_PG_ENABLE;
+
+               if (GRAPHICS_VER(gt->i915) >= 12 && !IS_DG1(gt->i915)) {
+                       for (i = 0; i < I915_MAX_VCS; i++)
+                               if (HAS_ENGINE(gt, _VCS(i)))
+                                       pg_enable |= (VDN_HCP_POWERGATE_ENABLE(i) |
+                                                               VDN_MFX_POWERGATE_ENABLE(i));
+               }
+
+               if (!NEEDS_WaRsDisableCoarsePowerGating(rc6_to_i915(rc6)) &&
+                   GRAPHICS_VER(gt->i915) < 11)
+                       intel_uncore_write_fw(uncore, GEN9_PG_ENABLE,
+                                             GEN9_RENDER_PG_ENABLE | GEN9_MEDIA_PG_ENABLE);
+               else
+                       intel_uncore_write_fw(uncore, GEN9_PG_ENABLE, pg_enable);
+       }
+
         intel_runtime_pm_put(gt->uncore->rpm, wakeref);
         return err;
 }

--
2.34.1