staticint slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 freq)
{ int ret;
ret = intel_guc_slpc_set_min_freq(slpc, freq); if (ret)
pr_err("Could not set min frequency to [%u]\n", freq); else/* Delay to ensure h2g completes */
delay_for_h2g();
return ret;
}
staticint slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 freq)
{ int ret;
ret = intel_guc_slpc_set_max_freq(slpc, freq); if (ret)
pr_err("Could not set maximum frequency [%u]\n",
freq); else/* Delay to ensure h2g completes */
delay_for_h2g();
/* Go from max to min in 5 steps */
step = (slpc->rp0_freq - slpc->min_freq) / NUM_STEPS;
*max_act_freq = slpc->min_freq; for (max_freq = slpc->rp0_freq; max_freq > slpc->min_freq;
max_freq -= step) {
err = slpc_set_max_freq(slpc, max_freq); if (err) break;
/* GuC requests freq in multiples of 50/3 MHz */ if (req_freq > (max_freq + FREQUENCY_REQ_UNIT)) {
pr_err("SWReq is %d, should be at most %d\n", req_freq,
max_freq + FREQUENCY_REQ_UNIT);
err = -EINVAL;
}
act_freq = intel_rps_read_actual_frequency(rps); if (act_freq > *max_act_freq)
*max_act_freq = act_freq;
/* Go from min to max in 5 steps */
step = (slpc->rp0_freq - slpc->min_freq) / NUM_STEPS;
*max_act_freq = slpc->min_freq; for (min_freq = slpc->min_freq; min_freq < slpc->rp0_freq;
min_freq += step) {
err = slpc_set_min_freq(slpc, min_freq); if (err) break;
/* GuC requests freq in multiples of 50/3 MHz */ if (req_freq < (min_freq - FREQUENCY_REQ_UNIT)) {
pr_err("SWReq is %d, should be at least %d\n", req_freq,
min_freq - FREQUENCY_REQ_UNIT);
err = -EINVAL;
}
act_freq = intel_rps_read_actual_frequency(rps); if (act_freq > *max_act_freq)
*max_act_freq = act_freq;
/* * Our fundamental assumption is that running at lower frequency * actually saves power. Let's see if our RAPL measurement supports * that theory.
*/ if (!librapl_supported(gt->i915)) return 0;
err = slpc_set_min_freq(slpc, slpc->rp0_freq); if (err) return err;
*max_act_freq = intel_rps_read_actual_frequency(rps); if (*max_act_freq != slpc->rp0_freq) { /* Check if there was some throttling by pcode */
perf_limit_reasons = intel_uncore_read(gt->uncore,
intel_gt_perf_limit_reasons_reg(gt));
/* If not, this is an error */ if (!(perf_limit_reasons & GT0_PERF_LIMIT_REASONS_MASK)) {
pr_err("Pcode did not grant max freq\n");
err = -EINVAL;
} else {
pr_info("Pcode throttled frequency 0x%x\n", perf_limit_reasons);
}
}
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)) return -ENOMEM;
if (intel_guc_slpc_get_max_freq(slpc, &slpc_max_freq)) {
pr_err("Could not get SLPC max freq\n"); return -EIO;
}
if (intel_guc_slpc_get_min_freq(slpc, &slpc_min_freq)) {
pr_err("Could not get SLPC min freq\n"); return -EIO;
}
/* * Set min frequency to RPn so that we can test the whole * range of RPn-RP0.
*/
err = slpc_set_min_freq(slpc, slpc->min_freq); if (err) {
pr_err("Unable to update min freq!"); 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;
}
case VARY_MAX:
err = vary_max_freq(slpc, rps, &max_act_freq); break;
case MAX_GRANTED: case TILE_INTERACTION: /* Media engines have a different RP0 */ if (gt->type != GT_MEDIA && (engine->class == VIDEO_DECODE_CLASS ||
engine->class == VIDEO_ENHANCEMENT_CLASS)) {
igt_spinner_end(&spin);
st_engine_heartbeat_enable(engine);
err = 0; continue;
}
case SLPC_POWER:
err = slpc_power(gt, engine); break;
}
if (test_type != SLPC_POWER) {
pr_info("Max actual frequency for %s was %d\n",
engine->name, max_act_freq);
/* Actual frequency should rise above min */ if (max_act_freq <= slpc->min_freq) {
pr_err("Actual freq did not rise above min\n");
pr_err("Perf Limit Reasons: 0x%x\n",
intel_uncore_read(gt->uncore,
intel_gt_perf_limit_reasons_reg(gt)));
err = -EINVAL;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.