hl_mmu_hr_pte_phys_to_virt(9)
π hl_mmu_hr_pte_phys_to_virt β the kernel API manual, bestie edition
okay so you're in the hl_mmu_hr_pte_phys_to_virt(9) page, which lives in the Kernel API Manual section, and honestly? it's a little one but it serves. it does exactly one thing and it does it cute: it takes a physical PTE address and hands you back the virtual one. main character behavior fr fr π
β¨ NAME β¨
hl_mmu_hr_pte_phys_to_virt β translate a PTE physical address to a virtual address π«
no cap, that's the whole plot.
πΈ SYNOPSIS πΈ
u64 hl_mmu_hr_pte_phys_to_virt (struct hl_ctx *ctx , struct pgt_info
*pgt , u64 phys_pte_addr , u32 hop_table_size );
four arguments, one u64 back. simple. iconic. π«Ά
π¦ ARGUMENTS π¦
ctxβ pointer to the context structure. yeah, the context struct, you know the one πpgtβ thepgt_infofor the HOP that's hosting the PTE. this is your map, bestie πΊοΈphys_pte_addrβ the physical address of the PTE. the before picture πΈhop_table_sizeβ the HOP table size. yes it wants it, don't ask questions, just pass it β¨
π₯ DESCRIPTION π₯
the job is literally: return the PTE virtual address. that's it. that's the function. ate and left no crumbs π
here's the vibe: the function uses the pgt_info to get the HOP base virtual address, then it gets the PTE's virtual address by adding the PTE offset on top. so like β base addr + offset = your answer. math but make it fashion π§
lowkey the cleanest little translation pipeline you've ever seen. no drama, no side quests, just offset math π
π SEE ALSO π
go touch some grass in the kernel source, specifically this file:
./drivers/accel/habanalabs/common/mmu/mmu.c
and while you're in there, the whole friend group:
hl_mmu_get_funcs(9)hl_mmu_init(9)hl_mmu_fini(9)hl_mmu_ctx_init(9)hl_mmu_scramble_addr(9)hl_mmu_descramble_addr(9)hl_mmu_get_hop_pte_phys_addr(9)hl_mmu_hr_pool_destroy(9)hl_mmu_hr_init(9)hl_mmu_hr_fini(9)hl_mmu_hr_free_hop_remove_pgt(9)hl_mmu_hr_write_pte(9)hl_mmu_hr_clear_pte(9)hl_mmu_hr_put_pte(9)hl_mmu_hr_get_pte(9)hl_mmu_hr_get_next_hop_pgt_info(9)hl_mmu_hr_alloc_hop(9)hl_mmu_hr_get_alloc_next_hop(9)hl_mmu_hr_get_tlb_info(9)
like, that's the whole group chat right there, iykyk π
okay and finally β the fine print, but make it cute: this page came from ./drivers/accel/habanalabs/com... and it's dated October 2026, and yeah the header/footer both say hl_mmu_hr_pte_phys_to_virt(9) because it's that girl, appearing twice π
that's the whole page bestie, go translate some addresses, slay, 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