Commit 37d52e44 authored by Vinay Belgaumkar's avatar Vinay Belgaumkar Committed by John Harrison

drm/i915/slpc: Use platform limits for min/max frequency

GuC will set the min/max frequencies to theoretical max on
ATS-M. This will break kernel ABI, so limit min/max frequency
to RP0(platform max) instead.

Also modify the SLPC selftest to update the min frequency
when we have a server part so that we can iterate between
platform min and max.

v2: Check softlimits instead of platform limits (Riana)
v3: More review comments (Ashutosh)
v4: No need to use saved_min_freq and other comments (Ashutosh)

Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/7030Acked-by: default avatarNirmoy Das <nirmoy.das@intel.com>
Reviewed-by: default avatarRiana Tauro <riana.tauro@intel.com>
Signed-off-by: default avatarVinay Belgaumkar <vinay.belgaumkar@intel.com>
Reviewed-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221024225453.4856-1-vinay.belgaumkar@intel.com
parent f864a29a
...@@ -239,6 +239,11 @@ static int run_test(struct intel_gt *gt, int test_type) ...@@ -239,6 +239,11 @@ static int run_test(struct intel_gt *gt, int test_type)
if (!intel_uc_uses_guc_slpc(&gt->uc)) if (!intel_uc_uses_guc_slpc(&gt->uc))
return 0; return 0;
if (slpc->min_freq == slpc->rp0_freq) {
pr_err("Min/Max are fused to the same value\n");
return -EINVAL;
}
if (igt_spinner_init(&spin, gt)) if (igt_spinner_init(&spin, gt))
return -ENOMEM; return -ENOMEM;
...@@ -253,17 +258,14 @@ static int run_test(struct intel_gt *gt, int test_type) ...@@ -253,17 +258,14 @@ static int run_test(struct intel_gt *gt, int test_type)
} }
/* /*
* FIXME: With efficient frequency enabled, GuC can request * Set min frequency to RPn so that we can test the whole
* frequencies higher than the SLPC max. While this is fixed * range of RPn-RP0. This also turns off efficient freq
* in GuC, we level set these tests with RPn as min. * usage and makes results more predictable.
*/ */
err = slpc_set_min_freq(slpc, slpc->min_freq); err = slpc_set_min_freq(slpc, slpc->min_freq);
if (err) if (err) {
pr_err("Unable to update min freq!");
return err; return err;
if (slpc->min_freq == slpc->rp0_freq) {
pr_err("Min/Max are fused to the same value\n");
return -EINVAL;
} }
intel_gt_pm_wait_for_idle(gt); intel_gt_pm_wait_for_idle(gt);
...@@ -330,7 +332,7 @@ static int run_test(struct intel_gt *gt, int test_type) ...@@ -330,7 +332,7 @@ static int run_test(struct intel_gt *gt, int test_type)
engine->name, max_act_freq); engine->name, max_act_freq);
/* Actual frequency should rise above min */ /* Actual frequency should rise above min */
if (max_act_freq <= slpc_min_freq) { if (max_act_freq <= slpc->min_freq) {
pr_err("Actual freq did not rise above min\n"); pr_err("Actual freq did not rise above min\n");
pr_err("Perf Limit Reasons: 0x%x\n", pr_err("Perf Limit Reasons: 0x%x\n",
intel_uncore_read(gt->uncore, GT0_PERF_LIMIT_REASONS)); intel_uncore_read(gt->uncore, GT0_PERF_LIMIT_REASONS));
......
...@@ -263,6 +263,7 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc) ...@@ -263,6 +263,7 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
slpc->max_freq_softlimit = 0; slpc->max_freq_softlimit = 0;
slpc->min_freq_softlimit = 0; slpc->min_freq_softlimit = 0;
slpc->min_is_rpmax = false;
slpc->boost_freq = 0; slpc->boost_freq = 0;
atomic_set(&slpc->num_waiters, 0); atomic_set(&slpc->num_waiters, 0);
...@@ -588,6 +589,39 @@ static int slpc_set_softlimits(struct intel_guc_slpc *slpc) ...@@ -588,6 +589,39 @@ static int slpc_set_softlimits(struct intel_guc_slpc *slpc)
return 0; return 0;
} }
static bool is_slpc_min_freq_rpmax(struct intel_guc_slpc *slpc)
{
struct drm_i915_private *i915 = slpc_to_i915(slpc);
int slpc_min_freq;
int ret;
ret = intel_guc_slpc_get_min_freq(slpc, &slpc_min_freq);
if (ret) {
drm_err(&i915->drm,
"Failed to get min freq: (%d)\n",
ret);
return false;
}
if (slpc_min_freq == SLPC_MAX_FREQ_MHZ)
return true;
else
return false;
}
static void update_server_min_softlimit(struct intel_guc_slpc *slpc)
{
/* For server parts, SLPC min will be at RPMax.
* Use min softlimit to clamp it to RP0 instead.
*/
if (!slpc->min_freq_softlimit &&
is_slpc_min_freq_rpmax(slpc)) {
slpc->min_is_rpmax = true;
slpc->min_freq_softlimit = slpc->rp0_freq;
(slpc_to_gt(slpc))->defaults.min_freq = slpc->min_freq_softlimit;
}
}
static int slpc_use_fused_rp0(struct intel_guc_slpc *slpc) static int slpc_use_fused_rp0(struct intel_guc_slpc *slpc)
{ {
/* Force SLPC to used platform rp0 */ /* Force SLPC to used platform rp0 */
...@@ -647,6 +681,9 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) ...@@ -647,6 +681,9 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
slpc_get_rp_values(slpc); slpc_get_rp_values(slpc);
/* Handle the case where min=max=RPmax */
update_server_min_softlimit(slpc);
/* Set SLPC max limit to RP0 */ /* Set SLPC max limit to RP0 */
ret = slpc_use_fused_rp0(slpc); ret = slpc_use_fused_rp0(slpc);
if (unlikely(ret)) { if (unlikely(ret)) {
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "intel_guc_submission.h" #include "intel_guc_submission.h"
#include "intel_guc_slpc_types.h" #include "intel_guc_slpc_types.h"
#define SLPC_MAX_FREQ_MHZ 4250
struct intel_gt; struct intel_gt;
struct drm_printer; struct drm_printer;
......
...@@ -19,6 +19,9 @@ struct intel_guc_slpc { ...@@ -19,6 +19,9 @@ struct intel_guc_slpc {
bool supported; bool supported;
bool selected; bool selected;
/* Indicates this is a server part */
bool min_is_rpmax;
/* platform frequency limits */ /* platform frequency limits */
u32 min_freq; u32 min_freq;
u32 rp0_freq; u32 rp0_freq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment