Skip to content

Commit 5598c9b

Browse files
vsbelgaumrodrigovivi
authored andcommitted
drm/i915/guc/slpc: Restore efficient freq earlier
This should be done before the soft min/max frequencies are restored. When we disable the "Ignore efficient frequency" flag, GuC does not actually bring the requested freq down to RPn. Specifically, this scenario- - ignore efficient freq set to true - reduce min to RPn (from efficient) - suspend - resume (includes GuC load, restore soft min/max, restore efficient freq) - validate min freq has been resored to RPn This will fail if we didn't first restore(disable, in this case) efficient freq flag before setting the soft min frequency. v2: Bring the min freq down to RPn when we disable efficient freq (Rodrigo) Also made the change to set the min softlimit to RPn at init. Otherwise, we were storing RPe there. Link: https://gitlab.freedesktop.org/drm/intel/-/issues/8736 Fixes: 55f9720 ("drm/i915/guc/slpc: Provide sysfs for efficient freq") Fixes: 95ccf31 ("drm/i915/guc/slpc: Allow SLPC to use efficient frequency") Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230726010044.3280402-1-vinay.belgaumkar@intel.com (cherry picked from commit 28e6711) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 0bc057e commit 5598c9b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,19 @@ int intel_guc_slpc_set_ignore_eff_freq(struct intel_guc_slpc *slpc, bool val)
470470
ret = slpc_set_param(slpc,
471471
SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY,
472472
val);
473-
if (ret)
473+
if (ret) {
474474
guc_probe_error(slpc_to_guc(slpc), "Failed to set efficient freq(%d): %pe\n",
475475
val, ERR_PTR(ret));
476-
else
476+
} else {
477477
slpc->ignore_eff_freq = val;
478478

479+
/* Set min to RPn when we disable efficient freq */
480+
if (val)
481+
ret = slpc_set_param(slpc,
482+
SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
483+
slpc->min_freq);
484+
}
485+
479486
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
480487
mutex_unlock(&slpc->lock);
481488
return ret;
@@ -602,9 +609,8 @@ static int slpc_set_softlimits(struct intel_guc_slpc *slpc)
602609
return ret;
603610

604611
if (!slpc->min_freq_softlimit) {
605-
ret = intel_guc_slpc_get_min_freq(slpc, &slpc->min_freq_softlimit);
606-
if (unlikely(ret))
607-
return ret;
612+
/* Min softlimit is initialized to RPn */
613+
slpc->min_freq_softlimit = slpc->min_freq;
608614
slpc_to_gt(slpc)->defaults.min_freq = slpc->min_freq_softlimit;
609615
} else {
610616
return intel_guc_slpc_set_min_freq(slpc,
@@ -755,6 +761,9 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
755761
return ret;
756762
}
757763

764+
/* Set cached value of ignore efficient freq */
765+
intel_guc_slpc_set_ignore_eff_freq(slpc, slpc->ignore_eff_freq);
766+
758767
/* Revert SLPC min/max to softlimits if necessary */
759768
ret = slpc_set_softlimits(slpc);
760769
if (unlikely(ret)) {
@@ -765,9 +774,6 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
765774
/* Set cached media freq ratio mode */
766775
intel_guc_slpc_set_media_ratio_mode(slpc, slpc->media_ratio_mode);
767776

768-
/* Set cached value of ignore efficient freq */
769-
intel_guc_slpc_set_ignore_eff_freq(slpc, slpc->ignore_eff_freq);
770-
771777
return 0;
772778
}
773779

0 commit comments

Comments
 (0)