virt_to_phys(9)
π virt_to_phys β a Kernel API Manual moment (section 9, bestie)
okay so real talk, this one is short but she is important. welcome to virt_to_phys(9) from the Kernel API Manual, let's get into it π
β¨ NAME β¨
virt_to_phys β map virtual addresses to physical β¨ literally her whole job
πΈ SYNOPSIS πΈ
phys_addr_t virt_to_phys (volatile void *address );
that's it. that's the whole vibe. one arg, one phys_addr_t coming back at you π«Ά
π¦ ARGUMENTS π¦
addressβ the address to remap π« (yes bestie,volatile void *, she said what she said)
π DESCRIPTION π
so like β the physical address you get back is the physical (CPU) mapping for the memory address you handed in. that's the whole tea β
π¨ vibe check, and it's a strict one: it is only valid to use this function on addresses that are directly mapped or allocated via kmalloc. anything else and you're on your own, no cap.
also, and this is the part nobody wants to hear: this function does not give bus mappings for DMA transfers. nope. not her lane. π
and honestly? in almost all conceivable cases a device driver should not be using this function. likeβ¦ almost all. she said what she said, periodt π
π SEE ALSO π
- Kernel file
./arch/x86/include/asm/io.h phys_to_virt(9)β the reverse girly πioremap(9)iosubmit_cmds512(9)
πΈ okay that's the page!! this lil icon lives at ./arch/x86/include/asm and the version/date situation is October 2026, page virt_to_phys(9) β mwah, go forth and map responsibly bestie πβ¨π§
π¦ 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