1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_POWERPC_SPARSEMEM_H 3 #define _ASM_POWERPC_SPARSEMEM_H 1 4 #ifdef __KERNEL__ 5 6 #ifdef CONFIG_SPARSEMEM 7 /* 8 * SECTION_SIZE_BITS 2^N: how big each section will be 9 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space 10 */ 11 #define SECTION_SIZE_BITS 24 12 /* 13 * If we store section details in page->flags we can't increase the MAX_PHYSMEM_BITS 14 * if we increase SECTIONS_WIDTH we will not store node details in page->flags and 15 * page_to_nid does a page->section->node lookup 16 * Hence only increase for VMEMMAP. 17 */ 18 #ifdef CONFIG_SPARSEMEM_VMEMMAP 19 #define MAX_PHYSMEM_BITS 47 20 #else 21 #define MAX_PHYSMEM_BITS 46 22 #endif 23 24 #endif /* CONFIG_SPARSEMEM */ 25 26 #ifdef CONFIG_MEMORY_HOTPLUG 27 extern int create_section_mapping(unsigned long start, unsigned long end, int nid); 28 extern int remove_section_mapping(unsigned long start, unsigned long end); 29 30 #ifdef CONFIG_PPC_BOOK3S_64 31 extern void resize_hpt_for_hotplug(unsigned long new_mem_size); 32 #else 33 static inline void resize_hpt_for_hotplug(unsigned long new_mem_size) { } 34 #endif 35 36 #ifdef CONFIG_NUMA 37 extern int hot_add_scn_to_nid(unsigned long scn_addr); 38 #else 39 static inline int hot_add_scn_to_nid(unsigned long scn_addr) 40 { 41 return 0; 42 } 43 #endif /* CONFIG_NUMA */ 44 #endif /* CONFIG_MEMORY_HOTPLUG */ 45 46 #endif /* __KERNEL__ */ 47 #endif /* _ASM_POWERPC_SPARSEMEM_H */ 48