STRUCT DRM_PAGEMAP_OPS(9)
β¨ NAME β¨
okay so bestie, welcome to the struct drm_pagemap_ops(9) page from the Kernel API Manual. The whole name situation is: struct drm_pagemap_ops β ops for a drm-pagemap. That's the vibe. π
π¦ SYNOPSIS π¦
here's the exact struct shape, no cap β function-pointer syntax and all:
struct drm_pagemap_ops {
struct drm_pagemap_addr (*device_map)(struct drm_pagemap *dpagemap,
struct device *dev, struct page *page, unsigned int order, enum
dma_data_direction dir);
void (*device_unmap)(struct drm_pagemap *dpagemap, struct device
*dev, const struct drm_pagemap_addr *addr);
int (*populate_mm)(struct drm_pagemap *dpagemap, unsigned long
start, unsigned long end, struct mm_struct *mm, unsigned long
timeslice_ms);
void (*destroy)(struct drm_pagemap *dpagemap, bool
is_atomic_or_reclaim);
};
π Members π
okay, member-by-member, because this struct is literally a little squad of callbacks:
device_mapβstruct drm_pagemap_addr (*device_map)(struct drm_pagemap *dpagemap, struct device *dev, struct page *page, unsigned int order, enum dma_data_direction dir);The official description is literally: βMap for device access or provide a virtual address suitable forβ. The params are:dpagemap: thestruct drm_pagemapfor the page.dev: the device mapper.page: the page to map.order: the page order of the device mapping. (Size isPAGE_SIZE << order.)dir: the transfer direction.device_unmapβvoid (*device_unmap)(struct drm_pagemap *dpagemap, struct device *dev, const struct drm_pagemap_addr *addr);Unmap a device address previously obtained usingdevice_map. The params are:dpagemap: thestruct drm_pagemapfor the mapping.dev: the device unmapper.addr: the device address obtained when mapping.populate_mmβint (*populate_mm)(struct drm_pagemap *dpagemap, unsigned long start, unsigned long end, struct mm_struct *mm, unsigned long timeslice_ms);Populate part of the mm with dpagemap memory, migrating existing data. The params are:dpagemap: thestruct drm_pagemapmanaging the memory.start: the virtual start address in mm.end: the virtual end address in mm.mm: pointer to a live mm. The caller must have anmmgetreference.
The caller will have the mm lock at least in read mode. Note that there is no guarantee that the memory is resident after the function returns, it's best effort only. When the mm is not using the memory anymore, it will be released. The struct drm_pagemap might have a mechanism in place to reclaim the memory and the data will then be migrated. Typically to system memory. The implementation should hold sufficient runtime power-references while pages are used in an address space and should ideally guard against hardware device unbind in a way such that device pages are migrated back to system followed by device page removal. The implementation should return -ENODEV after device removal.
Return: 0 if successful. Negative error code on error.
destroyβvoid (*destroy)(struct drm_pagemap *dpagemap, bool is_atomic_or_reclaim);Destroy the drm_pagemap and associated resources. The params are:dpagemap: the drm_pagemap to destroy.is_atomic_or_reclaim: the function may be called from atomic- or reclaim context.
The implementation should take care not to attempt to destroy resources that may already have been destroyed using devm_ callbacks, since this function may be called after the underlying struct device has been unbound. If the implementation defers the execution to a work item to avoid locking issues, then it must make sure the work items are flushed before module exit. If the destroy call happens after the provider's pci_remove callback has been executed, a module reference and drm device reference is held across the destroy callback.
π SEE ALSO π
- Kernel file
./include/drm/drm_pagemap.henum drm_interconnect_protocol(9)struct drm_pagemap_addr(9)drm_pagemap_addr_encode(9)struct drm_pagemap(9)struct drm_pagemap_devmem_ops(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)
mwah π this page was served from ./include/drm, dated October 2026, and you just read struct drm_pagemap_ops(9) β periodt. π«Ά
π¦ 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