drivers/gpu/drm/lima/lima_sched.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/lima/lima_sched.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/lima/lima_sched.c- Extension
.c- Size
- 13904 bytes
- Lines
- 561
- 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/hardirq.hlinux/iosys-map.hlinux/kthread.hlinux/slab.hlinux/vmalloc.hlinux/pm_runtime.hdrm/drm_print.hlima_devfreq.hlima_drv.hlima_sched.hlima_vm.hlima_mmu.hlima_l2_cache.hlima_gem.hlima_trace.h
Detected Declarations
struct lima_fencefunction lima_sched_slab_initfunction lima_sched_slab_finifunction lima_fence_release_rcufunction lima_fence_releasefunction lima_sched_task_initfunction lima_sched_task_finifunction lima_sched_context_initfunction lima_sched_context_finifunction lima_pm_busyfunction lima_pm_idlefunction lima_sched_build_error_task_listfunction lima_sched_timedout_jobfunction lima_sched_free_jobfunction lima_sched_recover_workfunction lima_sched_pipe_initfunction lima_sched_pipe_finifunction lima_sched_pipe_task_done
Annotated Snippet
struct lima_fence {
struct dma_fence base;
struct lima_sched_pipe *pipe;
};
static struct kmem_cache *lima_fence_slab;
static int lima_fence_slab_refcnt;
int lima_sched_slab_init(void)
{
if (!lima_fence_slab) {
lima_fence_slab = kmem_cache_create(
"lima_fence", sizeof(struct lima_fence), 0,
SLAB_HWCACHE_ALIGN, NULL);
if (!lima_fence_slab)
return -ENOMEM;
}
lima_fence_slab_refcnt++;
return 0;
}
void lima_sched_slab_fini(void)
{
if (!--lima_fence_slab_refcnt) {
kmem_cache_destroy(lima_fence_slab);
lima_fence_slab = NULL;
}
}
static inline struct lima_fence *to_lima_fence(struct dma_fence *fence)
{
return container_of(fence, struct lima_fence, base);
}
static const char *lima_fence_get_driver_name(struct dma_fence *fence)
{
return "lima";
}
static const char *lima_fence_get_timeline_name(struct dma_fence *fence)
{
struct lima_fence *f = to_lima_fence(fence);
return f->pipe->base.name;
}
static void lima_fence_release_rcu(struct rcu_head *rcu)
{
struct dma_fence *f = container_of(rcu, struct dma_fence, rcu);
struct lima_fence *fence = to_lima_fence(f);
kmem_cache_free(lima_fence_slab, fence);
}
static void lima_fence_release(struct dma_fence *fence)
{
struct lima_fence *f = to_lima_fence(fence);
call_rcu(&f->base.rcu, lima_fence_release_rcu);
}
static const struct dma_fence_ops lima_fence_ops = {
.get_driver_name = lima_fence_get_driver_name,
.get_timeline_name = lima_fence_get_timeline_name,
.release = lima_fence_release,
};
static struct lima_fence *lima_fence_create(struct lima_sched_pipe *pipe)
{
struct lima_fence *fence;
fence = kmem_cache_zalloc(lima_fence_slab, GFP_KERNEL);
if (!fence)
return NULL;
fence->pipe = pipe;
dma_fence_init(&fence->base, &lima_fence_ops, &pipe->fence_lock,
pipe->fence_context, ++pipe->fence_seqno);
return fence;
}
static inline struct lima_sched_task *to_lima_task(struct drm_sched_job *job)
{
return container_of(job, struct lima_sched_task, base);
}
static inline struct lima_sched_pipe *to_lima_pipe(struct drm_gpu_scheduler *sched)
{
Annotation
- Immediate include surface: `linux/hardirq.h`, `linux/iosys-map.h`, `linux/kthread.h`, `linux/slab.h`, `linux/vmalloc.h`, `linux/pm_runtime.h`, `drm/drm_print.h`, `lima_devfreq.h`.
- Detected declarations: `struct lima_fence`, `function lima_sched_slab_init`, `function lima_sched_slab_fini`, `function lima_fence_release_rcu`, `function lima_fence_release`, `function lima_sched_task_init`, `function lima_sched_task_fini`, `function lima_sched_context_init`, `function lima_sched_context_fini`, `function lima_pm_busy`.
- 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.