@@ -193,6 +193,7 @@ static inline bool folio_is_device_coherent(const struct folio *folio)
void zone_device_page_init(struct page *page);
void *memremap_pages(struct dev_pagemap *pgmap, int nid);
void memunmap_pages(struct dev_pagemap *pgmap);
+void pgmap_parent_resource(struct dev_pagemap *pgmap, struct resource *res);
void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap);
void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap);
struct dev_pagemap *get_dev_pagemap(unsigned long pfn,
@@ -390,6 +390,13 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
}
EXPORT_SYMBOL_GPL(memremap_pages);
+void pgmap_parent_resource(struct dev_pagemap *pgmap, struct resource *res)
+{
+ if (pgmap && res)
+ pgmap->altmap.parent = res;
+}
+EXPORT_SYMBOL_GPL(pgmap_parent_resource);
+
/**
* devm_memremap_pages - remap and provide memmap backing for the given resource
* @dev: hosting device for @res
It's a helper to set the parent resource for the altmap of a given pgmap CC: Andrew Morton <akpm@linux-foundation.org> CC: Dan Williams <dan.j.williams@intel.com> CC: Baoquan He <bhe@redhat.com> CC: linux-mm@kvack.org Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- include/linux/memremap.h | 1 + mm/memremap.c | 7 +++++++ 2 files changed, 8 insertions(+)