drivers/gpu/drm/xe/xe_guc_submit.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_guc_submit.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_guc_submit.c- Extension
.c- Size
- 98977 bytes
- Lines
- 3418
- 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.
- 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_guc_submit.hlinux/bitfield.hlinux/bitmap.hlinux/circ_buf.hlinux/dma-fence-array.hdrm/drm_managed.habi/guc_actions_abi.habi/guc_actions_slpc_abi.habi/guc_klvs_abi.hxe_assert.hxe_bo.hxe_devcoredump.hxe_device.hxe_exec_queue.hxe_force_wake.hxe_gpu_scheduler.hxe_gt.hxe_gt_clock.hxe_gt_printk.hxe_guc.hxe_guc_capture.hxe_guc_ct.hxe_guc_exec_queue_types.hxe_guc_id_mgr.hxe_guc_klv_helpers.hxe_guc_submit_types.hxe_hw_engine.hxe_lrc.hxe_macros.hxe_map.hxe_mocs.hxe_pm.h
Detected Declarations
struct exec_queue_policystruct guc_ctxt_registration_infofunction exec_queue_to_gucfunction timefunction set_exec_queue_registeredfunction clear_exec_queue_registeredfunction exec_queue_enabledfunction set_exec_queue_enabledfunction clear_exec_queue_enabledfunction exec_queue_pending_enablefunction set_exec_queue_pending_enablefunction clear_exec_queue_pending_enablefunction exec_queue_pending_disablefunction set_exec_queue_pending_disablefunction clear_exec_queue_pending_disablefunction exec_queue_destroyedfunction set_exec_queue_destroyedfunction clear_exec_queue_destroyedfunction exec_queue_bannedfunction set_exec_queue_bannedfunction clear_exec_queue_bannedfunction exec_queue_suspendedfunction set_exec_queue_suspendedfunction clear_exec_queue_suspendedfunction exec_queue_resetfunction set_exec_queue_resetfunction exec_queue_killedfunction set_exec_queue_killedfunction exec_queue_wedgedfunction set_exec_queue_wedgedfunction exec_queue_pending_resumefunction set_exec_queue_pending_resumefunction clear_exec_queue_pending_resumefunction exec_queue_killed_or_banned_or_wedgedfunction guc_submit_sw_finifunction guc_submit_finifunction primelockdepfunction xe_guc_submit_initfunction guc_init_global_schedule_policyfunction xe_guc_submit_enablefunction xe_guc_submit_disablefunction __release_guc_idfunction alloc_guc_idfunction publish_guc_idfunction release_guc_idfunction __guc_exec_queue_policy_action_sizefunction __guc_exec_queue_policy_start_klvfunction init_policies
Annotated Snippet
struct exec_queue_policy {
u32 count;
struct guc_update_exec_queue_policy h2g;
};
static u32 __guc_exec_queue_policy_action_size(struct exec_queue_policy *policy)
{
size_t bytes = sizeof(policy->h2g.header) +
(sizeof(policy->h2g.klv[0]) * policy->count);
return bytes / sizeof(u32);
}
static void __guc_exec_queue_policy_start_klv(struct exec_queue_policy *policy,
u16 guc_id)
{
policy->h2g.header.action =
XE_GUC_ACTION_HOST2GUC_UPDATE_CONTEXT_POLICIES;
policy->h2g.header.guc_id = guc_id;
policy->count = 0;
}
#define MAKE_EXEC_QUEUE_POLICY_ADD(func, id) \
static void __guc_exec_queue_policy_add_##func(struct exec_queue_policy *policy, \
u32 data) \
{ \
XE_WARN_ON(policy->count >= GUC_CONTEXT_POLICIES_KLV_NUM_IDS); \
\
policy->h2g.klv[policy->count].kl = \
FIELD_PREP(GUC_KLV_0_KEY, \
GUC_CONTEXT_POLICIES_KLV_ID_##id) | \
FIELD_PREP(GUC_KLV_0_LEN, 1); \
policy->h2g.klv[policy->count].value = data; \
policy->count++; \
}
MAKE_EXEC_QUEUE_POLICY_ADD(execution_quantum, EXECUTION_QUANTUM)
MAKE_EXEC_QUEUE_POLICY_ADD(preemption_timeout, PREEMPTION_TIMEOUT)
MAKE_EXEC_QUEUE_POLICY_ADD(priority, SCHEDULING_PRIORITY)
MAKE_EXEC_QUEUE_POLICY_ADD(slpc_exec_queue_freq_req, SLPM_GT_FREQUENCY)
#undef MAKE_EXEC_QUEUE_POLICY_ADD
static const int xe_exec_queue_prio_to_guc[] = {
[XE_EXEC_QUEUE_PRIORITY_LOW] = GUC_CLIENT_PRIORITY_NORMAL,
[XE_EXEC_QUEUE_PRIORITY_NORMAL] = GUC_CLIENT_PRIORITY_KMD_NORMAL,
[XE_EXEC_QUEUE_PRIORITY_HIGH] = GUC_CLIENT_PRIORITY_HIGH,
[XE_EXEC_QUEUE_PRIORITY_KERNEL] = GUC_CLIENT_PRIORITY_KMD_HIGH,
};
static void init_policies(struct xe_guc *guc, struct xe_exec_queue *q)
{
struct exec_queue_policy policy;
enum xe_exec_queue_priority prio = q->sched_props.priority;
u32 timeslice_us = q->sched_props.timeslice_us;
u32 slpc_exec_queue_freq_req = 0;
u32 preempt_timeout_us = q->sched_props.preempt_timeout_us;
xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q) &&
!xe_exec_queue_is_multi_queue_secondary(q));
if (q->flags & EXEC_QUEUE_FLAG_LOW_LATENCY)
slpc_exec_queue_freq_req |= SLPC_CTX_FREQ_REQ_IS_COMPUTE;
__guc_exec_queue_policy_start_klv(&policy, q->guc->id);
__guc_exec_queue_policy_add_priority(&policy, xe_exec_queue_prio_to_guc[prio]);
__guc_exec_queue_policy_add_execution_quantum(&policy, timeslice_us);
__guc_exec_queue_policy_add_preemption_timeout(&policy, preempt_timeout_us);
__guc_exec_queue_policy_add_slpc_exec_queue_freq_req(&policy,
slpc_exec_queue_freq_req);
xe_guc_ct_send(&guc->ct, (u32 *)&policy.h2g,
__guc_exec_queue_policy_action_size(&policy), 0, 0);
}
static void set_min_preemption_timeout(struct xe_guc *guc, struct xe_exec_queue *q)
{
struct exec_queue_policy policy;
xe_assert(guc_to_xe(guc), !xe_exec_queue_is_multi_queue_secondary(q));
__guc_exec_queue_policy_start_klv(&policy, q->guc->id);
__guc_exec_queue_policy_add_preemption_timeout(&policy, 1);
xe_guc_ct_send(&guc->ct, (u32 *)&policy.h2g,
__guc_exec_queue_policy_action_size(&policy), 0, 0);
}
static bool vf_recovery(struct xe_guc *guc)
{
return xe_gt_recovery_pending(guc_to_gt(guc));
Annotation
- Immediate include surface: `xe_guc_submit.h`, `linux/bitfield.h`, `linux/bitmap.h`, `linux/circ_buf.h`, `linux/dma-fence-array.h`, `drm/drm_managed.h`, `abi/guc_actions_abi.h`, `abi/guc_actions_slpc_abi.h`.
- Detected declarations: `struct exec_queue_policy`, `struct guc_ctxt_registration_info`, `function exec_queue_to_guc`, `function time`, `function set_exec_queue_registered`, `function clear_exec_queue_registered`, `function exec_queue_enabled`, `function set_exec_queue_enabled`, `function clear_exec_queue_enabled`, `function exec_queue_pending_enable`.
- 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.