hmm_dma_map_pfn(9)
π hmm_dma_map_pfn π
ok so this is a page from the Kernel API Manual (section 9, the kernel-API girlies π«Ά) and yeah we're talking about hmm_dma_map_pfn β the function that maps a physical HMM page to a DMA address. no cap, that's the whole vibe of it.
β¨ NAME β¨
hmm_dma_map_pfn β Map a physical HMM page to DMA address π₯
πΈ SYNOPSIS πΈ
dma_addr_t hmm_dma_map_pfn (struct device *dev , struct hmm_dma_map *map
, size_t idx , struct pci_p2pdma_map_state *p2pdma_state );
like, that's the signature bestie, copy it exactly, don't be weird about it π
π ARGUMENTS π
devβ the Device you're mapping the page for. main character energy, obviously πmapβ the HMM map. yeah. that one. πΈidxβ Index into the PFN and dma address arrays. it's giving "which one, bestie" π¦p2pdma_stateβ PCI P2P state. that's it, that's the whole description π
π¦ DESCRIPTION π¦
okay so dma_alloc_iova allocates IOVA based on the size specified by their use in iova->size. noted. β¨
Call this function after IOVA allocation to link whole page to get the DMA address. slay, that's the order of operations, don't skip steps π«Ά
heads up bestie, this part matters: note that the very first call to this function will have offset set to0in the IOVA space allocated fromdma_alloc_iova. literally zero. the fresh start era π
For subsequent calls to this function on same iova, offset needs to be advanced by the caller with the size of previous page that was linked + DMA address returned for the previous page that was linked by this function. so, like, you (the caller) are doing that math, not the function. no cap, it's on you π€π₯
π SEE ALSO π
Kernel file ./mm/hmm.c β and the whole friend group:
hmm_range_fault(9)hmm_range_fault_unlocked_timeout(9)hmm_dma_map_alloc(9)hmm_dma_map_free(9)hmm_dma_unmap_pfn(9)
iykyk, go read those next π§π
and that's the page!! sign-off time: this one lives in ./mm, and the date on it is October 2026, and the page itself is hmm_dma_map_pfn(9). periodt. bye bestie, go map some pages π
ππ
π¦ 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