map_device_va(9)
π map_device_va(9) β like, the whole Kernel API Manual moment β¨
okay so bestie, we're in the Kernel API Manual today and the star of the show is map_device_va(9). it maps memory. that's the vibe. let's get into it π«Ά
πΈ NAME πΈ
map_device_va β map the given memory. that's it. that's the whole pitch. iconic behavior honestly β¨
π SYNOPSIS π
int map_device_va (struct hl_ctx *ctx , struct hl_mem_in *args , u64
*device_addr );
look at her. three params, returns an int. no cap, she's efficient π
π¦ ARGUMENTS π¦
ctxβ pointer to the context structure. you know, the context. the main character of the struct world πargsβ the host parameters, and they come carrying either a handle or a host virtual address. pick your fighter π₯device_addrβ pointer to where the result goes: the device virtual address. she's an out-param, she gets filled in, she slays β¨
π DESCRIPTION π
so here's what this function does, and honestly? it's giving two-for-one special:
- if you hand her a physical device memory handle, she maps it to a device virtual block and returns the start address of that block. boom. mapped. π₯
- if instead you hand her a host virtual address and a size, she finds the related physical pages, maps a device virtual block to those pages, and returns the start address of that block. same energy, different path π§
either way you walk away with a start address. we love a consistent queen π
β SEE ALSO β
first up, the kernel file herself β she lives at ./drivers/accel/habanalabs/common/memory.c π
and then the whole friend group, in order, no one left out, we don't do that here:
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)unmap_device_va(9)hl_hw_block_mmap(9)export_dmabuf_from_addr(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)
thirty-two besties and a source file. a whole group chat, fr fr ππ
ngl bestie, that's the entire page. no bugs listed, no warnings, no exit statuses hiding in the margins β just clean mapping energy. go map something, ily π«Ά
and that's a wrap! this one came to you from ./drivers/accel/habanalabs/common, dated October 2026, and it's map_device_va(9) signing off π
β¨π
π¦ 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