numa.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_NUMA_H
  3. #define _LINUX_NUMA_H
  4. #include <linux/types.h>
  5. #ifdef CONFIG_NODES_SHIFT
  6. #define NODES_SHIFT CONFIG_NODES_SHIFT
  7. #else
  8. #define NODES_SHIFT 0
  9. #endif
  10. #define MAX_NUMNODES (1 << NODES_SHIFT)
  11. #define NUMA_NO_NODE (-1)
  12. #define NUMA_NO_MEMBLK (-1)
  13. /* optionally keep NUMA memory info available post init */
  14. #ifdef CONFIG_NUMA_KEEP_MEMINFO
  15. #define __initdata_or_meminfo
  16. #else
  17. #define __initdata_or_meminfo __initdata
  18. #endif
  19. #ifdef CONFIG_NUMA
  20. #include <linux/printk.h>
  21. #include <asm/sparsemem.h>
  22. /* Generic implementation available */
  23. int numa_map_to_online_node(int node);
  24. #ifndef memory_add_physaddr_to_nid
  25. static inline int memory_add_physaddr_to_nid(u64 start)
  26. {
  27. pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n",
  28. start);
  29. return 0;
  30. }
  31. #endif
  32. #ifndef phys_to_target_node
  33. static inline int phys_to_target_node(u64 start)
  34. {
  35. pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
  36. start);
  37. return 0;
  38. }
  39. #endif
  40. #ifndef numa_fill_memblks
  41. static inline int __init numa_fill_memblks(u64 start, u64 end)
  42. {
  43. return NUMA_NO_MEMBLK;
  44. }
  45. #endif
  46. #else /* !CONFIG_NUMA */
  47. static inline int numa_map_to_online_node(int node)
  48. {
  49. return NUMA_NO_NODE;
  50. }
  51. static inline int memory_add_physaddr_to_nid(u64 start)
  52. {
  53. return 0;
  54. }
  55. static inline int phys_to_target_node(u64 start)
  56. {
  57. return 0;
  58. }
  59. #endif
  60. #ifdef CONFIG_HAVE_ARCH_NODE_DEV_GROUP
  61. extern const struct attribute_group arch_node_dev_group;
  62. #endif
  63. #endif /* _LINUX_NUMA_H */