drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c- Extension
.c- Size
- 6728 bytes
- Lines
- 320
- 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
linux/sort.hi915_drv.hintel_gt_requests.hi915_selftest.hselftest_engine_heartbeat.h
Detected Declarations
struct pulsefunction reset_heartbeatfunction timeline_syncfunction engine_sync_barrierfunction pulse_activefunction pulse_freefunction pulse_putfunction pulse_retirefunction pulse_unlock_waitfunction __live_idle_pulsefunction live_idle_flushfunction for_each_enginefunction live_idle_pulsefunction for_each_enginefunction __live_heartbeat_offfunction live_heartbeat_offfunction for_each_enginefunction intel_heartbeat_live_selftestsfunction st_engine_heartbeat_disablefunction st_engine_heartbeat_enablefunction st_engine_heartbeat_disable_no_pmfunction st_engine_heartbeat_enable_no_pm
Annotated Snippet
struct pulse {
struct i915_active active;
struct kref kref;
};
static int pulse_active(struct i915_active *active)
{
kref_get(&container_of(active, struct pulse, active)->kref);
return 0;
}
static void pulse_free(struct kref *kref)
{
struct pulse *p = container_of(kref, typeof(*p), kref);
i915_active_fini(&p->active);
kfree(p);
}
static void pulse_put(struct pulse *p)
{
kref_put(&p->kref, pulse_free);
}
static void pulse_retire(struct i915_active *active)
{
pulse_put(container_of(active, struct pulse, active));
}
static struct pulse *pulse_create(void)
{
struct pulse *p;
p = kmalloc_obj(*p);
if (!p)
return p;
kref_init(&p->kref);
i915_active_init(&p->active, pulse_active, pulse_retire, 0);
return p;
}
static void pulse_unlock_wait(struct pulse *p)
{
wait_var_event_timeout(&p->active, i915_active_is_idle(&p->active), HZ);
}
static int __live_idle_pulse(struct intel_engine_cs *engine,
int (*fn)(struct intel_engine_cs *cs))
{
struct pulse *p;
int err;
GEM_BUG_ON(!intel_engine_pm_is_awake(engine));
p = pulse_create();
if (!p)
return -ENOMEM;
err = i915_active_acquire(&p->active);
if (err)
goto out;
err = i915_active_acquire_preallocate_barrier(&p->active, engine);
if (err) {
i915_active_release(&p->active);
goto out;
}
i915_active_acquire_barrier(&p->active);
i915_active_release(&p->active);
GEM_BUG_ON(i915_active_is_idle(&p->active));
GEM_BUG_ON(llist_empty(&engine->barrier_tasks));
err = fn(engine);
if (err)
goto out;
GEM_BUG_ON(!llist_empty(&engine->barrier_tasks));
if (engine_sync_barrier(engine)) {
struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse");
drm_printf(&m, "%s: no heartbeat pulse?\n", engine->name);
intel_engine_dump(engine, &m, "%s", engine->name);
err = -ETIME;
goto out;
Annotation
- Immediate include surface: `linux/sort.h`, `i915_drv.h`, `intel_gt_requests.h`, `i915_selftest.h`, `selftest_engine_heartbeat.h`.
- Detected declarations: `struct pulse`, `function reset_heartbeat`, `function timeline_sync`, `function engine_sync_barrier`, `function pulse_active`, `function pulse_free`, `function pulse_put`, `function pulse_retire`, `function pulse_unlock_wait`, `function __live_idle_pulse`.
- 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.