1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_NUMA_H
3 #define _ASM_X86_NUMA_H
5 #include <linux/nodemask.h>
7 #include <asm/topology.h>
8 #include <asm/apicdef.h>
12 #define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
17 * __apicid_to_node[] stores the raw mapping between physical apicid and
18 * node and is used to initialize cpu_to_node mapping.
20 * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
21 * should be accessed by the accessors - set_apicid_to_node() and
24 extern s16 __apicid_to_node[MAX_LOCAL_APIC];
25 extern nodemask_t numa_nodes_parsed __initdata;
27 extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
28 extern void __init numa_set_distance(int from, int to, int distance);
30 static inline void set_apicid_to_node(int apicid, s16 node)
32 __apicid_to_node[apicid] = node;
35 extern int numa_cpu_node(int cpu);
37 #else /* CONFIG_NUMA */
38 static inline void set_apicid_to_node(int apicid, s16 node)
42 static inline int numa_cpu_node(int cpu)
46 #endif /* CONFIG_NUMA */
49 # include <asm/numa_32.h>
53 extern void numa_set_node(int cpu, int node);
54 extern void numa_clear_node(int cpu);
55 extern void __init init_cpu_to_node(void);
56 extern void numa_add_cpu(int cpu);
57 extern void numa_remove_cpu(int cpu);
58 #else /* CONFIG_NUMA */
59 static inline void numa_set_node(int cpu, int node) { }
60 static inline void numa_clear_node(int cpu) { }
61 static inline void init_cpu_to_node(void) { }
62 static inline void numa_add_cpu(int cpu) { }
63 static inline void numa_remove_cpu(int cpu) { }
64 #endif /* CONFIG_NUMA */
66 #ifdef CONFIG_DEBUG_PER_CPU_MAPS
67 void debug_cpumask_set_cpu(int cpu, int node, bool enable);
70 #ifdef CONFIG_NUMA_EMU
71 #define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
72 #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
73 void numa_emu_cmdline(char *);
74 #endif /* CONFIG_NUMA_EMU */
76 #endif /* _ASM_X86_NUMA_H */