drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c- Extension
.c- Size
- 170593 bytes
- Lines
- 6015
- 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
linux/circ_buf.hgem/i915_gem_context.hgem/i915_gem_lmem.hgt/gen8_engine_cs.hgt/intel_breadcrumbs.hgt/intel_context.hgt/intel_engine_heartbeat.hgt/intel_engine_pm.hgt/intel_engine_regs.hgt/intel_gpu_commands.hgt/intel_gt.hgt/intel_gt_clock_utils.hgt/intel_gt_irq.hgt/intel_gt_pm.hgt/intel_gt_regs.hgt/intel_gt_requests.hgt/intel_lrc.hgt/intel_lrc_reg.hgt/intel_mocs.hgt/intel_ring.hi915_drv.hi915_irq.hi915_reg.hi915_trace.hi915_wait_util.hintel_guc_ads.hintel_guc_capture.hintel_guc_print.hintel_guc_submission.hselftest_guc.cselftest_guc_multi_lrc.cselftest_guc_hangcheck.c
Detected Declarations
struct guc_virtual_enginestruct sync_semaphorestruct parent_scratchstruct context_policystruct scheduling_policyfunction init_sched_statefunction sched_state_is_initfunction context_wait_for_deregister_to_registerfunction set_context_wait_for_deregister_to_registerfunction clr_context_wait_for_deregister_to_registerfunction context_destroyedfunction set_context_destroyedfunction clr_context_destroyedfunction context_pending_disablefunction set_context_pending_disablefunction clr_context_pending_disablefunction context_bannedfunction set_context_bannedfunction clr_context_bannedfunction context_enabledfunction set_context_enabledfunction clr_context_enabledfunction context_pending_enablefunction set_context_pending_enablefunction clr_context_pending_enablefunction context_registeredfunction set_context_registeredfunction clr_context_registeredfunction context_policy_requiredfunction set_context_policy_requiredfunction clr_context_policy_requiredfunction context_close_donefunction set_context_close_donefunction context_blockedfunction incr_context_blockedfunction decr_context_blockedfunction request_to_scheduling_contextfunction context_guc_id_invalidfunction set_context_guc_id_invalidfunction __get_parent_scratch_offsetfunction __get_wq_offsetfunction __get_parent_scratchfunction __get_process_desc_v69function __get_wq_desc_v70function guc_lrc_desc_pool_create_v69function guc_lrc_desc_pool_destroy_v69function guc_submission_initializedfunction _reset_lrc_desc_v69
Annotated Snippet
struct guc_virtual_engine {
struct intel_engine_cs base;
struct intel_context context;
};
static struct intel_context *
guc_create_virtual(struct intel_engine_cs **siblings, unsigned int count,
unsigned long flags);
static struct intel_context *
guc_create_parallel(struct intel_engine_cs **engines,
unsigned int num_siblings,
unsigned int width);
#define GUC_REQUEST_SIZE 64 /* bytes */
/*
* We reserve 1/16 of the guc_ids for multi-lrc as these need to be contiguous
* per the GuC submission interface. A different allocation algorithm is used
* (bitmap vs. ida) between multi-lrc and single-lrc hence the reason to
* partition the guc_id space. We believe the number of multi-lrc contexts in
* use should be low and 1/16 should be sufficient. Minimum of 32 guc_ids for
* multi-lrc.
*/
#define NUMBER_MULTI_LRC_GUC_ID(guc) \
((guc)->submission_state.num_guc_ids / 16)
/*
* Below is a set of functions which control the GuC scheduling state which
* require a lock.
*/
#define SCHED_STATE_WAIT_FOR_DEREGISTER_TO_REGISTER BIT(0)
#define SCHED_STATE_DESTROYED BIT(1)
#define SCHED_STATE_PENDING_DISABLE BIT(2)
#define SCHED_STATE_BANNED BIT(3)
#define SCHED_STATE_ENABLED BIT(4)
#define SCHED_STATE_PENDING_ENABLE BIT(5)
#define SCHED_STATE_REGISTERED BIT(6)
#define SCHED_STATE_POLICY_REQUIRED BIT(7)
#define SCHED_STATE_CLOSED BIT(8)
#define SCHED_STATE_BLOCKED_SHIFT 9
#define SCHED_STATE_BLOCKED BIT(SCHED_STATE_BLOCKED_SHIFT)
#define SCHED_STATE_BLOCKED_MASK (0xfff << SCHED_STATE_BLOCKED_SHIFT)
static inline void init_sched_state(struct intel_context *ce)
{
lockdep_assert_held(&ce->guc_state.lock);
ce->guc_state.sched_state &= SCHED_STATE_BLOCKED_MASK;
}
/*
* Kernel contexts can have SCHED_STATE_REGISTERED after suspend.
* A context close can race with the submission path, so SCHED_STATE_CLOSED
* can be set immediately before we try to register.
*/
#define SCHED_STATE_VALID_INIT \
(SCHED_STATE_BLOCKED_MASK | \
SCHED_STATE_CLOSED | \
SCHED_STATE_REGISTERED)
__maybe_unused
static bool sched_state_is_init(struct intel_context *ce)
{
return !(ce->guc_state.sched_state & ~SCHED_STATE_VALID_INIT);
}
static inline bool
context_wait_for_deregister_to_register(struct intel_context *ce)
{
return ce->guc_state.sched_state &
SCHED_STATE_WAIT_FOR_DEREGISTER_TO_REGISTER;
}
static inline void
set_context_wait_for_deregister_to_register(struct intel_context *ce)
{
lockdep_assert_held(&ce->guc_state.lock);
ce->guc_state.sched_state |=
SCHED_STATE_WAIT_FOR_DEREGISTER_TO_REGISTER;
}
static inline void
clr_context_wait_for_deregister_to_register(struct intel_context *ce)
{
lockdep_assert_held(&ce->guc_state.lock);
ce->guc_state.sched_state &=
~SCHED_STATE_WAIT_FOR_DEREGISTER_TO_REGISTER;
}
static inline bool
Annotation
- Immediate include surface: `linux/circ_buf.h`, `gem/i915_gem_context.h`, `gem/i915_gem_lmem.h`, `gt/gen8_engine_cs.h`, `gt/intel_breadcrumbs.h`, `gt/intel_context.h`, `gt/intel_engine_heartbeat.h`, `gt/intel_engine_pm.h`.
- Detected declarations: `struct guc_virtual_engine`, `struct sync_semaphore`, `struct parent_scratch`, `struct context_policy`, `struct scheduling_policy`, `function init_sched_state`, `function sched_state_is_init`, `function context_wait_for_deregister_to_register`, `function set_context_wait_for_deregister_to_register`, `function clr_context_wait_for_deregister_to_register`.
- 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.