drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c- Extension
.c- Size
- 23316 bytes
- Lines
- 907
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string_helpers.hdrm/drm_cache.hgt/intel_gt.hgt/intel_gt_regs.hgt/intel_rps.hi915_drv.hi915_reg.hi915_wait_util.hintel_guc_print.hintel_guc_slpc.h
Detected Declarations
function Controlfunction __detect_slpc_supportedfunction __guc_slpc_selectedfunction intel_guc_slpc_init_earlyfunction slpc_mem_set_paramfunction slpc_mem_set_enabledfunction slpc_mem_set_disabledfunction slpc_get_statefunction guc_action_slpc_set_param_nbfunction slpc_set_param_nbfunction guc_action_slpc_set_paramfunction slpc_is_runningfunction guc_action_slpc_queryfunction slpc_query_task_statefunction slpc_set_paramfunction slpc_force_min_freqfunction intel_guc_slpc_set_min_freqfunction slpc_boost_workfunction intel_guc_slpc_initfunction guc_action_slpc_resetfunction slpc_resetfunction slpc_decode_min_freqfunction slpc_decode_max_freqfunction slpc_shared_data_resetfunction intel_guc_slpc_set_max_freqfunction with_intel_runtime_pmfunction intel_guc_slpc_get_max_freqfunction with_intel_runtime_pmfunction intel_guc_slpc_set_ignore_eff_freqfunction intel_guc_slpc_set_min_freqfunction intel_guc_slpc_get_min_freqfunction with_intel_runtime_pmfunction intel_guc_slpc_set_strategyfunction intel_guc_slpc_set_media_ratio_modefunction intel_guc_slpc_set_power_profilefunction intel_guc_pm_intrmsk_enablefunction slpc_set_softlimitsfunction is_slpc_min_freq_rpmaxfunction update_server_min_softlimitfunction slpc_use_fused_rp0function slpc_get_rp_valuesfunction intel_guc_slpc_enablefunction intel_guc_slpc_set_boost_freqfunction intel_guc_slpc_dec_waitersfunction intel_guc_slpc_print_infofunction with_intel_runtime_pmfunction intel_guc_slpc_fini
Annotated Snippet
if (wait_for(slpc_is_running(slpc), SLPC_RESET_TIMEOUT_MS)) {
guc_probe_error(guc, "SLPC not enabled! State = %s\n",
slpc_get_state_string(slpc));
return -EIO;
}
}
return 0;
}
static u32 slpc_decode_min_freq(struct intel_guc_slpc *slpc)
{
struct slpc_shared_data *data = slpc->vaddr;
GEM_BUG_ON(!slpc->vma);
return DIV_ROUND_CLOSEST(REG_FIELD_GET(SLPC_MIN_UNSLICE_FREQ_MASK,
data->task_state_data.freq) *
GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
}
static u32 slpc_decode_max_freq(struct intel_guc_slpc *slpc)
{
struct slpc_shared_data *data = slpc->vaddr;
GEM_BUG_ON(!slpc->vma);
return DIV_ROUND_CLOSEST(REG_FIELD_GET(SLPC_MAX_UNSLICE_FREQ_MASK,
data->task_state_data.freq) *
GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
}
static void slpc_shared_data_reset(struct intel_guc_slpc *slpc)
{
struct drm_i915_private *i915 = slpc_to_i915(slpc);
struct slpc_shared_data *data = slpc->vaddr;
memset(data, 0, sizeof(struct slpc_shared_data));
data->header.size = sizeof(struct slpc_shared_data);
/* Enable only GTPERF task, disable others */
slpc_mem_set_enabled(data, SLPC_PARAM_TASK_ENABLE_GTPERF,
SLPC_PARAM_TASK_DISABLE_GTPERF);
/*
* Don't allow balancer related algorithms on platforms before
* Xe_LPG, where GuC started to restrict it to TDP limited scenarios.
*/
if (GRAPHICS_VER_FULL(i915) < IP_VER(12, 70)) {
slpc_mem_set_disabled(data, SLPC_PARAM_TASK_ENABLE_BALANCER,
SLPC_PARAM_TASK_DISABLE_BALANCER);
slpc_mem_set_disabled(data, SLPC_PARAM_TASK_ENABLE_DCC,
SLPC_PARAM_TASK_DISABLE_DCC);
}
}
/**
* intel_guc_slpc_set_max_freq() - Set max frequency limit for SLPC.
* @slpc: pointer to intel_guc_slpc.
* @val: frequency (MHz)
*
* This function will invoke GuC SLPC action to update the max frequency
* limit for unslice.
*
* Return: 0 on success, non-zero error code on failure.
*/
int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
{
struct drm_i915_private *i915 = slpc_to_i915(slpc);
intel_wakeref_t wakeref;
int ret;
if (val < slpc->min_freq ||
val > slpc->rp0_freq ||
val < slpc->min_freq_softlimit)
return -EINVAL;
with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
ret = slpc_set_param(slpc,
SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
val);
/* Return standardized err code for sysfs calls */
if (ret)
ret = -EIO;
}
if (!ret)
slpc->max_freq_softlimit = val;
Annotation
- Immediate include surface: `linux/string_helpers.h`, `drm/drm_cache.h`, `gt/intel_gt.h`, `gt/intel_gt_regs.h`, `gt/intel_rps.h`, `i915_drv.h`, `i915_reg.h`, `i915_wait_util.h`.
- Detected declarations: `function Control`, `function __detect_slpc_supported`, `function __guc_slpc_selected`, `function intel_guc_slpc_init_early`, `function slpc_mem_set_param`, `function slpc_mem_set_enabled`, `function slpc_mem_set_disabled`, `function slpc_get_state`, `function guc_action_slpc_set_param_nb`, `function slpc_set_param_nb`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.