mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
drm/i915/selftest: Update the SLPC selftest
Use the new efficient frequency toggling interface. Also create a helper function to restore the frequencies after the test is done. v2: Restore max freq first and then min. Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230426003942.1924347-2-vinay.belgaumkar@intel.com
This commit is contained in:
committed by
John Harrison
parent
55f9720dbf
commit
c73bd1706c
@@ -70,6 +70,31 @@ static int slpc_set_freq(struct intel_gt *gt, u32 freq)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int slpc_restore_freq(struct intel_guc_slpc *slpc, u32 min, u32 max)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = slpc_set_max_freq(slpc, max);
|
||||
if (err) {
|
||||
pr_err("Unable to restore max freq");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = slpc_set_min_freq(slpc, min);
|
||||
if (err) {
|
||||
pr_err("Unable to restore min freq");
|
||||
return err;
|
||||
}
|
||||
|
||||
err = intel_guc_slpc_set_ignore_eff_freq(slpc, false);
|
||||
if (err) {
|
||||
pr_err("Unable to restore efficient freq");
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u64 measure_power_at_freq(struct intel_gt *gt, int *freq, u64 *power)
|
||||
{
|
||||
int err = 0;
|
||||
@@ -268,8 +293,7 @@ static int run_test(struct intel_gt *gt, int test_type)
|
||||
|
||||
/*
|
||||
* Set min frequency to RPn so that we can test the whole
|
||||
* range of RPn-RP0. This also turns off efficient freq
|
||||
* usage and makes results more predictable.
|
||||
* range of RPn-RP0.
|
||||
*/
|
||||
err = slpc_set_min_freq(slpc, slpc->min_freq);
|
||||
if (err) {
|
||||
@@ -277,6 +301,15 @@ static int run_test(struct intel_gt *gt, int test_type)
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn off efficient frequency so RPn/RP0 ranges are obeyed.
|
||||
*/
|
||||
err = intel_guc_slpc_set_ignore_eff_freq(slpc, true);
|
||||
if (err) {
|
||||
pr_err("Unable to turn off efficient freq!");
|
||||
return err;
|
||||
}
|
||||
|
||||
intel_gt_pm_wait_for_idle(gt);
|
||||
intel_gt_pm_get(gt);
|
||||
for_each_engine(engine, gt, id) {
|
||||
@@ -358,9 +391,8 @@ static int run_test(struct intel_gt *gt, int test_type)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Restore min/max frequencies */
|
||||
slpc_set_max_freq(slpc, slpc_max_freq);
|
||||
slpc_set_min_freq(slpc, slpc_min_freq);
|
||||
/* Restore min/max/efficient frequencies */
|
||||
err = slpc_restore_freq(slpc, slpc_min_freq, slpc_max_freq);
|
||||
|
||||
if (igt_flush_test(gt->i915))
|
||||
err = -EIO;
|
||||
|
||||
Reference in New Issue
Block a user