drivers/gpu/drm/xe/xe_tlb_inval_job.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_tlb_inval_job.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_tlb_inval_job.c- Extension
.c- Size
- 9648 bytes
- Lines
- 320
- 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.
- 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_assert.hxe_dep_job_types.hxe_dep_scheduler.hxe_exec_queue.hxe_gt_printk.hxe_gt_types.hxe_page_reclaim.hxe_tlb_inval.hxe_tlb_inval_job.hxe_migrate.hxe_pm.hxe_vm.h
Detected Declarations
struct xe_tlb_inval_jobfunction xe_tlb_inval_job_freefunction xe_tlb_inval_job_createfunction xe_tlb_inval_job_add_page_reclaimfunction xe_tlb_inval_job_destroyfunction xe_tlb_inval_job_alloc_depfunction xe_tlb_inval_job_pushfunction xe_tlb_inval_job_getfunction xe_tlb_inval_job_put
Annotated Snippet
struct xe_tlb_inval_job {
/** @dep: base generic dependency Xe job */
struct xe_dep_job dep;
/** @tlb_inval: TLB invalidation client */
struct xe_tlb_inval *tlb_inval;
/** @q: exec queue issuing the invalidate */
struct xe_exec_queue *q;
/** @vm: VM which TLB invalidation is being issued for */
struct xe_vm *vm;
/** @prl: Embedded copy of page reclaim list */
struct xe_page_reclaim_list prl;
/** @refcount: ref count of this job */
struct kref refcount;
/**
* @fence: dma fence to indicate completion. 1 way relationship - job
* can safely reference fence, fence cannot safely reference job.
*/
struct dma_fence *fence;
/** @start: Start address to invalidate */
u64 start;
/** @end: End address to invalidate */
u64 end;
/** @type: GT type */
int type;
/** @fence_armed: Fence has been armed */
bool fence_armed;
};
static struct dma_fence *xe_tlb_inval_job_run(struct xe_dep_job *dep_job)
{
struct xe_tlb_inval_job *job =
container_of(dep_job, typeof(*job), dep);
struct xe_tlb_inval_fence *ifence =
container_of(job->fence, typeof(*ifence), base);
struct drm_suballoc *prl_sa = NULL;
if (xe_page_reclaim_list_valid(&job->prl)) {
prl_sa = xe_page_reclaim_create_prl_bo(job->tlb_inval, &job->prl, ifence);
if (IS_ERR(prl_sa))
prl_sa = NULL; /* Indicate fall back PPC flush with NULL */
}
xe_tlb_inval_range(job->tlb_inval, ifence, job->start,
job->end, job->vm->usm.asid, prl_sa);
return job->fence;
}
static void xe_tlb_inval_job_free(struct xe_dep_job *dep_job)
{
struct xe_tlb_inval_job *job =
container_of(dep_job, typeof(*job), dep);
/* Pairs with get in xe_tlb_inval_job_push */
xe_tlb_inval_job_put(job);
}
static const struct xe_dep_job_ops dep_job_ops = {
.run_job = xe_tlb_inval_job_run,
.free_job = xe_tlb_inval_job_free,
};
/**
* xe_tlb_inval_job_create() - TLB invalidation job create
* @q: exec queue issuing the invalidate
* @tlb_inval: TLB invalidation client
* @dep_scheduler: Dependency scheduler for job
* @vm: VM which TLB invalidation is being issued for
* @start: Start address to invalidate
* @end: End address to invalidate
* @type: GT type
*
* Create a TLB invalidation job and initialize internal fields. The caller is
* responsible for releasing the creation reference.
*
* Return: TLB invalidation job object on success, ERR_PTR failure
*/
struct xe_tlb_inval_job *
xe_tlb_inval_job_create(struct xe_exec_queue *q, struct xe_tlb_inval *tlb_inval,
struct xe_dep_scheduler *dep_scheduler,
struct xe_vm *vm, u64 start, u64 end, int type)
{
struct xe_tlb_inval_job *job;
struct drm_sched_entity *entity =
xe_dep_scheduler_entity(dep_scheduler);
struct xe_tlb_inval_fence *ifence;
int err;
xe_assert(vm->xe, type == XE_EXEC_QUEUE_TLB_INVAL_MEDIA_GT ||
type == XE_EXEC_QUEUE_TLB_INVAL_PRIMARY_GT);
Annotation
- Immediate include surface: `xe_assert.h`, `xe_dep_job_types.h`, `xe_dep_scheduler.h`, `xe_exec_queue.h`, `xe_gt_printk.h`, `xe_gt_types.h`, `xe_page_reclaim.h`, `xe_tlb_inval.h`.
- Detected declarations: `struct xe_tlb_inval_job`, `function xe_tlb_inval_job_free`, `function xe_tlb_inval_job_create`, `function xe_tlb_inval_job_add_page_reclaim`, `function xe_tlb_inval_job_destroy`, `function xe_tlb_inval_job_alloc_dep`, `function xe_tlb_inval_job_push`, `function xe_tlb_inval_job_get`, `function xe_tlb_inval_job_put`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.