STRUCT PANTHOR_VM_OP_CTX(9)
π¦ NAME
struct panthor_vm_op_ctx β the VM operation context π
okay so bestie, this is the little struct that holds everything a VM operation needs before it even starts running. Think of it as the packed lunch your op brings along so it doesn't have to stop at the drive-thru mid-flight π
β¨ SYNOPSIS
struct panthor_vm_op_ctx {
struct {
u32 count;
u32 ptr;
void **pages;
} rsvd_page_tables;
struct panthor_vma *preallocated_vmas[3];
u32 flags;
struct {
u64 addr;
u64 range;
} va;
struct {
struct drm_gpuvm_bo *vm_bo;
u64 bo_offset;
struct panthor_gem_object *bo;
} map;
};
π Members
rsvd_page_tablesβ the pages that have been reserved for the MMU page table update, bestie π«Άrsvd_page_tables.countβ literally just the number of pages reserved π’rsvd_page_tables.ptrβ points to the first unused page in the pages table πrsvd_page_tables.pagesβ the actual array of pages that get used for an MMU page table update β¨
After an VM operation, there might be free pages left in this array. They should be returned to thept_cacheas part of theop_ctxcleanup. don't forget, okay?? that's the whole point of the cleanup π
preallocated_vmasβ pre-allocated VMAs, there specifically to handle the remap case π
Partial unmap requests, or map requests that overlap existing mappings, will trigger a remap call, and that remap needs to register up to three panthor_vma objects β one for the new mapping, and two for the previous and next mappings. yeah. three. iconic behavior honestly π
flagsβ a combination ofdrm_panthor_vm_bind_op_flagsπ©vaβ the virtual range that the VM operation is targeting π―va.addrβ start address πva.rangeβ range size π
mapβ the fields that are specific to a map operation πΊοΈmap.vm_boβ the buffer object to map πmap.bo_offsetβ offset in the buffer object πmap.boβ the BO being mapped πΈ
π Description
So here's the vibe: VM operations can potentially take place in a dma-signaling path π³ which means we need to make sure that everything that might require resource allocation is pre-allocated upfront. That is literally what this operation context is for. no allocation surprises mid-signal, periodt π«
We also collect the resources that have been freed, so we can release them asynchronously and let the VM_BIND scheduler go ahead and process the next VM_BIND request. very main character of the scheduler honestly π₯
π SEE ALSO
Kernel file ./drivers/gpu/drm/panthor/panthor_mmu.c and also, in no particular order, all of these besties:
struct panthor_as_slot(9)struct panthor_mmu(9)struct panthor_vm_pool(9)struct panthor_vma(9)struct panthor_vm(9)struct panthor_vm_bind_job(9)alloc_pt(9)free_pt(9)panthor_vm_has_unhandled_faults(9)panthor_vm_is_unusable(9)panthor_vm_active(9)panthor_vm_idle(9)panthor_vm_as(9)panthor_vm_alloc_va(9)panthor_vm_free_va(9)panthor_vm_get_bo_for_va(9)panthor_vm_pool_create_vm(9)panthor_vm_pool_destroy_vm(9)panthor_vm_pool_get_vm(9)panthor_vm_pool_destroy(9)panthor_vm_pool_create(9)panthor_mmu_suspend(9)panthor_mmu_resume(9)panthor_mmu_pre_reset(9)panthor_mmu_post_reset(9)panthor_vm_put(9)panthor_vm_get(9)panthor_vm_get_heap_pool(9)panthor_vm_heaps_sizes(9)panthor_vm_resv(9)panthor_vm_bind_job_put(9)panthor_vm_create(9)panthor_vm_bind_job_create(9)panthor_vm_bind_job_prepare_resvs(9)panthor_vm_bind_job_update_resvs(9)panthor_vm_bind_exec_sync_op(9)panthor_vm_map_bo_range(9)panthor_vm_unmap_range(9)panthor_vm_prepare_mapped_bos_resvs(9)panthor_mmu_unplug(9)panthor_mmu_init(9)panthor_mmu_debugfs_init(9)panthor_mmu_pt_cache_init(9)panthor_mmu_pt_cache_fini(9)
okay that's the whole page, go read the source at ./drivers/gpu/drm/panthor π
this one's dated October 2026 and it's struct panthor_vm_op_ctx(9) out of the Kernel API Manual β mwah, ily, go forth and map responsibly π§π
π¦ 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