drivers/gpu/drm/xe/xe_exec.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_exec.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_exec.c- Extension
.c- Size
- 10947 bytes
- Lines
- 373
- 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.
- 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.hdrm/drm_device.hdrm/drm_exec.hdrm/drm_file.huapi/drm/xe_drm.hlinux/delay.hxe_device.hxe_exec_queue.hxe_hw_engine_group.hxe_macros.hxe_pm.hxe_ring_ops_types.hxe_sched_job.hxe_sync.hxe_svm.hxe_trace.hxe_vm.h
Detected Declarations
function driversfunction xe_exec_ioctl
Annotated Snippet
if (!syncs) {
err = -ENOMEM;
goto err_exec_queue;
}
}
vm = q->vm;
for (num_syncs = 0; num_syncs < args->num_syncs; num_syncs++) {
err = xe_sync_entry_parse(xe, xef, &syncs[num_syncs],
&syncs_user[num_syncs], NULL, 0,
SYNC_PARSE_FLAG_EXEC |
(xe_vm_in_lr_mode(vm) ?
SYNC_PARSE_FLAG_LR_MODE : 0));
if (err)
goto err_syncs;
if (xe_sync_is_ufence(&syncs[num_syncs]))
num_ufence++;
if (!num_in_sync && xe_sync_needs_wait(&syncs[num_syncs]))
num_in_sync++;
}
if (XE_IOCTL_DBG(xe, num_ufence > 1)) {
err = -EINVAL;
goto err_syncs;
}
if (args->num_batch_buffer && xe_exec_queue_is_parallel(q)) {
err = copy_from_user(addresses, addresses_user,
sizeof(u64) * q->width);
if (err) {
err = -EFAULT;
goto err_syncs;
}
}
group = q->hwe->hw_engine_group;
mode = xe_hw_engine_group_find_exec_mode(q);
if (mode == EXEC_MODE_DMA_FENCE) {
err = xe_hw_engine_group_get_mode(group, mode, &previous_mode,
syncs, num_in_sync ?
num_syncs : 0);
if (err)
goto err_syncs;
}
retry:
if (!xe_vm_in_lr_mode(vm) && xe_vm_userptr_check_repin(vm)) {
err = down_write_killable(&vm->lock);
write_locked = true;
} else {
/* We don't allow execs while the VM is in error state */
err = down_read_interruptible(&vm->lock);
write_locked = false;
}
if (err)
goto err_hw_exec_mode;
if (write_locked) {
err = xe_vm_userptr_pin(vm);
downgrade_write(&vm->lock);
write_locked = false;
if (err)
goto err_unlock_list;
}
if (!args->num_batch_buffer) {
err = xe_vm_lock(vm, true);
if (err)
goto err_unlock_list;
if (!xe_vm_in_lr_mode(vm)) {
struct dma_fence *fence;
fence = xe_sync_in_fence_get(syncs, num_syncs, q, vm);
if (IS_ERR(fence)) {
err = PTR_ERR(fence);
xe_vm_unlock(vm);
goto err_unlock_list;
}
for (i = 0; i < num_syncs; i++)
xe_sync_entry_signal(&syncs[i], fence);
xe_exec_queue_last_fence_set(q, vm, fence);
dma_fence_put(fence);
}
xe_vm_unlock(vm);
Annotation
- Immediate include surface: `xe_exec.h`, `drm/drm_device.h`, `drm/drm_exec.h`, `drm/drm_file.h`, `uapi/drm/xe_drm.h`, `linux/delay.h`, `xe_device.h`, `xe_exec_queue.h`.
- Detected declarations: `function drivers`, `function xe_exec_ioctl`.
- 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.
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.