drivers/gpu/drm/imagination/pvr_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_drv.c- Extension
.c- Size
- 42160 bytes
- Lines
- 1539
- 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.
- 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
pvr_context.hpvr_debugfs.hpvr_device.hpvr_drv.hpvr_free_list.hpvr_gem.hpvr_hwrt.hpvr_job.hpvr_mmu.hpvr_power.hpvr_rogue_defs.hpvr_rogue_fwif_client.hpvr_rogue_fwif_shared.hpvr_trace.hpvr_vm.huapi/drm/pvr_drm.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_gem.hdrm/drm_ioctl.hlinux/err.hlinux/export.hlinux/fs.hlinux/kernel.hlinux/list.hlinux/mod_devicetable.hlinux/module.hlinux/moduleparam.hlinux/of_device.hlinux/of_platform.hlinux/platform_device.h
Detected Declarations
function pvr_ioctl_create_bofunction pvr_ioctl_get_bo_mmap_offsetfunction pvr_fw_version_packedfunction rogue_get_common_store_partition_space_sizefunction rogue_get_common_store_alloc_region_sizefunction rogue_get_num_phantomsfunction rogue_get_max_coeffsfunction rogue_get_cdm_max_local_mem_size_regsfunction pvr_dev_query_gpu_info_getfunction pvr_dev_query_runtime_info_getfunction pvr_dev_query_quirks_getfunction pvr_dev_query_enhancements_getfunction pvr_ioctl_dev_queryfunction pvr_ioctl_create_contextfunction pvr_ioctl_destroy_contextfunction pvr_ioctl_create_free_listfunction pvr_ioctl_destroy_free_listfunction pvr_ioctl_create_hwrt_datasetfunction pvr_ioctl_destroy_hwrt_datasetfunction pvr_ioctl_create_vm_contextfunction pvr_ioctl_destroy_vm_contextfunction pvr_ioctl_vm_mapfunction pvr_ioctl_vm_unmapfunction pvr_ioctl_submit_jobfunction pvr_get_uobjfunction pvr_set_uobjfunction pvr_get_uobj_arrayfunction pvr_set_uobj_arrayfunction pvr_drm_driver_openfunction pvr_drm_driver_postclosefunction pvr_probefunction pvr_remove
Annotated Snippet
if (pvr_device_has_uapi_quirk(pvr_dev, umd_quirks_musthave[i])) {
out[out_count++] = umd_quirks_musthave[i];
out_musthave_count++;
}
}
for (int i = 0; i < ARRAY_SIZE(umd_quirks); i++) {
if (pvr_device_has_uapi_quirk(pvr_dev, umd_quirks[i]))
out[out_count++] = umd_quirks[i];
}
if (!query.quirks)
goto copy_out;
if (query.count < out_count)
return -E2BIG;
if (copy_to_user(u64_to_user_ptr(query.quirks), out,
out_count * sizeof(u32))) {
return -EFAULT;
}
query.musthave_count = out_musthave_count;
copy_out:
query.count = out_count;
err = PVR_UOBJ_SET(args->pointer, args->size, query);
if (err < 0)
return err;
args->size = sizeof(query);
return 0;
}
/**
* pvr_dev_query_enhancements_get() - Unpack array of enhancements at the
* address given in a struct drm_pvr_dev_query_enhancements, or gets the amount
* of space required for it.
* @pvr_dev: Device pointer.
* @args: [IN] Device query arguments containing a pointer to a userspace
* struct drm_pvr_dev_query_enhancements.
*
* If the query object pointer is NULL, the size field is updated with the
* expected size of the query object.
* If the userspace pointer in the query object is NULL, or the count is
* short, no data is copied.
* The count field will be updated to that copied, or if either pointer is
* NULL, that which would have been copied.
* The size field in the query object will be updated to the size copied.
*
* Returns:
* * 0 on success, or if size/count is requested using a NULL pointer, or
* * -%EINVAL if args contained non-zero reserved fields, or
* * -%E2BIG if the indicated length of the allocation is less than is
* required to contain the copied data, or
* * -%EFAULT if local memory could not be copied to userspace.
*/
static int
pvr_dev_query_enhancements_get(struct pvr_device *pvr_dev,
struct drm_pvr_ioctl_dev_query_args *args)
{
/*
* @FIXME - hardcoding of numbers here is intended as an
* intermediate step so the UAPI can be fixed, but requires a
* a refactor in the future to store them in a more appropriate
* location
*/
const u32 umd_enhancements[] = {
35421,
42064,
};
struct drm_pvr_dev_query_enhancements query;
u32 out[ARRAY_SIZE(umd_enhancements)];
size_t out_idx = 0;
int err;
if (!args->pointer) {
args->size = sizeof(struct drm_pvr_dev_query_enhancements);
return 0;
}
err = PVR_UOBJ_GET(query, args->size, args->pointer);
if (err < 0)
return err;
if (query._padding_a)
return -EINVAL;
if (query._padding_c)
return -EINVAL;
for (int i = 0; i < ARRAY_SIZE(umd_enhancements); i++) {
Annotation
- Immediate include surface: `pvr_context.h`, `pvr_debugfs.h`, `pvr_device.h`, `pvr_drv.h`, `pvr_free_list.h`, `pvr_gem.h`, `pvr_hwrt.h`, `pvr_job.h`.
- Detected declarations: `function pvr_ioctl_create_bo`, `function pvr_ioctl_get_bo_mmap_offset`, `function pvr_fw_version_packed`, `function rogue_get_common_store_partition_space_size`, `function rogue_get_common_store_alloc_region_size`, `function rogue_get_num_phantoms`, `function rogue_get_max_coeffs`, `function rogue_get_cdm_max_local_mem_size_regs`, `function pvr_dev_query_gpu_info_get`, `function pvr_dev_query_runtime_info_get`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.