STRUCT DRM_PAGEMAP_DEVMEM_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct drm_pagemap_devmem_ops(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual, section 9 β€” this is the page all about struct drm_pagemap_devmem_ops, and no cap, it's giving "the GPU driver's to-do list for device memory." πŸŽ€


✨ NAME ✨

struct drm_pagemap_devmem_ops β€” the operations structure for GPU SVM device memory. literally the vibe check for how a GPU driver handles its device memory πŸ’–


🌸 SYNOPSIS 🌸

struct drm_pagemap_devmem_ops {
    void (*devmem_release)(struct drm_pagemap_devmem
*devmem_allocation);
    int (*populate_devmem_pfn)(struct drm_pagemap_devmem
*devmem_allocation, unsigned long npages, unsigned long *pfn);
    int (*copy_to_devmem)(struct page **pages, struct drm_pagemap_addr
*pagemap_addr, unsigned long npages, struct dma_fence
*pre_migrate_fence);
    int (*copy_to_ram)(struct page **pages, struct drm_pagemap_addr
*pagemap_addr, unsigned long npages, struct dma_fence
*pre_migrate_fence);
 };

πŸ¦‹ MEMBERS πŸ¦‹

🫢 devmem_release

Release device memory allocation (optional) β€” and devmem_allocation is, you guessed it, the device memory allocation πŸ’œ

So what does it do? It releases the device memory allocation and drops a reference to the device memory allocation. two-for-one, iconic ✨

πŸŽ€ populate_devmem_pfn

Populate device memory PFN (required for migration) 🩷

  • devmem_allocation β€” device memory allocation
  • npages β€” Number of pages to populate
  • pfn β€” Array of page frame numbers to populate

It populates the device memory page frame numbers (PFN), fr fr.

Return: 0 on success, a negative error code on failure. periodt. πŸ’…

🌈 copy_to_devmem

Copy to device memory (required for migration) πŸ”₯

  • pages β€” Pointer to array of device memory pages (destination)
  • pagemap_addr β€” Pointer to array of DMA information (source)
  • npages β€” Number of pages to copy
  • pre_migrate_fence β€” dma-fence to wait for before migration start. May be NULL.

Copies pages to device memory. ok and here's the little detail that matters: if the order of a pagemap_addr entry is greater than 0, the entry is populated but subsequent entries within the range of that order are not populated. iykyk 🧚

Return: 0 on success, a negative error code on failure. πŸ’–

⭐ copy_to_ram

Copy to system RAM (required for migration) 🌸

  • pages β€” Pointer to array of device memory pages (source)
  • pagemap_addr β€” Pointer to array of DMA information (destination)
  • npages β€” Number of pages to copy
  • pre_migrate_fence β€” dma-fence to wait for before migration start. May be NULL.

Copies pages to system RAM. and same rule as before, bestie: if the order of a pagemap_addr entry is greater than 0, the entry is populated but subsequent entries within the range of that order are not populated. πŸ‘‘

Return: 0 on success, a negative error code on failure. πŸ“

πŸ‘‘ DESCRIPTION πŸ‘‘

This structure defines the operations for GPU Shared Virtual Memory (SVM) device memory. 🧠✨ These operations are provided by the GPU driver so it can manage device memory allocations and do the whole migration dance between device memory and system RAM. main character energy, honestly πŸ’…


πŸ” SEE ALSO πŸ”

Kernel file ./include/drm/drm_pagemap.h enum drm_interconnect_protocol(9), struct drm_pagemap_addr(9), drm_pagemap_addr_encode(9), struct drm_pagemap_ops(9), struct drm_pagemap(9), drm_pagemap_get(9), drm_pagemap_get_unless_zero(9), struct drm_pagemap_devmem(9), struct drm_pagemap_migrate_details(9), drm_pagemap_page_zone_device_data(9)


and that's the page, bestie!! 🫢 this one lives over in ./include/drm, dated October 2026 β€” catch you in the next struct drm_...p_devmem_ops(9), mwah πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from