arm64/mm: enable vmem_altmap support for vmemmap mappings

Device memory ranges when getting hot added into ZONE_DEVICE, might
require their vmemmap mapping's backing memory to be allocated from their
own range instead of consuming system memory.  This prevents large system
memory usage for potentially large device memory ranges.  Device driver
communicates this request via vmem_altmap structure.  Architecture needs
to take this request into account while creating and tearing down vemmmap

This enables vmem_altmap support in vmemmap_populate() and vmemmap_free()
which includes vmemmap_populate_basepages() used for ARM64_16K_PAGES and
ARM64_64K_PAGES configs.

Signed-off-by: Anshuman Khandual <>
Signed-off-by: Andrew Morton <>
Tested-by: Jia He <>
Reviewed-by: Catalin Marinas <>
Cc: Will Deacon <>
Cc: Mark Rutland <>
Cc: Steve Capper <>
Cc: David Hildenbrand <>
Cc: Yu Zhao <>
Cc: Hsin-Yi Wang <>
Cc: Thomas Gleixner <>
Cc: Andy Lutomirski <>
Cc: Benjamin Herrenschmidt <>
Cc: Borislav Petkov <>
Cc: Dan Williams <>
Cc: Dave Hansen <>
Cc: Fenghua Yu <>
Cc: "H. Peter Anvin" <>
Cc: Ingo Molnar <>
Cc: Jonathan Corbet <>
Cc: "Kirill A. Shutemov" <>
Cc: "Matthew Wilcox (Oracle)" <>
Cc: Michael Ellerman <>
Cc: Michal Hocko <>
Cc: Mike Rapoport <>
Cc: Palmer Dabbelt <>
Cc: Paul Mackerras <>
Cc: Paul Walmsley <>
Cc: Pavel Tatashin <>
Cc: Peter Zijlstra <>
Cc: Robin Murphy <>
Cc: Tony Luck <>
Signed-off-by: Linus Torvalds <>
1 file changed