Skip to content

Commit c1ed2fb

Browse files
icklerodrigovivi
authored andcommitted
drm/i915/gt: Select the deepest available parking mode for rc6
On Ivybridge, we can go lower than rc6 to rc6p. And this is required for Ivybridge to hit the same minimum power consumption as rc6 on other platforms, so make it so. v2: Update selftest to include all rc6 residency counters Note that Andi did mention that we should be converting the magic numbers into opaque magic macros, so if they ever get reused (unlikely given only Ivybridge used the extra modes) we'll need to pay back the technical debt. Closes: https://gitlab.freedesktop.org/drm/intel/issues/1518 Fixes: 730eaeb ("drm/i915/gt: Manual rc6 entry upon parking") Testcase: igt/i915_pm_rc6_residency/rc6-idle Signed-off-by: Chris Wilson <[email protected]> Cc: Andi Shyti <[email protected]> Cc: Mika Kuoppala <[email protected]> Cc: Imre Deak <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 13c5a57) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent b0647a5 commit c1ed2fb

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

drivers/gpu/drm/i915/gt/intel_rc6.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ void intel_rc6_unpark(struct intel_rc6 *rc6)
603603
void intel_rc6_park(struct intel_rc6 *rc6)
604604
{
605605
struct intel_uncore *uncore = rc6_to_uncore(rc6);
606+
unsigned int target;
606607

607608
if (!rc6->enabled)
608609
return;
@@ -617,7 +618,14 @@ void intel_rc6_park(struct intel_rc6 *rc6)
617618

618619
/* Turn off the HW timers and go directly to rc6 */
619620
set(uncore, GEN6_RC_CONTROL, GEN6_RC_CTL_RC6_ENABLE);
620-
set(uncore, GEN6_RC_STATE, 0x4 << RC_SW_TARGET_STATE_SHIFT);
621+
622+
if (HAS_RC6pp(rc6_to_i915(rc6)))
623+
target = 0x6; /* deepest rc6 */
624+
else if (HAS_RC6p(rc6_to_i915(rc6)))
625+
target = 0x5; /* deep rc6 */
626+
else
627+
target = 0x4; /* normal rc6 */
628+
set(uncore, GEN6_RC_STATE, target << RC_SW_TARGET_STATE_SHIFT);
621629
}
622630

623631
void intel_rc6_disable(struct intel_rc6 *rc6)

drivers/gpu/drm/i915/gt/selftest_rc6.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212

1313
#include "selftests/i915_random.h"
1414

15+
static u64 rc6_residency(struct intel_rc6 *rc6)
16+
{
17+
u64 result;
18+
19+
/* XXX VLV_GT_MEDIA_RC6? */
20+
21+
result = intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6);
22+
if (HAS_RC6p(rc6_to_i915(rc6)))
23+
result += intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6p);
24+
if (HAS_RC6pp(rc6_to_i915(rc6)))
25+
result += intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6pp);
26+
27+
return result;
28+
}
29+
1530
int live_rc6_manual(void *arg)
1631
{
1732
struct intel_gt *gt = arg;
@@ -38,9 +53,9 @@ int live_rc6_manual(void *arg)
3853
__intel_rc6_disable(rc6);
3954
msleep(1); /* wakeup is not immediate, takes about 100us on icl */
4055

41-
res[0] = intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6);
56+
res[0] = rc6_residency(rc6);
4257
msleep(250);
43-
res[1] = intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6);
58+
res[1] = rc6_residency(rc6);
4459
if ((res[1] - res[0]) >> 10) {
4560
pr_err("RC6 residency increased by %lldus while disabled for 250ms!\n",
4661
(res[1] - res[0]) >> 10);
@@ -51,9 +66,9 @@ int live_rc6_manual(void *arg)
5166
/* Manually enter RC6 */
5267
intel_rc6_park(rc6);
5368

54-
res[0] = intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6);
69+
res[0] = rc6_residency(rc6);
5570
msleep(100);
56-
res[1] = intel_rc6_residency_ns(rc6, GEN6_GT_GFX_RC6);
71+
res[1] = rc6_residency(rc6);
5772

5873
if (res[1] == res[0]) {
5974
pr_err("Did not enter RC6! RC6_STATE=%08x, RC6_CONTROL=%08x, residency=%lld\n",

0 commit comments

Comments
 (0)