sg_phys(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« sg_phys(9) β€” the kernel API manual, but make it make sense

okay bestie, so the manual page name is sg_phys and it lives in section 9 of the Kernel API Manual β€” that's the Linux kernel docs, and yes we're absolutely going to get into it πŸŽ€


✨ NAME ✨

sg_phys β€” returns the physical address of an sg entry. that's it, that's the whole vibe πŸ¦‹


🌸 SYNOPSIS 🌸

dma_addr_t sg_phys (struct scatterlist *sg );

like, you hand it a struct scatterlist * and it hands you back a dma_addr_t. no cap, that's the whole transaction πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • sg β€” the SG entry. literally just the scatterlist entry you're curious about ✨

πŸ’– DESCRIPTION πŸ’–

so what this does is: it calls page_to_phys on the page inside this sg entry, and then it adds the sg offset on top. that's the whole recipe, periodt πŸ”₯

⚠️ okay but listen β€” the caller must know that it's legal to call page_to_phys on the sg page. like, that's on you, not on this function. pls don't come for sg_phys if you rolled up with an illegal page 😭

🫢 SEE ALSO 🫢

kernel file ./include/linux/scatterlist.h β€” and also, the entire friend group:


and that's the page, bestie 🧚 this one's from the ./include/linux directory, dated October 2026, and it's filed under sg_phys(9) β€” go forth and compute physical addresses responsibly πŸ’œπŸŒˆβ­

πŸ“¦ where this page comes from