mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
drm/pagemap: Add helper to access backing devmem allocation
drm_pagemap_zdd is private, so add drm_pagemap_page_to_devmem() to let callers get the drm_pagemap_devmem backing a device-private/coherent page. Add a NULL stub for !CONFIG_ZONE_DEVICE. Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20261001033602.3166274-7-himal.prasad.ghimiray@intel.com Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
123c1f0430
commit
2069eeb76a
|
|
@ -1433,6 +1433,21 @@ struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(drm_pagemap_page_to_dpagemap);
|
||||
|
||||
/**
|
||||
* drm_pagemap_page_to_devmem() - Return the devmem allocation backing a page
|
||||
* @page: The struct page.
|
||||
*
|
||||
* Return: The &drm_pagemap_devmem backing @page. Undefined if @page was not
|
||||
* populated from a &drm_pagemap.
|
||||
*/
|
||||
struct drm_pagemap_devmem *drm_pagemap_page_to_devmem(struct page *page)
|
||||
{
|
||||
struct drm_pagemap_zdd *zdd = drm_pagemap_page_zone_device_data(page);
|
||||
|
||||
return zdd->devmem_allocation;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_pagemap_page_to_devmem);
|
||||
|
||||
/**
|
||||
* drm_pagemap_populate_mm() - Populate a virtual range with device memory pages
|
||||
* @dpagemap: Pointer to the drm_pagemap managing the device memory
|
||||
|
|
|
|||
|
|
@ -257,6 +257,8 @@ struct drm_pagemap *drm_pagemap_create(struct drm_device *drm,
|
|||
|
||||
struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page);
|
||||
|
||||
struct drm_pagemap_devmem *drm_pagemap_page_to_devmem(struct page *page);
|
||||
|
||||
void drm_pagemap_put(struct drm_pagemap *dpagemap);
|
||||
|
||||
#else
|
||||
|
|
@ -266,6 +268,11 @@ static inline struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct drm_pagemap_devmem *drm_pagemap_page_to_devmem(struct page *page)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void drm_pagemap_put(struct drm_pagemap *dpagemap)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user