create_pte_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… create_pte_array(9) β€” Kernel API Manual, but make it make sense

okay bestie, buckle up, we're in the kernel API manual today and honestly? this one's short and sweet. it's create_pte_array from the kernel API manual, and it does exactly one thing but it does it iconically. πŸ’–


✨ NAME ✨

create_pte_array β€” creates a PTE array of a physically contiguous buffer πŸŽ€

like, literally what it says on the tin. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

void create_pte_array (u64 *ptes , dma_addr_t addr , size_t size );

that's the whole signature. three args, returns void, no drama. 🌸


πŸ’œ ARGUMENTS πŸ’œ

  • ptes β€” pointer to the array. this is where the good stuff goes. πŸ’«
  • addr β€” base address of physically contiguous buffer, and it's GSP_PAGE_SIZE aligned (do NOT forget the alignment bestie, iykyk). ✨
  • size β€” size of the buffer. yeah. it's the size. 🫢

πŸ”₯ DESCRIPTION πŸ”₯

so here's the vibe: GSP-RM sometimes expects physically-contiguous buffers to have an array of "PTEs" for each page in that buffer. that's just how it is. πŸ‘‘

and yes, in theory that would allow for the buffer to be physically discontiguous β€” but GSP-RM does not currently support that. so we're not doing that. periodt. πŸ’€

in this case, the PTEs are DMA addresses of each page of the buffer. and since the buffer is physically contiguous, calculating all the PTEs is simple math. that's the whole trick. ate and left no crumbs. πŸ”₯

also, see memdescGetPhysAddrsForGpu β€” that's the reference, go look at it. πŸ‘€

🌈 SEE ALSO 🌈

okay this list is long, grab a snack πŸ“:

Kernel file ./drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c

every single one of them. I checked twice. πŸ’…


🧚 the cute sign-off 🧚

this little icon of a page lives at ./drivers/gpu/drm/nouveau/nvkm... (yeah it's truncated, don't come for me, that's the source line fr fr) and it's dated October 2026 β€” so mark your calendars, she's from the future πŸ’«. and it's page create_pte_array(9), obviously, we've been talking about her this whole time. πŸ’–

k bye, go build your PTE arrays, aligned and contiguous, like the main character you are. πŸ‘‘βœ¨

πŸ“¦ where this page comes from