drivers/gpu/drm/i915/gt/intel_rc6.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_rc6.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_rc6.c- Extension
.c- Size
- 26291 bytes
- Lines
- 873
- 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/pm_runtime.hlinux/string_helpers.hdrm/drm_print.hdrm/intel/intel_pcode_regs.hdrm/intel/intel_gmd_interrupt_regs.hdisplay/vlv_clock.hgem/i915_gem_region.hi915_drv.hi915_reg.hi915_vgpu.hintel_engine_regs.hintel_gt.hintel_gt_pm.hintel_gt_regs.hintel_pcode.hintel_rc6.hselftest_rc6.c
Detected Declarations
function gen11_rc6_enablefunction gen9_rc6_enablefunction gen8_rc6_enablefunction gen6_rc6_enablefunction chv_rc6_initfunction vlv_rc6_initfunction chv_rc6_enablefunction vlv_rc6_enablefunction intel_check_bios_c6_setupfunction bxt_check_bios_rc6_setupfunction rc6_supportedfunction rpm_getfunction rpm_putfunction pctx_corruptedfunction __intel_rc6_disablefunction rc6_res_reg_initfunction intel_rc6_initfunction intel_rc6_sanitizefunction intel_rc6_enablefunction intel_rc6_unparkfunction intel_rc6_parkfunction intel_rc6_disablefunction intel_rc6_finifunction vlv_residency_rawfunction intel_rc6_residency_nsfunction intel_rc6_residency_usfunction intel_rc6_print_residency
Annotated Snippet
if (IS_GEN9_LP(i915)) {
mul = 10000;
div = 12;
} else {
mul = 1280;
div = 1;
}
overflow_hw = BIT_ULL(32);
time_hw = intel_uncore_read_fw(uncore, reg);
}
/*
* Counter wrap handling.
*
* Store previous hw counter values for counter wrap-around handling. But
* relying on a sufficient frequency of queries otherwise counters can still wrap.
*/
prev_hw = rc6->prev_hw_residency[id];
rc6->prev_hw_residency[id] = time_hw;
/* RC6 delta from last sample. */
if (time_hw >= prev_hw)
time_hw -= prev_hw;
else
time_hw += overflow_hw - prev_hw;
/* Add delta to RC6 extended raw driver copy. */
time_hw += rc6->cur_residency[id];
rc6->cur_residency[id] = time_hw;
intel_uncore_forcewake_put__locked(uncore, fw_domains);
spin_unlock_irqrestore(&uncore->lock, flags);
return mul_u64_u32_div(time_hw, mul, div);
}
u64 intel_rc6_residency_us(struct intel_rc6 *rc6, enum intel_rc6_res_type id)
{
return DIV_ROUND_UP_ULL(intel_rc6_residency_ns(rc6, id), 1000);
}
void intel_rc6_print_residency(struct seq_file *m, const char *title,
enum intel_rc6_res_type id)
{
struct intel_gt *gt = m->private;
i915_reg_t reg = gt->rc6.res_reg[id];
intel_wakeref_t wakeref;
with_intel_runtime_pm(gt->uncore->rpm, wakeref)
seq_printf(m, "%s %u (%llu us)\n", title,
intel_uncore_read(gt->uncore, reg),
intel_rc6_residency_us(>->rc6, id));
}
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
#include "selftest_rc6.c"
#endif
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `linux/string_helpers.h`, `drm/drm_print.h`, `drm/intel/intel_pcode_regs.h`, `drm/intel/intel_gmd_interrupt_regs.h`, `display/vlv_clock.h`, `gem/i915_gem_region.h`, `i915_drv.h`.
- Detected declarations: `function gen11_rc6_enable`, `function gen9_rc6_enable`, `function gen8_rc6_enable`, `function gen6_rc6_enable`, `function chv_rc6_init`, `function vlv_rc6_init`, `function chv_rc6_enable`, `function vlv_rc6_enable`, `function intel_check_bios_c6_setup`, `function bxt_check_bios_rc6_setup`.
- 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.