sparsemem.h 1.3 KB

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