drivers/gpu/drm/i915/gt/intel_rps.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_rps.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_rps.c- Extension
.c- Size
- 77529 bytes
- Lines
- 2956
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/intel/display_parent_interface.hdrm/intel/i915_drm.hdrm/intel/intel_pcode_regs.hdrm/intel/mchbar_regs.hdisplay/intel_display_rps.hdisplay/vlv_clock.hi915_drv.hi915_freq.hi915_irq.hi915_reg.hi915_wait_util.hintel_breadcrumbs.hintel_gt.hintel_gt_clock_utils.hintel_gt_irq.hintel_gt_pm.hintel_gt_pm_irq.hintel_gt_print.hintel_gt_regs.hintel_pcode.hintel_rps.hvlv_iosf_sb.h../../../platform/x86/intel_ips.hselftest_rps.cselftest_slpc.c
Detected Declarations
function rps_uses_slpcfunction rps_pm_sanitize_maskfunction setfunction rps_timerfunction rps_start_timerfunction rps_stop_timerfunction rps_pm_maskfunction rps_reset_eifunction rps_enable_interruptsfunction gen6_rps_reset_interruptsfunction gen11_rps_reset_interruptsfunction rps_reset_interruptsfunction rps_disable_interruptsfunction gen5_rps_initfunction __ips_chipset_valfunction ips_mch_valfunction _pxvid_to_vdfunction pvid_to_extvidfunction __gen5_ips_updatefunction gen5_rps_updatefunction gen5_invert_freqfunction __gen5_rps_setfunction gen5_rps_setfunction intel_pxfreqfunction init_emonfunction gen5_rps_enablefunction gen5_rps_disablefunction rps_limitsfunction rps_set_powerfunction gen6_rps_set_thresholdsfunction intel_rps_mark_interactivefunction gen6_rps_setfunction vlv_rps_setfunction rps_setfunction intel_rps_unparkfunction intel_rps_parkfunction intel_rps_get_boost_frequencyfunction rps_set_boost_freqfunction intel_rps_set_boost_frequencyfunction intel_rps_dec_waitersfunction intel_rps_boostfunction intel_rps_setfunction intel_rps_read_state_capfunction mtl_get_freq_capsfunction __gen6_rps_get_freq_capsfunction intel_gpu_freqfunction gen6_rps_initfunction IS_GEN9_BC
Annotated Snippet
if (rps_uses_slpc(rps)) {
slpc = rps_to_slpc(rps);
/* Waitboost should not be done with power saving profile */
if (slpc->power_profile == SLPC_POWER_PROFILES_POWER_SAVING)
return;
/* Return if old value is non zero */
if (!atomic_fetch_inc(&slpc->num_waiters)) {
/*
* Skip queuing boost work if frequency is already boosted,
* but still increment num_waiters.
*/
if (slpc->min_freq_softlimit >= slpc->boost_freq)
return;
GT_TRACE(rps_to_gt(rps), "boost fence:%llx:%llx\n",
rq->fence.context, rq->fence.seqno);
queue_work(rps_to_gt(rps)->i915->unordered_wq,
&slpc->boost_work);
}
return;
}
if (atomic_fetch_inc(&rps->num_waiters))
return;
if (!intel_rps_is_active(rps))
return;
GT_TRACE(rps_to_gt(rps), "boost fence:%llx:%llx\n",
rq->fence.context, rq->fence.seqno);
if (READ_ONCE(rps->cur_freq) < rps->boost_freq)
queue_work(rps_to_gt(rps)->i915->unordered_wq, &rps->work);
WRITE_ONCE(rps->boosts, rps->boosts + 1); /* debug only */
}
}
int intel_rps_set(struct intel_rps *rps, u8 val)
{
int err;
lockdep_assert_held(&rps->lock);
GEM_BUG_ON(val > rps->max_freq);
GEM_BUG_ON(val < rps->min_freq);
if (intel_rps_is_active(rps)) {
err = rps_set(rps, val, true);
if (err)
return err;
/*
* Make sure we continue to get interrupts
* until we hit the minimum or maximum frequencies.
*/
if (intel_rps_has_interrupts(rps)) {
struct intel_uncore *uncore = rps_to_uncore(rps);
set(uncore,
GEN6_RP_INTERRUPT_LIMITS, rps_limits(rps, val));
set(uncore, GEN6_PMINTRMSK, rps_pm_mask(rps, val));
}
}
rps->cur_freq = val;
return 0;
}
static u32 intel_rps_read_state_cap(struct intel_rps *rps)
{
struct drm_i915_private *i915 = rps_to_i915(rps);
struct intel_uncore *uncore = rps_to_uncore(rps);
if (IS_GEN9_LP(i915))
return intel_uncore_read(uncore, BXT_RP_STATE_CAP);
else
return intel_uncore_read(uncore, GEN6_RP_STATE_CAP);
}
static void
mtl_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps)
{
struct intel_uncore *uncore = rps_to_uncore(rps);
u32 rp_state_cap = rps_to_gt(rps)->type == GT_MEDIA ?
intel_uncore_read(uncore, MTL_MEDIAP_STATE_CAP) :
intel_uncore_read(uncore, MTL_RP_STATE_CAP);
Annotation
- Immediate include surface: `linux/string_helpers.h`, `drm/intel/display_parent_interface.h`, `drm/intel/i915_drm.h`, `drm/intel/intel_pcode_regs.h`, `drm/intel/mchbar_regs.h`, `display/intel_display_rps.h`, `display/vlv_clock.h`, `i915_drv.h`.
- Detected declarations: `function rps_uses_slpc`, `function rps_pm_sanitize_mask`, `function set`, `function rps_timer`, `function rps_start_timer`, `function rps_stop_timer`, `function rps_pm_mask`, `function rps_reset_ei`, `function rps_enable_interrupts`, `function gen6_rps_reset_interrupts`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.