pvr_vm_map(9)
π pvr_vm_map(9) β from the Kernel API Manual, bestie β¨
Okay so picture this: it's a kernel API manual page, it's called pvr_vm_map, and it's literally about mapping a chunk of physical memory into a chunk of device-virtual memory. That's the whole vibe. Let's get into it π«Ά
β¨ SYNOPSIS β¨
int pvr_vm_map (struct pvr_vm_context *vm_ctx , struct pvr_gem_object
*pvr_obj , u64 pvr_obj_offset , u64 device_addr , u64 size );
That's the signature, bestie β copy it exactly, no cap. Five args, returns an int, and it's giving "I do one thing and I do it well" π
π ARGUMENTS π
vm_ctxβ the target VM context. Like, the address space we're doing this whole thing in. Your main character β¨pvr_objβ the target PowerVR memory object. The thing being mapped, the source material, the icon πpvr_obj_offsetβ offset intopvr_objto map from. Where in the object we start scooping from πdevice_addrβ the virtual device address at the start of the requested mapping. This one matters more than it looks, wait for the DESCRIPTION πsizeβ size of the requested mapping. How much we're mapping. That's it, that's the whole description, and honestly? Respect π
πΈ DESCRIPTION πΈ
So here's the thing that makes this function kind of iconic: no handle is returned to represent the mapping. Like, none. Zero. The return value is just an int status, not a little token you can hold onto π
Instead, callers should remember device_addr and use that as a handle. So you map it, you note the address, and you keep it in your notes app forever. That's the deal π
Fr fr: if you lose track of device_addr, you have no handle. It's giving "you had one job." Don't be that person π
π₯ RETURN π₯
0on success β slay, the mapping happened π-EINVALifdevice_addris not a valid page-aligned device-virtual address; the region specified bypvr_obj_offsetandsizedoes not fall entirely withinpvr_obj, or any part of the specified region ofpvr_objis not device-virtual page-aligned. Three separate ways to fail, all bundled into one very overworked error code π- Any error encountered while performing internal operations required to destroy the mapping (returned from
pvr_vm_gpuva_maporpvr_vm_gpuva_remap). Yes, we're talking about destroying the mapping in the return value section. That's just how it is. Not me questioning it, I'm just the messenger π«‘
π¦ SEE ALSO π¦
The whole friend group, in order, exactly as listed β no gatekeeping:
- Kernel file
./drivers/gpu/drm/imagination/pvr_vm.c Memory context(9)struct pvr_vm_context(9)pvr_vm_get_page_table_root_addr(9)pvr_vm_get_dma_resv(9)Memory mappings(9)struct pvr_vm_gpuva(9)struct pvr_vm_bind_op(9)pvr_vm_bind_op_exec(9)pvr_vm_gpuva_map(9)pvr_vm_gpuva_unmap(9)pvr_vm_gpuva_remap(9)pvr_device_addr_is_valid(9)pvr_device_addr_and_size_are_valid(9)pvr_vm_create_context(9)pvr_vm_context_release(9)pvr_vm_context_lookup(9)pvr_vm_context_put(9)pvr_destroy_vm_contexts_for_file(9)pvr_vm_unmap_obj_locked(9)pvr_vm_unmap_obj(9)pvr_vm_unmap(9)pvr_vm_unmap_all(9)pvr_heap_contains_range(9)pvr_find_heap_containing(9)pvr_vm_find_gem_object(9)pvr_vm_get_fw_mem_context(9)
π one last thing π
This page lives in ./drivers/gpu/drm/imagination, and it was stamped October 2026 β so mark your calendar, mwah π Go map some memory, remember your device_addr, and stay page-aligned. Periodt. π§β
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms