drivers/gpu/drm/i915/gt/selftest_migrate.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/selftest_migrate.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/selftest_migrate.c- Extension
.c- Size
- 23173 bytes
- Lines
- 1040
- 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.hgem/i915_gem_internal.hgem/i915_gem_lmem.hselftests/igt_spinner.hselftests/i915_random.h
Detected Declarations
struct spinner_timerstruct threaded_migratefunction create_lmem_or_internalfunction copyfunction for_i915_gem_wwfunction intel_context_copy_ccsfunction intel_migrate_ccs_copyfunction clearfunction for_i915_gem_wwfunction __migrate_copyfunction __global_copyfunction migrate_copyfunction global_copyfunction __migrate_clearfunction __global_clearfunction migrate_clearfunction global_clearfunction live_migrate_copyfunction live_migrate_clearfunction spinner_killfunction live_emit_pte_full_ringfunction threaded_migratefunction __thread_migrate_copyfunction thread_migrate_copyfunction __thread_global_copyfunction thread_global_copyfunction __thread_migrate_clearfunction __thread_global_clearfunction thread_migrate_clearfunction thread_global_clearfunction intel_migrate_live_selftestsfunction create_init_lmem_internalfunction wrap_ktime_comparefunction __perf_clear_bltfunction perf_clear_bltfunction __perf_copy_bltfunction perf_copy_bltfunction intel_migrate_perf_selftests
Annotated Snippet
struct spinner_timer {
struct timer_list timer;
struct igt_spinner spin;
};
static void spinner_kill(struct timer_list *timer)
{
struct spinner_timer *st = timer_container_of(st, timer, timer);
igt_spinner_end(&st->spin);
pr_info("%s\n", __func__);
}
static int live_emit_pte_full_ring(void *arg)
{
struct intel_gt *gt = arg;
struct intel_migrate *migrate = >->migrate;
struct drm_i915_private *i915 = migrate->context->engine->i915;
struct drm_i915_gem_object *obj;
struct intel_context *ce;
struct i915_request *rq, *prev;
struct spinner_timer st;
struct sgt_dma it;
int len, sz, err;
u32 *cs;
/*
* Simple regression test to check that we don't trample the
* rq->reserved_space when returning from emit_pte(), if the ring is
* nearly full.
*/
if (igt_spinner_init(&st.spin, to_gt(i915)))
return -ENOMEM;
obj = i915_gem_object_create_internal(i915, 2 * PAGE_SIZE);
if (IS_ERR(obj)) {
err = PTR_ERR(obj);
goto out_spinner;
}
err = i915_gem_object_pin_pages_unlocked(obj);
if (err)
goto out_obj;
ce = intel_migrate_create_context(migrate);
if (IS_ERR(ce)) {
err = PTR_ERR(ce);
goto out_obj;
}
ce->ring_size = SZ_4K; /* Not too big */
err = intel_context_pin(ce);
if (err)
goto out_put;
rq = igt_spinner_create_request(&st.spin, ce, MI_ARB_CHECK);
if (IS_ERR(rq)) {
err = PTR_ERR(rq);
goto out_unpin;
}
i915_request_add(rq);
if (!igt_wait_for_spinner(&st.spin, rq)) {
err = -EIO;
goto out_unpin;
}
/*
* Fill the rest of the ring leaving I915_EMIT_PTE_NUM_DWORDS +
* ring->reserved_space at the end. To actually emit the PTEs we require
* slightly more than I915_EMIT_PTE_NUM_DWORDS, since our object size is
* greater than PAGE_SIZE. The correct behaviour is to wait for more
* ring space in emit_pte(), otherwise we trample on the reserved_space
* resulting in crashes when later submitting the rq.
*/
prev = NULL;
do {
if (prev)
i915_request_add(rq);
rq = i915_request_create(ce);
if (IS_ERR(rq)) {
err = PTR_ERR(rq);
goto out_unpin;
}
sz = (rq->ring->space - rq->reserved_space) / sizeof(u32) -
Annotation
- Immediate include surface: `linux/sort.h`, `gem/i915_gem_internal.h`, `gem/i915_gem_lmem.h`, `selftests/igt_spinner.h`, `selftests/i915_random.h`.
- Detected declarations: `struct spinner_timer`, `struct threaded_migrate`, `function create_lmem_or_internal`, `function copy`, `function for_i915_gem_ww`, `function intel_context_copy_ccs`, `function intel_migrate_ccs_copy`, `function clear`, `function for_i915_gem_ww`, `function __migrate_copy`.
- 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.