drivers/gpu/drm/i915/gt/selftest_slpc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/selftest_slpc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/selftest_slpc.c- Extension
.c- Size
- 11993 bytes
- Lines
- 558
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct slpc_threadenum test_typefunction slpc_set_min_freqfunction slpc_set_max_freqfunction slpc_set_freqfunction slpc_restore_freqfunction slpc_measure_powerfunction measure_power_at_freqfunction vary_max_freqfunction vary_min_freqfunction slpc_powerfunction max_granted_freqfunction run_testfunction live_slpc_vary_minfunction for_each_gtfunction live_slpc_vary_maxfunction for_each_gtfunction live_slpc_max_grantedfunction for_each_gtfunction live_slpc_powerfunction for_each_gtfunction slpc_spinner_threadfunction live_slpc_tile_interactionfunction for_each_gtfunction for_each_gtfunction intel_slpc_live_selftestsfunction for_each_gt
Annotated Snippet
struct slpc_thread {
struct kthread_worker *worker;
struct kthread_work work;
struct intel_gt *gt;
int result;
};
static int 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;
}
static int 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();
return ret;
}
static int slpc_set_freq(struct intel_gt *gt, u32 freq)
{
int err;
struct intel_guc_slpc *slpc = >_to_guc(gt)->slpc;
err = slpc_set_max_freq(slpc, freq);
if (err) {
pr_err("Unable to update max freq");
return err;
}
err = slpc_set_min_freq(slpc, freq);
if (err) {
pr_err("Unable to update min freq");
return err;
}
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 slpc_measure_power(struct intel_rps *rps, int *freq)
{
u64 x[5];
int i;
for (i = 0; i < 5; i++)
x[i] = __measure_power(5);
*freq = (*freq + intel_rps_read_actual_frequency(rps)) / 2;
/* A simple triangle filter for better result stability */
Annotation
- Detected declarations: `struct slpc_thread`, `enum test_type`, `function slpc_set_min_freq`, `function slpc_set_max_freq`, `function slpc_set_freq`, `function slpc_restore_freq`, `function slpc_measure_power`, `function measure_power_at_freq`, `function vary_max_freq`, `function vary_min_freq`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.