STRUCT DRM_GPUVM_OPS(9)
β¨ struct drm_gpuvm_ops(9) β¨
okay so bestie, we're in the Kernel API Manual today and we're talking about struct drm_gpuvm_ops β the callbacks for split/merge steps. yes it's giving "glue code" but it's iconic glue code, trust π
πΈ NAME πΈ
struct drm_gpuvm_ops β callbacks for split/merge steps. that's it, that's the whole vibe check π«Ά
π¦ SYNOPSIS π¦
struct drm_gpuvm_ops {
void (*vm_free)(struct drm_gpuvm *gpuvm);
struct drm_gpuva_op *(*op_alloc)(void);
void (*op_free)(struct drm_gpuva_op *op);
struct drm_gpuvm_bo *(*vm_bo_alloc)(void);
void (*vm_bo_free)(struct drm_gpuvm_bo *vm_bo);
int (*vm_bo_validate)(struct drm_gpuvm_bo *vm_bo, struct drm_exec
*exec);
int (*sm_step_map)(struct drm_gpuva_op *op, void *priv);
int (*sm_step_remap)(struct drm_gpuva_op *op, void *priv);
int (*sm_step_unmap)(struct drm_gpuva_op *op, void *priv);
};
like, look at her. nine function pointers. main character energy fr fr π
π Members π
vm_freeβ called when the last reference of astruct drm_gpuvmis dropped π«
This callback is mandatory. no skipping, bestie, this one is NOT optional π€
op_allocβ called when the drm_gpuvm allocates astruct drm_gpuva_opπ
some drivers may want to embed struct drm_gpuva_op into driver specific structures. by implementing this callback, drivers can allocate memory accordingly. lowkey a cute little customization hook β¨
This callback is optional.
op_freeβ called when the drm_gpuvm frees astruct drm_gpuva_opπ§
some drivers may want to embed struct drm_gpuva_op into driver specific structures. by implementing this callback, drivers can free the previously allocated memory accordingly. the matching-set energy we love to see π
This callback is optional.
vm_bo_allocβ called when the drm_gpuvm allocates astruct drm_gpuvm_boπ
some drivers may want to embed struct drm_gpuvm_bo into driver specific structures. by implementing this callback, drivers can allocate memory accordingly. yes it's the same speech as op_alloc, no cap π«Ά
This callback is optional.
vm_bo_freeβ called when the drm_gpuvm frees astruct drm_gpuvm_boπ
some drivers may want to embed struct drm_gpuvm_bo into driver specific structures. by implementing this callback, drivers can free the previously allocated memory accordingly. alloc/free duo, they're literally a matching set π
This callback is optional.
vm_bo_validateβ called fromdrm_gpuvm_validateπ₯
drivers receive this callback for every evicted drm_gem_object being mapped in the corresponding drm_gpuvm. iykyk, that's the whole point.
typically, drivers would call their driver specific variant of ttm_bo_validate from within this callback. that's the move π―
sm_step_mapβ called fromdrm_gpuvm_sm_mapto finally insert the mapping once all previous steps were completed β
the priv pointer matches the one the driver passed to drm_gpuvm_sm_map or drm_gpuvm_sm_unmap, respectively.
Can be NULL if drm_gpuvm_sm_map is used.
sm_step_remapβ called fromdrm_gpuvm_sm_mapanddrm_gpuvm_sm_unmapto split up an existent mapping π
this callback is called when existent mapping needs to be split up. this is the case when either a newly requested mapping overlaps or is enclosed by an existent mapping, or a partial unmap of an existent mapping is requested. messy? a little. necessary? absolutely π«Ά
the priv pointer matches the one the driver passed to drm_gpuvm_sm_map or drm_gpuvm_sm_unmap, respectively.
Can be NULL if neither drm_gpuvm_sm_map nor drm_gpuvm_sm_unmap is used.
sm_step_unmapβ called fromdrm_gpuvm_sm_mapanddrm_gpuvm_sm_unmapto unmap an existing mapping π
this callback is called when existing mapping needs to be unmapped. this is the case when either a newly requested mapping encloses an existing mapping, or an unmap of an existing mapping is requested. bye bestie, we hardly knew ye π
the priv pointer matches the one the driver passed to drm_gpuvm_sm_map or drm_gpuvm_sm_unmap, respectively.
Can be NULL if neither drm_gpuvm_sm_map nor drm_gpuvm_sm_unmap is used.
π Description π
this structure defines the callbacks used by drm_gpuvm_sm_map and drm_gpuvm_sm_unmap to provide the split/merge steps for map and unmap operations to drivers. so it's like the middleman between the core and your driver, and honestly? she's booked and busy π
π SEE ALSO π
kernel file ./include/drm/drm_gpuvm.h plus the whole friend group: enum drm_gpuva_flags(9), struct drm_gpuva(9), drm_gpuva_invalidate(9), drm_gpuva_invalidated(9), enum drm_gpuvm_flags(9), struct drm_gpuvm(9), drm_gpuvm_get(9), drm_gpuvm_resv_protected(9), drm_gpuvm_immediate_mode(9), drm_gpuvm_resv(9), drm_gpuvm_resv_obj(9), drm_gpuvm_is_extobj(9), drm_gpuvm_for_each_va_range(9), drm_gpuvm_for_each_va_range_safe(9), drm_gpuvm_for_each_va(9), drm_gpuvm_for_each_va_safe(9), struct drm_gpuvm_exec(9), drm_gpuvm_exec_unlock(9), drm_gpuvm_exec_resv_add_fence(9), drm_gpuvm_exec_validate(9), struct drm_gpuvm_bo(9), drm_gpuvm_bo_get(9), drm_gpuvm_bo_gem_evict(9), drm_gpuvm_bo_for_each_va(9), drm_gpuvm_bo_for_each_va_safe(9), enum drm_gpuva_op_type(9), struct drm_gpuva_op_map(9), struct drm_gpuva_op_unmap(9), struct drm_gpuva_op_remap(9), struct drm_gpuva_op_prefetch(9), struct drm_gpuva_op(9), struct drm_gpuva_ops(9), drm_gpuva_for_each_op(9), drm_gpuva_for_each_op_safe(9), drm_gpuva_for_each_op_from_reverse(9), drm_gpuva_for_each_op_reverse(9), drm_gpuva_first_op(9), drm_gpuva_last_op(9), drm_gpuva_prev_op(9), drm_gpuva_next_op(9), struct drm_gpuvm_map_req(9), drm_gpuva_op_remap_to_unmap_range(9). that's a LOT of reading, hydrate first π
and that's the whole page bestie!! π this one came from the source tree at ./include/drm and it's dated October 2026 β go off, you literally know gpuvm callbacks now πβ¨π
π¦ 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