virt_to_phys(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 🌈


🌸 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