drm_pagemap_...system_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… drm_pagemap_migrate_map_system_pages β€” a Kernel API Manual moment ✨

okay so this is a page straight out of the Kernel API Manual, and bestie, it's giving "GPU memory migration but make it fashion". sit down, hydrate, let's go 🫢


✨ NAME ✨

drm_pagemap_migrate_map_system_pages β€” maps system pages or device coherent migration pages so the GPU can do its SVM migration thing. literally the matchmaker between your pages and the DMA world πŸ’–


🌸 SYNOPSIS 🌸

int drm_pagemap_migrate_map_system_pages (struct device *dev , struct
drm_pagemap_addr *pagemap_addr , unsigned long *migrate_pfn , unsigned
long npages , enum dma_data_direction dir , struct
drm_pagemap_iova_state *state );

no cap, that's the whole signature. copy it exactly, don't freestyle it πŸ™ˆ


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device that's doing the migrating. main character energy, obviously πŸ‘‘
  • pagemap_addr β€” an array where the DMA info for the mapped pages gets stashed.
  • migrate_pfn β€” array of page frame numbers of the system pages or peer pages you wanna map. the guest list, if you will πŸ’…
  • npages β€” how many system or device coherent pages we're mapping. count 'em.
  • dir β€” direction of the data transfer (like, e.g., DMA_BIDIRECTIONAL). which way the vibes flow 🌈
  • state β€” the DMA IOVA state for the mapping. it's holding the state, it's a state holder.

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it do? This function maps pages of memory for migration usage in GPU SVM. It literally iterates over each page frame number you handed it in migrate_pfn, maps the corresponding page, and stores that DMA address in the provided dma_addr array. one by one, page by page, slay by slay ✨


πŸ’œ RETURN πŸ’œ

  • 0 on success πŸŽ‰
  • a negative error code on failure 😭

🌟 SEE ALSO 🌟

the whole friend group, gathered:

Kernel file ./drivers/gpu/drm/drm_pagemap.c, Overview(9), Migration(9), struct drm_pagemap_zdd(9), drm_pagemap_zdd_alloc(9), drm_pagemap_zdd_get(9), drm_pagemap_zdd_destroy(9), drm_pagemap_zdd_put(9), drm_pagemap_migration_unlock_put_folio(9), drm_pagemap_migration_unlock_put_pages(9), drm_pagemap_get_devmem_page(9), drm_pagemap_migrate_map_device_private_pages(9), struct drm_pagemap_iova_state(9), drm_pagemap_migrate_populate_src_pages(9), drm_pagemap_migrate_unmap_pages(9), struct migrate_range_loc(9), drm_pagemap_cpages(9), drm_pagemap_migrate_to_devmem(9), drm_pagemap_migrate_populate_ram_pfn(9), struct drm_pagemap_dev_hold(9), drm_pagemap_reinit(9), drm_pagemap_init(9), drm_pagemap_put(9), drm_pagemap_page_get_flags(9), drm_pagemap_page_set_flags(9), drm_pagemap_retire_migrated_pages(9), drm_pagemap_skip_retired_pages(9), drm_pagemap_evict_to_ram(9), __drm_pagemap_migrate_to_ram(9), drm_pagemap_folio_free(9), drm_pagemap_migrate_to_ram(9), drm_pagemap_pagemap_ops_get(9), drm_pagemap_devmem_init(9), drm_pagemap_page_to_dpagemap(9), drm_pagemap_populate_mm(9)


πŸ’€ friendly reminder that the description says dma_addr array while the argument is called pagemap_addr β€” that's how it's written, I'm not fixing it, that's the source material bestie, iykyk.

and that's the page!! sign-off time: this one lives in ./drivers/gpu/drm and it's dated October 2026 ⭐ take care of her, she's iconic πŸ’–πŸ§šπŸŒΈ

πŸ“¦ where this page comes from