drivers/gpu/drm/imagination/pvr_vm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_vm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_vm.c- Extension
.c- Size
- 31747 bytes
- Lines
- 1195
- 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
pvr_vm.hpvr_device.hpvr_drv.hpvr_gem.hpvr_mmu.hpvr_rogue_fwif.hpvr_rogue_heap_config.hdrm/drm_exec.hdrm/drm_gem.hdrm/drm_gpuvm.hdrm/drm_print.hlinux/bug.hlinux/container_of.hlinux/err.hlinux/errno.hlinux/gfp_types.hlinux/kref.hlinux/mutex.hlinux/stddef.h
Detected Declarations
struct pvr_vm_contextstruct pvr_vm_gpuvastruct pvr_vm_bind_openum pvr_vm_bind_typefunction pvr_vm_get_page_table_root_addrfunction pvr_vm_get_dma_resvfunction pvr_vm_bind_op_execfunction pvr_vm_bind_op_finifunction pvr_vm_bind_op_map_initfunction pvr_vm_bind_op_unmap_initfunction pvr_vm_gpuva_mapfunction pvr_vm_gpuva_unmapfunction pvr_vm_gpuva_remapfunction pvr_device_addr_is_validfunction pvr_device_addr_and_size_are_validfunction pvr_gpuvm_freefunction fw_mem_context_initfunction pvr_vm_create_contextfunction pvr_vm_context_releasefunction pvr_vm_context_lookupfunction pvr_vm_context_putfunction pvr_destroy_vm_contexts_for_filefunction xa_for_eachfunction pvr_vm_lock_extrafunction mappingfunction pvr_vm_unmap_obj_lockedfunction pvr_vm_unmap_objfunction pvr_vm_unmapfunction pvr_vm_unmap_allfunction pvr_static_data_areas_getfunction pvr_heap_info_getfunction pvr_heap_contains_rangefunction pvr_find_heap_containingfunction pvr_vm_find_gem_objectfunction pvr_vm_get_fw_mem_context
Annotated Snippet
struct pvr_vm_context {
/**
* @pvr_dev: The PowerVR device to which this context is bound.
* This binding is immutable for the life of the context.
*/
struct pvr_device *pvr_dev;
/** @mmu_ctx: The context for binding to physical memory. */
struct pvr_mmu_context *mmu_ctx;
/** @gpuvm_mgr: GPUVM object associated with this context. */
struct drm_gpuvm gpuvm_mgr;
/** @lock: Global lock on this VM. */
struct mutex lock;
/**
* @fw_mem_ctx_obj: Firmware object representing firmware memory
* context.
*/
struct pvr_fw_object *fw_mem_ctx_obj;
/** @ref_count: Reference count of object. */
struct kref ref_count;
/**
* @dummy_gem: GEM object to enable VM reservation. All private BOs
* should use the @dummy_gem.resv and not their own _resv field.
*/
struct drm_gem_object dummy_gem;
};
static inline
struct pvr_vm_context *to_pvr_vm_context(struct drm_gpuvm *gpuvm)
{
return container_of(gpuvm, struct pvr_vm_context, gpuvm_mgr);
}
struct pvr_vm_context *pvr_vm_context_get(struct pvr_vm_context *vm_ctx)
{
if (vm_ctx)
kref_get(&vm_ctx->ref_count);
return vm_ctx;
}
/**
* pvr_vm_get_page_table_root_addr() - Get the DMA address of the root of the
* page table structure behind a VM context.
* @vm_ctx: Target VM context.
*/
dma_addr_t pvr_vm_get_page_table_root_addr(struct pvr_vm_context *vm_ctx)
{
return pvr_mmu_get_root_table_dma_addr(vm_ctx->mmu_ctx);
}
/**
* pvr_vm_get_dma_resv() - Expose the dma_resv owned by the VM context.
* @vm_ctx: Target VM context.
*
* This is used to allow private BOs to share a dma_resv for faster fence
* updates.
*
* Returns: The dma_resv pointer.
*/
struct dma_resv *pvr_vm_get_dma_resv(struct pvr_vm_context *vm_ctx)
{
return vm_ctx->dummy_gem.resv;
}
/**
* DOC: Memory mappings
*/
/**
* struct pvr_vm_gpuva - Wrapper type representing a single VM mapping.
*/
struct pvr_vm_gpuva {
/** @base: The wrapped drm_gpuva object. */
struct drm_gpuva base;
};
#define to_pvr_vm_gpuva(va) container_of_const(va, struct pvr_vm_gpuva, base)
enum pvr_vm_bind_type {
PVR_VM_BIND_TYPE_MAP,
PVR_VM_BIND_TYPE_UNMAP,
};
/**
Annotation
- Immediate include surface: `pvr_vm.h`, `pvr_device.h`, `pvr_drv.h`, `pvr_gem.h`, `pvr_mmu.h`, `pvr_rogue_fwif.h`, `pvr_rogue_heap_config.h`, `drm/drm_exec.h`.
- Detected declarations: `struct pvr_vm_context`, `struct pvr_vm_gpuva`, `struct pvr_vm_bind_op`, `enum pvr_vm_bind_type`, `function pvr_vm_get_page_table_root_addr`, `function pvr_vm_get_dma_resv`, `function pvr_vm_bind_op_exec`, `function pvr_vm_bind_op_fini`, `function pvr_vm_bind_op_map_init`, `function pvr_vm_bind_op_unmap_init`.
- 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.