STRUCT DRM_PAGEMAP_DEVMEM_OPS(9)
π 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 allocationnpagesβ Number of pages to populatepfnβ 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 copypre_migrate_fenceβdma-fenceto wait for before migration start. May beNULL.
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 copypre_migrate_fenceβdma-fenceto wait for before migration start. May beNULL.
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
- 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