drm_gpuva_insert(9)
π drm_gpuva_insert(9) β from the Kernel API Manual (yes bestie, the kernel has a manual and it's iconic)
okay so real talk, this is a page straight out of the Kernel API Manual, and it's about exactly one thing: shoving a &drm_gpuva into a drm_gpuvm. tiny function, big main character energy. let's get into it π«Ά
β¨ NAME β¨
drm_gpuva_insert β literally just "insert a &drm_gpuva". that's the whole name. no notes. π
πΈ SYNOPSIS πΈ
int drm_gpuva_insert (struct drm_gpuvm *gpuvm , struct drm_gpuva *va );
two pointers in, one int out. she's simple, she's elegant, she ate. β¨
π ARGUMENTS π
gpuvmβ thedrm_gpuvmthat our littledrm_gpuvais getting inserted into. this is the house πvaβ thedrm_gpuvaitself, the one doing the moving-in. this is the new roommate π¦
π DESCRIPTION π
so what she actually does: she inserts a drm_gpuva β one that already has a given address and range β into a drm_gpuvm. address? check. range? check. into the gpuvm? slayed. π
and here's the part you need to know: it is safe to use this function while you're iterating the GPU VA space using the safe versions of the iteration helpers, specifically drm_gpuvm_for_each_va_safe and drm_gpuvm_for_each_va_range_safe. like, you can be mid-loop and insert and it's not gonna blow up on you. no cap. π₯
bestie please internalize that: safe iterators = you're allowed to call this. that's the vibe check that matters here. π§
β RETURN β
0on success π- a negative error code on failure π
π SEE ALSO π
the whole extended friend group, fr fr β go read these too:
- Kernel file
./drivers/gpu/drm/drm_gpuvm.c Overview(9)Split and Merge(9)Madvise Logic - Splitting and Traversal(9)Locking(9)Examples(9)get_next_vm_bo_from_list(9)for_each_vm_bo_in_list(9)restore_vm_bo_list(9)drm_gpuvm_bo_is_zombie(9)drm_gpuvm_bo_list_add(9)drm_gpuvm_bo_list_del_init(9)drm_gpuvm_bo_list_del(9)drm_gpuvm_range_valid(9)drm_gpuvm_resv_object_alloc(9)drm_gpuvm_init(9)drm_gpuvm_put(9)drm_gpuvm_prepare_vm(9)drm_gpuvm_prepare_objects(9)drm_gpuvm_prepare_range(9)drm_gpuvm_exec_lock(9)drm_gpuvm_exec_lock_array(9)drm_gpuvm_exec_lock_range(9)drm_gpuvm_validate(9)drm_gpuvm_resv_add_fence(9)drm_gpuvm_bo_create(9)drm_gpuvm_bo_put(9)drm_gpuvm_bo_put_deferred(9)drm_gpuvm_bo_deferred_cleanup(9)drm_gpuvm_bo_find(9)drm_gpuvm_bo_obtain_locked(9)drm_gpuvm_bo_obtain_prealloc(9)drm_gpuvm_bo_extobj_add(9)drm_gpuvm_bo_evict(9)drm_gpuva_remove(9)drm_gpuva_link(9)drm_gpuva_unlink(9)drm_gpuva_unlink_defer(9)drm_gpuva_find_first(9)drm_gpuva_find(9)drm_gpuvm_interval_empty(9)drm_gpuva_map(9)drm_gpuva_remap(9)drm_gpuva_unmap(9)drm_gpuvm_sm_map(9)drm_gpuvm_sm_unmap(9)drm_gpuvm_sm_map_exec_lock(9)drm_gpuvm_sm_unmap_exec_lock(9)drm_gpuvm_sm_map_ops_create(9)drm_gpuvm_madvise_ops_create(9)drm_gpuvm_sm_unmap_ops_create(9)drm_gpuvm_prefetch_ops_create(9)drm_gpuvm_bo_unmap_ops_create(9)drm_gpuva_ops_free(9)
okay that's the whole page, you're officially educated π this little beauty lives in ./drivers/gpu/drm, dated October 2026 β so go forth, insert your gpuva, and remember: 0 means success, negative means go touch grass and read your error codes. mwah πβ¨
π¦ 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