drivers/gpu/drm/xe/xe_exec_queue.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_exec_queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_exec_queue.c- Extension
.c- Size
- 51796 bytes
- Lines
- 1862
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
xe_exec_queue.hlinux/nospec.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_syncobj.huapi/drm/xe_drm.hxe_bo.hxe_dep_scheduler.hxe_device.hxe_gt.hxe_gt_sriov_pf.hxe_gt_sriov_vf.hxe_hw_engine_class_sysfs.hxe_hw_engine_group.hxe_irq.hxe_lrc.hxe_macros.hxe_migrate.hxe_pm.hxe_trace.hxe_vm.hxe_pxp.h
Detected Declarations
enum xe_exec_queue_sched_propfunction xe_exec_queue_group_cleanupfunction __xe_exec_queue_freefunction alloc_dep_schedulersfunction xe_exec_queue_set_lrcfunction scoped_guardfunction xe_exec_queue_get_lrcfunction scoped_guardfunction xe_exec_queue_lrcfunction __xe_exec_queue_finifunction __xe_exec_queue_initfunction isolationfunction xe_exec_queue_createfunction xe_exec_queue_create_classfunction for_each_hw_enginefunction xe_exec_queue_create_bindfunction xe_exec_queue_destroyfunction xe_exec_queue_finifunction xe_exec_queue_assign_namefunction xe_exec_queue_lookupfunction xe_exec_queue_device_get_max_priorityfunction exec_queue_set_priorityfunction xe_exec_queue_enforce_schedule_limitfunction xe_exec_queue_get_prop_minmaxfunction exec_queue_set_timeslicefunction exec_queue_set_pxp_typefunction exec_queue_set_hang_replay_statefunction xe_exec_queue_group_initfunction xe_exec_queue_group_validatefunction xe_exec_queue_group_addfunction xe_exec_queue_group_deletefunction exec_queue_set_multi_groupfunction exec_queue_set_multi_queue_priorityfunction exec_queue_set_state_cache_perf_fixfunction xe_exec_queue_set_property_ioctlfunction exec_queue_user_ext_checkfunction exec_queue_user_ext_check_finalfunction exec_queue_user_ext_set_propertyfunction __exec_queue_user_extensionsfunction exec_queue_user_extensionsfunction calc_validate_logical_maskfunction has_sched_groupsfunction xe_exec_queue_create_ioctlfunction for_each_tilefunction xe_exec_queue_get_property_ioctlfunction xe_exec_queue_is_lrfunction xe_exec_queue_is_idlefunction xe_exec_queue_update_run_ticks
Annotated Snippet
if (err) {
__xe_exec_queue_free(q);
return ERR_PTR(err);
}
}
if (vm)
q->vm = xe_vm_get(vm);
if (extensions) {
/*
* may set q->usm, must come before xe_lrc_create(),
* may overwrite q->sched_props, must come before q->ops->init()
*/
err = exec_queue_user_extensions(xe, q, extensions);
if (err) {
__xe_exec_queue_free(q);
return ERR_PTR(err);
}
}
return q;
}
static void xe_exec_queue_set_lrc(struct xe_exec_queue *q, struct xe_lrc *lrc, u16 idx)
{
xe_assert(gt_to_xe(q->gt), idx < q->width);
scoped_guard(spinlock, &q->lrc_lookup_lock) {
q->lrc[idx] = lrc;
if (xe_exec_queue_is_multi_queue(q))
q->lrc[idx]->multi_queue.primary_lrc =
q->multi_queue.group->primary->lrc[0];
}
}
/**
* xe_exec_queue_get_lrc() - Get the LRC from exec queue.
* @q: The exec queue instance.
* @idx: Index within multi-LRC array.
*
* Retrieves LRC of given index for the exec queue under lock
* and takes reference.
*
* Return: Pointer to LRC on success, error on failure, NULL on
* lookup failure.
*/
struct xe_lrc *xe_exec_queue_get_lrc(struct xe_exec_queue *q, u16 idx)
{
struct xe_lrc *lrc;
xe_assert(gt_to_xe(q->gt), idx < q->width);
scoped_guard(spinlock, &q->lrc_lookup_lock) {
lrc = q->lrc[idx];
if (lrc)
xe_lrc_get(lrc);
}
return lrc;
}
/**
* xe_exec_queue_lrc() - Get the LRC from exec queue.
* @q: The exec queue instance.
*
* Retrieves the primary LRC for the exec queue. Note that this function
* returns only the first LRC instance, even when multiple parallel LRCs
* are configured. This function does not increment reference count,
* so the reference can be just forgotten after use.
*
* Return: Pointer to LRC on success, error on failure
*/
struct xe_lrc *xe_exec_queue_lrc(struct xe_exec_queue *q)
{
return q->lrc[0];
}
static void __xe_exec_queue_fini(struct xe_exec_queue *q)
{
int i;
q->ops->fini(q);
for (i = 0; i < q->width; ++i)
xe_lrc_put(q->lrc[i]);
}
static int __xe_exec_queue_init(struct xe_exec_queue *q, u32 exec_queue_flags)
{
Annotation
- Immediate include surface: `xe_exec_queue.h`, `linux/nospec.h`, `drm/drm_device.h`, `drm/drm_drv.h`, `drm/drm_file.h`, `drm/drm_syncobj.h`, `uapi/drm/xe_drm.h`, `xe_bo.h`.
- Detected declarations: `enum xe_exec_queue_sched_prop`, `function xe_exec_queue_group_cleanup`, `function __xe_exec_queue_free`, `function alloc_dep_schedulers`, `function xe_exec_queue_set_lrc`, `function scoped_guard`, `function xe_exec_queue_get_lrc`, `function scoped_guard`, `function xe_exec_queue_lrc`, `function __xe_exec_queue_fini`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.