drivers/gpu/drm/panfrost/panfrost_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panfrost/panfrost_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panfrost/panfrost_drv.c- Extension
.c- Size
- 32961 bytes
- Lines
- 1201
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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
asm/arch_timer.hlinux/module.hlinux/of.hlinux/pagemap.hlinux/platform_device.hlinux/pm_runtime.hdrm/panfrost_drm.hdrm/drm_debugfs.hdrm/drm_drv.hdrm/drm_ioctl.hdrm/drm_print.hdrm/drm_syncobj.hdrm/drm_utils.hpanfrost_device.hpanfrost_gem.hpanfrost_mmu.hpanfrost_job.hpanfrost_gpu.hpanfrost_perfcnt.h
Detected Declarations
function panfrost_ioctl_query_timestampfunction panfrost_ioctl_get_paramfunction panfrost_ioctl_create_bofunction panfrost_lookup_bosfunction panfrost_copy_in_syncfunction panfrost_ioctl_submitfunction panfrost_ioctl_wait_bofunction panfrost_ioctl_mmap_bofunction panfrost_ioctl_get_bo_offsetfunction panfrost_ioctl_madvisefunction panfrost_ioctl_set_label_bofunction panfrost_ioctl_jm_ctx_createfunction panfrost_ioctl_jm_ctx_destroyfunction panfrost_ioctl_sync_bofunction panfrost_ioctl_query_bo_infofunction panfrost_unstable_ioctl_checkfunction panfrost_openfunction panfrost_postclosefunction panfrost_gpu_show_fdinfofunction panfrost_show_fdinfofunction panthor_gems_showfunction show_panfrost_jm_ctxfunction show_file_jm_ctxsfunction panthor_gems_debugfs_initfunction show_each_filefunction list_for_each_entryfunction panfrost_sched_debugfs_initfunction panfrost_debugfs_initfunction panfrost_probefunction panfrost_removefunction profiling_showfunction profiling_store
Annotated Snippet
static const struct file_operations panfrost_drm_driver_fops = {
.owner = THIS_MODULE,
DRM_GEM_FOPS,
.show_fdinfo = drm_show_fdinfo,
};
#ifdef CONFIG_DEBUG_FS
static int panthor_gems_show(struct seq_file *m, void *data)
{
struct drm_info_node *node = m->private;
struct panfrost_device *pfdev = to_panfrost_device(node->minor->dev);
panfrost_gem_debugfs_print_bos(pfdev, m);
return 0;
}
static void show_panfrost_jm_ctx(struct panfrost_jm_ctx *jm_ctx, u32 handle,
struct seq_file *m)
{
struct drm_device *ddev = ((struct drm_info_node *)m->private)->minor->dev;
const char *prio = "UNKNOWN";
static const char * const prios[] = {
[DRM_SCHED_PRIORITY_HIGH] = "HIGH",
[DRM_SCHED_PRIORITY_NORMAL] = "NORMAL",
[DRM_SCHED_PRIORITY_LOW] = "LOW",
};
if (jm_ctx->slot_entity[0].priority !=
jm_ctx->slot_entity[1].priority)
drm_warn(ddev, "Slot priorities should be the same in a single context");
if (jm_ctx->slot_entity[0].priority < ARRAY_SIZE(prios))
prio = prios[jm_ctx->slot_entity[0].priority];
seq_printf(m, " JM context %u: priority %s\n", handle, prio);
}
static int show_file_jm_ctxs(struct panfrost_file_priv *pfile,
struct seq_file *m)
{
struct panfrost_jm_ctx *jm_ctx;
unsigned long i;
xa_lock(&pfile->jm_ctxs);
xa_for_each(&pfile->jm_ctxs, i, jm_ctx) {
jm_ctx = panfrost_jm_ctx_get(jm_ctx);
xa_unlock(&pfile->jm_ctxs);
show_panfrost_jm_ctx(jm_ctx, i, m);
panfrost_jm_ctx_put(jm_ctx);
xa_lock(&pfile->jm_ctxs);
}
xa_unlock(&pfile->jm_ctxs);
return 0;
}
static struct drm_info_list panthor_debugfs_list[] = {
{"gems",
panthor_gems_show, 0, NULL},
};
static int panthor_gems_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(panthor_debugfs_list,
ARRAY_SIZE(panthor_debugfs_list),
minor->debugfs_root, minor);
return 0;
}
static int show_each_file(struct seq_file *m, void *arg)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *ddev = node->minor->dev;
int (*show)(struct panfrost_file_priv *, struct seq_file *) =
node->info_ent->data;
struct drm_file *file;
int ret;
ret = mutex_lock_interruptible(&ddev->filelist_mutex);
if (ret)
return ret;
list_for_each_entry(file, &ddev->filelist, lhead) {
struct task_struct *task;
struct panfrost_file_priv *pfile = file->driver_priv;
struct pid *pid;
Annotation
- Immediate include surface: `asm/arch_timer.h`, `linux/module.h`, `linux/of.h`, `linux/pagemap.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `drm/panfrost_drm.h`, `drm/drm_debugfs.h`.
- Detected declarations: `function panfrost_ioctl_query_timestamp`, `function panfrost_ioctl_get_param`, `function panfrost_ioctl_create_bo`, `function panfrost_lookup_bos`, `function panfrost_copy_in_sync`, `function panfrost_ioctl_submit`, `function panfrost_ioctl_wait_bo`, `function panfrost_ioctl_mmap_bo`, `function panfrost_ioctl_get_bo_offset`, `function panfrost_ioctl_madvise`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.