drivers/gpu/drm/i915/gt/intel_context.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_context.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_context.h- Extension
.h- Size
- 10718 bytes
- Lines
- 410
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/lockdep.hlinux/types.hi915_active.hi915_drv.hintel_context_types.hintel_engine_types.hintel_gt_pm.hintel_ring_types.hintel_timeline_types.hi915_trace.h
Detected Declarations
struct i915_gem_ww_ctxfunction intel_context_is_childfunction intel_context_is_parentfunction intel_context_to_parentfunction intel_context_is_parallelfunction intel_context_is_pinnedfunction intel_context_is_pinnedfunction intel_context_cancel_requestfunction intel_context_unlock_pinnedfunction intel_context_pin_if_activefunction intel_context_pinfunction intel_context_pin_wwfunction __intel_context_pinfunction intel_context_sched_disable_unpinfunction intel_context_unpinfunction intel_context_enterfunction intel_context_mark_activefunction intel_context_exitfunction intel_context_putfunction intel_context_timeline_lockfunction intel_context_timeline_unlockfunction intel_context_is_barrierfunction intel_context_closefunction intel_context_is_closedfunction intel_context_has_inflightfunction intel_context_use_semaphoresfunction intel_context_set_use_semaphoresfunction intel_context_clear_use_semaphoresfunction intel_context_is_bannedfunction intel_context_set_bannedfunction intel_context_is_schedulablefunction intel_context_is_exitingfunction intel_context_set_exitingfunction intel_context_force_single_submissionfunction intel_context_set_single_submissionfunction intel_context_nopreemptfunction intel_context_set_nopreemptfunction intel_context_clear_nopreemptfunction intel_context_has_own_statefunction intel_context_set_own_statefunction intel_context_has_own_statefunction intel_context_set_own_statefunction intel_context_clock
Annotated Snippet
while (!atomic_add_unless(&ce->pin_count, -1, 1)) {
if (atomic_cmpxchg(&ce->pin_count, 1, 2) == 1) {
ce->ops->sched_disable(ce);
break;
}
}
}
}
void intel_context_enter_engine(struct intel_context *ce);
void intel_context_exit_engine(struct intel_context *ce);
static inline void intel_context_enter(struct intel_context *ce)
{
lockdep_assert_held(&ce->timeline->mutex);
if (ce->active_count++)
return;
ce->ops->enter(ce);
ce->wakeref = intel_gt_pm_get(ce->vm->gt);
}
static inline void intel_context_mark_active(struct intel_context *ce)
{
lockdep_assert(lockdep_is_held(&ce->timeline->mutex) ||
test_bit(CONTEXT_IS_PARKING, &ce->flags));
++ce->active_count;
}
static inline void intel_context_exit(struct intel_context *ce)
{
lockdep_assert_held(&ce->timeline->mutex);
GEM_BUG_ON(!ce->active_count);
if (--ce->active_count)
return;
intel_gt_pm_put_async(ce->vm->gt, ce->wakeref);
ce->ops->exit(ce);
}
static inline struct intel_context *intel_context_get(struct intel_context *ce)
{
kref_get(&ce->ref);
return ce;
}
static inline void intel_context_put(struct intel_context *ce)
{
kref_put(&ce->ref, ce->ops->destroy);
}
static inline struct intel_timeline *__must_check
intel_context_timeline_lock(struct intel_context *ce)
__acquires(&ce->timeline->mutex)
{
struct intel_timeline *tl = ce->timeline;
int err;
if (intel_context_is_parent(ce))
err = mutex_lock_interruptible_nested(&tl->mutex, 0);
else if (intel_context_is_child(ce))
err = mutex_lock_interruptible_nested(&tl->mutex,
ce->parallel.child_index + 1);
else
err = mutex_lock_interruptible(&tl->mutex);
if (err)
return ERR_PTR(err);
return tl;
}
static inline void intel_context_timeline_unlock(struct intel_timeline *tl)
__releases(&tl->mutex)
{
mutex_unlock(&tl->mutex);
}
int intel_context_prepare_remote_request(struct intel_context *ce,
struct i915_request *rq);
struct i915_request *intel_context_create_request(struct intel_context *ce);
struct i915_request *intel_context_get_active_request(struct intel_context *ce);
static inline bool intel_context_is_barrier(const struct intel_context *ce)
{
return test_bit(CONTEXT_BARRIER_BIT, &ce->flags);
}
static inline void intel_context_close(struct intel_context *ce)
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/lockdep.h`, `linux/types.h`, `i915_active.h`, `i915_drv.h`, `intel_context_types.h`, `intel_engine_types.h`, `intel_gt_pm.h`.
- Detected declarations: `struct i915_gem_ww_ctx`, `function intel_context_is_child`, `function intel_context_is_parent`, `function intel_context_to_parent`, `function intel_context_is_parallel`, `function intel_context_is_pinned`, `function intel_context_is_pinned`, `function intel_context_cancel_request`, `function intel_context_unlock_pinned`, `function intel_context_pin_if_active`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.