drivers/gpu/drm/i915/gt/uc/selftest_guc_multi_lrc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/selftest_guc_multi_lrc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/selftest_guc_multi_lrc.c- Extension
.c- Size
- 4011 bytes
- Lines
- 185
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
gt/intel_gt_print.hselftests/igt_spinner.hselftests/igt_reset.hselftests/intel_scheduler_helpers.hgt/intel_engine_heartbeat.hgem/selftests/mock_context.h
Detected Declarations
function logical_sortfunction multi_lrc_create_parentfunction for_each_enginefunction multi_lrc_context_unpinfunction multi_lrc_context_putfunction multi_lrc_nop_requestfunction for_each_childfunction __intel_guc_multi_lrc_basicfunction intel_guc_multi_lrc_basicfunction intel_guc_multi_lrc_live_selftests
Annotated Snippet
if (engines[j]->logical_mask & BIT(i)) {
sorted[i] = engines[j];
break;
}
}
memcpy(*engines, *sorted,
sizeof(struct intel_engine_cs *) * num_engines);
}
static struct intel_context *
multi_lrc_create_parent(struct intel_gt *gt, u8 class,
unsigned long flags)
{
struct intel_engine_cs *siblings[MAX_ENGINE_INSTANCE + 1];
struct intel_engine_cs *engine;
enum intel_engine_id id;
int i = 0;
for_each_engine(engine, gt, id) {
if (engine->class != class)
continue;
siblings[i++] = engine;
}
if (i <= 1)
return ERR_PTR(0);
logical_sort(siblings, i);
return intel_engine_create_parallel(siblings, 1, i);
}
static void multi_lrc_context_unpin(struct intel_context *ce)
{
struct intel_context *child;
GEM_BUG_ON(!intel_context_is_parent(ce));
for_each_child(ce, child)
intel_context_unpin(child);
intel_context_unpin(ce);
}
static void multi_lrc_context_put(struct intel_context *ce)
{
GEM_BUG_ON(!intel_context_is_parent(ce));
/*
* Only the parent gets the creation ref put in the uAPI, the parent
* itself is responsible for creation ref put on the children.
*/
intel_context_put(ce);
}
static struct i915_request *
multi_lrc_nop_request(struct intel_context *ce)
{
struct intel_context *child;
struct i915_request *rq, *child_rq;
int i = 0;
GEM_BUG_ON(!intel_context_is_parent(ce));
rq = intel_context_create_request(ce);
if (IS_ERR(rq))
return rq;
i915_request_get(rq);
i915_request_add(rq);
for_each_child(ce, child) {
child_rq = intel_context_create_request(child);
if (IS_ERR(child_rq))
goto child_error;
if (++i == ce->parallel.number_children)
set_bit(I915_FENCE_FLAG_SUBMIT_PARALLEL,
&child_rq->fence.flags);
i915_request_add(child_rq);
}
return rq;
child_error:
i915_request_put(rq);
return ERR_PTR(-ENOMEM);
}
Annotation
- Immediate include surface: `gt/intel_gt_print.h`, `selftests/igt_spinner.h`, `selftests/igt_reset.h`, `selftests/intel_scheduler_helpers.h`, `gt/intel_engine_heartbeat.h`, `gem/selftests/mock_context.h`.
- Detected declarations: `function logical_sort`, `function multi_lrc_create_parent`, `function for_each_engine`, `function multi_lrc_context_unpin`, `function multi_lrc_context_put`, `function multi_lrc_nop_request`, `function for_each_child`, `function __intel_guc_multi_lrc_basic`, `function intel_guc_multi_lrc_basic`, `function intel_guc_multi_lrc_live_selftests`.
- 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.