export_dmabuf_from_addr(9)
β¨ export_dmabuf_from_addr(9) β kernel API manual π
okay so bestie, this is a page from the Kernel API Manual and it's literally about handing a chunk of device memory to the rest of the world as a dma-buf. no cap, it's a glow-up for your memory allocation π
πΈ NAME πΈ
export_dmabuf_from_addr β export a dma-buf object for the given memory address and size.
π¦ SYNOPSIS π¦
int export_dmabuf_from_addr (struct hl_ctx *ctx , u64 addr , u64 size ,
u64 offset , int flags , int *dmabuf_fd );
π ARGUMENTS π
ctxβ pointer to the context structure. like, the whole vibe-holder for this operation.addrβ the device address. this is where the memory lives, iykyk.sizeβ how much device memory you're exporting. the bigger the slay, the bigger the size π«Άoffsetβ the offset into the buffer from which to start exporting. yes, you can start partway in, main character energy.flagsβ DMA-BUF file/FD flags. the lil settings that ride along.dmabuf_fdβ pointer to the result FD that represents the dma-buf object. this is where the shiny new file descriptor lands β¨
π DESCRIPTION π
Create and export a dma-buf object for an existing memory allocation inside the device memory, and return a FD which is associated with the dma-buf object.
that's it, that's the whole flex. existing allocation in device memory β boom, dma-buf object β boom, an FD that represents it. not me being obsessed with a file descriptor π
π₯ RETURN π₯
0 on success, non-zero for failure.
(tbh 0 is the slay outcome. anything else and it's giving error π)
β SEE ALSO β
the kernel file lives here, bestie:
Kernel file ./drivers/accel/habanalabs/common/memory.c
and here's the whole friend group, fr fr:
dma_map_host_va(9), dma_unmap_host_va(9), dram_pg_pool_do_release(9), free_phys_pg_pack(9), free_device_memory(9), clear_va_list_locked(9), print_va_list_locked(9), merge_va_blocks_locked(9), add_va_block_locked(9), add_va_block(9), is_hint_crossing_range(9), get_va_block(9), hl_get_va_range_type(9), hl_unreserve_va_block(9), init_phys_pg_pack_from_userptr(9), map_phys_pg_pack(9), unmap_phys_pg_pack(9), map_device_va(9), unmap_device_va(9), hl_hw_block_mmap(9), allocate_timestamps_buffers(9), hl_pin_host_memory(9), hl_userptr_delete_list(9), hl_userptr_is_pinned(9), va_range_init(9), va_range_fini(9), vm_ctx_init_with_ranges(9), hl_vm_ctx_fini(9), hl_vm_init(9), hl_vm_fini(9), hl_hw_block_mem_init(9), hl_hw_block_mem_fini(9)
okay that's the whole page! π this one's from the source at ./drivers/accel/habanalabs/common, dated October 2026, and yes you can absolutely cite it in your group chat. 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