drivers/gpu/drm/i915/gt/selftest_context.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/selftest_context.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/selftest_context.c- Extension
.c- Size
- 10268 bytes
- Lines
- 456
- 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
drm/drm_print.hi915_selftest.hintel_engine_heartbeat.hintel_engine_pm.hintel_gt.hgem/selftests/mock_context.hselftests/igt_flush_test.hselftests/mock_drm.h
Detected Declarations
function request_syncfunction context_syncfunction __live_context_sizefunction live_context_sizefunction for_each_enginefunction __live_active_contextfunction live_active_contextfunction for_each_enginefunction __remote_syncfunction __live_remote_contextfunction live_remote_contextfunction for_each_enginefunction intel_context_live_selftests
Annotated Snippet
if (IS_ERR(rq)) {
err = PTR_ERR(rq);
goto out_engine;
}
err = request_sync(rq);
if (err)
goto out_engine;
/* Context will be kept active until after an idle-barrier. */
if (i915_active_is_idle(&ce->active)) {
pr_err("context is not active; expected idle-barrier (%s pass %d)\n",
engine->name, pass);
err = -EINVAL;
goto out_engine;
}
if (!intel_engine_pm_is_awake(engine)) {
pr_err("%s is asleep before idle-barrier\n",
engine->name);
err = -EINVAL;
goto out_engine;
}
out_engine:
intel_engine_pm_put(engine);
if (err)
goto err;
}
/* Now make sure our idle-barriers are flushed */
err = intel_engine_flush_barriers(engine);
if (err)
goto err;
/* Wait for the barrier and in the process wait for engine to park */
err = context_sync(engine->kernel_context);
if (err)
goto err;
if (!i915_active_is_idle(&ce->active)) {
pr_err("context is still active!");
err = -EINVAL;
}
intel_engine_pm_flush(engine);
if (intel_engine_pm_is_awake(engine)) {
struct drm_printer p = drm_dbg_printer(&engine->i915->drm,
DRM_UT_DRIVER, NULL);
intel_engine_dump(engine, &p,
"%s is still awake:%d after idle-barriers\n",
engine->name,
atomic_read(&engine->wakeref.count));
GEM_TRACE_DUMP();
err = -EINVAL;
goto err;
}
err:
engine->props.heartbeat_interval_ms = saved_heartbeat;
intel_context_put(ce);
return err;
}
static int live_active_context(void *arg)
{
struct intel_gt *gt = arg;
struct intel_engine_cs *engine;
enum intel_engine_id id;
int err = 0;
for_each_engine(engine, gt, id) {
err = __live_active_context(engine);
if (err)
break;
err = igt_flush_test(gt->i915);
if (err)
break;
}
return err;
}
static int __remote_sync(struct intel_context *ce, struct intel_context *remote)
{
struct i915_request *rq;
Annotation
- Immediate include surface: `drm/drm_print.h`, `i915_selftest.h`, `intel_engine_heartbeat.h`, `intel_engine_pm.h`, `intel_gt.h`, `gem/selftests/mock_context.h`, `selftests/igt_flush_test.h`, `selftests/mock_drm.h`.
- Detected declarations: `function request_sync`, `function context_sync`, `function __live_context_size`, `function live_context_size`, `function for_each_engine`, `function __live_active_context`, `function live_active_context`, `function for_each_engine`, `function __remote_sync`, `function __live_remote_context`.
- 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.