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