map_phys_pg_pack(9)
π map_phys_pg_pack β kernel API manual, section 9 π
okay so bestie, buckle up, because we're diving into the Kernel API Manual (section 9, the big-kid section) and this one is literally about gluing virtual memory to physical memory. no cap. let's go β¨
πΈ NAME πΈ
map_phys_pg_pack β maps the physical page pack.. π¦
(yes the double period is canon, i don't make the rules, i just report them π )
β¨ SYNOPSIS β¨
int map_phys_pg_pack (struct hl_ctx *ctx , u64 vaddr , struct
hl_vm_phys_pg_pack *phys_pg_pack );
like, it returns an int, it takes three things, and it's giving very much "i do one job and i do it well" energy π
π«Ά ARGUMENTS π«Ά
ctxβ pointer to the context structure. the main character of the operation, honestly πvaddrβ start address of the virtual area to map from. this is where the virtual vibes begin βphys_pg_packβ the pack of physical pages to map to. the actual real ones. the land, not the map π
π₯ DESCRIPTION π₯
so here's the tea, this function does the following:
- Maps each chunk of virtual memory to matching physical chunk. one-to-one, no funny business, slay π
- Stores number of successful mappings in the given argument. it's keeping receipts, periodt π§
- Returns
0on success, error code otherwise. zero means we ate, anything else means something's up π
ngl, that third bullet is the whole mood: 0 = iconic, non-zero = go read the error code bestie π
π SEE ALSO π
the kernel file lives right here, fr fr:
./drivers/accel/habanalabs/common/memory.c
and it's friends with literally everyone, i'm obsessed:
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)unmap_phys_pg_pack(9)map_device_va(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)
that's a whole friend group and honestly? goals π
<div align="center">β π β</div>
and that's the page!! sourced straight from ./drivers/accel/habanalabs/common, stamped October 2026, section 9 of the Kernel API Manual. mwah π go map some pages bestie, you got this π
π¦ 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