drivers/gpu/drm/panthor/panthor_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panthor/panthor_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panthor/panthor_drv.c- Extension
.c- Size
- 51870 bytes
- Lines
- 1948
- 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.
- 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/list.hlinux/module.hlinux/of_platform.hlinux/pagemap.hlinux/platform_device.hlinux/pm_runtime.hlinux/sched/clock.hlinux/time64.hlinux/time_namespace.hdrm/drm_auth.hdrm/drm_debugfs.hdrm/drm_drv.hdrm/drm_exec.hdrm/drm_file.hdrm/drm_ioctl.hdrm/drm_print.hdrm/drm_syncobj.hdrm/drm_utils.hdrm/gpu_scheduler.hdrm/panthor_drm.hpanthor_devfreq.hpanthor_device.hpanthor_drv.hpanthor_fw.hpanthor_gem.hpanthor_gpu.hpanthor_heap.hpanthor_mmu.hpanthor_sched.h
Detected Declarations
struct panthor_sync_signalstruct panthor_job_ctxstruct panthor_submit_ctxfunction panthor_set_uobjfunction clear_userfunction panthor_get_uobj_arrayfunction sync_op_is_signalfunction sync_op_is_waitfunction panthor_check_sync_opfunction panthor_sync_signal_freefunction panthor_submit_ctx_add_sync_signalfunction panthor_submit_ctx_search_sync_signalfunction list_for_each_entryfunction panthor_submit_ctx_add_jobfunction panthor_submit_ctx_get_sync_signalfunction panthor_submit_ctx_update_job_sync_signal_fencesfunction panthor_submit_ctx_collect_job_signal_opsfunction panthor_submit_ctx_push_fencesfunction list_for_each_entryfunction panthor_submit_ctx_add_sync_deps_to_jobfunction panthor_submit_ctx_collect_jobs_signal_opsfunction panthor_submit_ctx_add_deps_and_arm_jobsfunction panthor_submit_ctx_push_jobsfunction panthor_submit_ctx_initfunction panthor_submit_ctx_cleanupfunction panthor_query_timestamp_infofunction group_priority_permitfunction panthor_query_group_priorities_infofunction panthor_ioctl_dev_queryfunction panthor_ioctl_vm_createfunction panthor_ioctl_vm_destroyfunction panthor_ioctl_bo_createfunction panthor_ioctl_bo_mmap_offsetfunction panthor_ioctl_group_submitfunction drm_exec_until_all_lockedfunction panthor_ioctl_group_destroyfunction panthor_ioctl_group_createfunction panthor_ioctl_group_get_statefunction panthor_ioctl_tiler_heap_createfunction panthor_ioctl_tiler_heap_destroyfunction panthor_ioctl_vm_bind_asyncfunction panthor_ioctl_vm_bind_syncfunction panthor_ioctl_vm_bindfunction panthor_ioctl_vm_get_statefunction panthor_ioctl_bo_set_labelfunction panthor_ioctl_set_user_mmio_offsetfunction panthor_ioctl_bo_syncfunction panthor_ioctl_bo_query_info
Annotated Snippet
static const struct file_operations panthor_drm_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.unlocked_ioctl = drm_ioctl,
.compat_ioctl = drm_compat_ioctl,
.poll = drm_poll,
.read = drm_read,
.llseek = noop_llseek,
.mmap = panthor_mmap,
.get_unmapped_area = drm_gem_get_unmapped_area,
.show_fdinfo = drm_show_fdinfo,
.fop_flags = FOP_UNSIGNED_OFFSET,
};
#ifdef CONFIG_DEBUG_FS
static void panthor_debugfs_init(struct drm_minor *minor)
{
panthor_mmu_debugfs_init(minor);
panthor_gem_debugfs_init(minor);
}
#endif
/*
* PanCSF driver version:
* - 1.0 - initial interface
* - 1.1 - adds DEV_QUERY_TIMESTAMP_INFO query
* - 1.2 - adds DEV_QUERY_GROUP_PRIORITIES_INFO query
* - adds PANTHOR_GROUP_PRIORITY_REALTIME priority
* - 1.3 - adds DRM_PANTHOR_GROUP_STATE_INNOCENT flag
* - 1.4 - adds DRM_IOCTL_PANTHOR_BO_SET_LABEL ioctl
* - 1.5 - adds DRM_PANTHOR_SET_USER_MMIO_OFFSET ioctl
* - 1.6 - enables GLB_COUNTER_EN
* - 1.7 - adds DRM_PANTHOR_BO_WB_MMAP flag
* - adds DRM_IOCTL_PANTHOR_BO_SYNC ioctl
* - adds DRM_IOCTL_PANTHOR_BO_QUERY_INFO ioctl
* - adds drm_panthor_gpu_info::selected_coherency
* - 1.8 - extends DEV_QUERY_TIMESTAMP_INFO with flags
*/
static const struct drm_driver panthor_drm_driver = {
.driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ |
DRIVER_SYNCOBJ_TIMELINE | DRIVER_GEM_GPUVA,
.open = panthor_open,
.postclose = panthor_postclose,
.show_fdinfo = panthor_show_fdinfo,
.ioctls = panthor_drm_driver_ioctls,
.num_ioctls = ARRAY_SIZE(panthor_drm_driver_ioctls),
.fops = &panthor_drm_driver_fops,
.name = "panthor",
.desc = "Panthor DRM driver",
.major = 1,
.minor = 8,
.gem_prime_import_sg_table = panthor_gem_prime_import_sg_table,
.gem_prime_import = panthor_gem_prime_import,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = panthor_debugfs_init,
#endif
};
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
bool panthor_transparent_hugepage = true;
module_param_named(transparent_hugepage, panthor_transparent_hugepage, bool, 0400);
MODULE_PARM_DESC(transparent_hugepage, "Use a dedicated tmpfs mount point with Transparent Hugepage enabled (true = default)");
#endif
static int panthor_probe(struct platform_device *pdev)
{
struct panthor_device *ptdev;
ptdev = devm_drm_dev_alloc(&pdev->dev, &panthor_drm_driver,
struct panthor_device, base);
if (IS_ERR(ptdev))
return -ENOMEM;
platform_set_drvdata(pdev, ptdev);
return panthor_device_init(ptdev);
}
static void panthor_remove(struct platform_device *pdev)
{
struct panthor_device *ptdev = platform_get_drvdata(pdev);
panthor_device_unplug(ptdev);
}
static ssize_t profiling_show(struct device *dev,
struct device_attribute *attr,
char *buf)
Annotation
- Immediate include surface: `asm/arch_timer.h`, `linux/list.h`, `linux/module.h`, `linux/of_platform.h`, `linux/pagemap.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/sched/clock.h`.
- Detected declarations: `struct panthor_sync_signal`, `struct panthor_job_ctx`, `struct panthor_submit_ctx`, `function panthor_set_uobj`, `function clear_user`, `function panthor_get_uobj_array`, `function sync_op_is_signal`, `function sync_op_is_wait`, `function panthor_check_sync_op`, `function panthor_sync_signal_free`.
- 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.
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.