1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_X86_NUMA_H 3 #define _ASM_X86_NUMA_H 4 5 #include <linux/nodemask.h> 6 #include <linux/errno.h> 7 8 #include <asm/topology.h> 9 #include <asm/apicdef.h> 10 11 #ifdef CONFIG_NUMA 12 13 extern int numa_off; 14 15 /* 16 * __apicid_to_node[] stores the raw mapping between physical apicid and 17 * node and is used to initialize cpu_to_node mapping. 18 * 19 * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus 20 * should be accessed by the accessors - set_apicid_to_node() and 21 * numa_cpu_node(). 22 */ 23 extern s16 __apicid_to_node[MAX_LOCAL_APIC]; 24 extern nodemask_t numa_nodes_parsed __initdata; 25 set_apicid_to_node(int apicid,s16 node)26static inline void set_apicid_to_node(int apicid, s16 node) 27 { 28 __apicid_to_node[apicid] = node; 29 } 30 31 extern int numa_cpu_node(int cpu); 32 33 #else /* CONFIG_NUMA */ set_apicid_to_node(int apicid,s16 node)34static inline void set_apicid_to_node(int apicid, s16 node) 35 { 36 } 37 numa_cpu_node(int cpu)38static inline int numa_cpu_node(int cpu) 39 { 40 return NUMA_NO_NODE; 41 } 42 #endif /* CONFIG_NUMA */ 43 44 #ifdef CONFIG_X86_32 45 # include <asm/numa_32.h> 46 #endif 47 48 #ifdef CONFIG_NUMA 49 extern void numa_set_node(int cpu, int node); 50 extern void numa_clear_node(int cpu); 51 extern void __init init_cpu_to_node(void); 52 extern void numa_add_cpu(unsigned int cpu); 53 extern void numa_remove_cpu(unsigned int cpu); 54 extern void init_gi_nodes(void); 55 #else /* CONFIG_NUMA */ numa_set_node(int cpu,int node)56static inline void numa_set_node(int cpu, int node) { } numa_clear_node(int cpu)57static inline void numa_clear_node(int cpu) { } init_cpu_to_node(void)58static inline void init_cpu_to_node(void) { } numa_add_cpu(unsigned int cpu)59static inline void numa_add_cpu(unsigned int cpu) { } numa_remove_cpu(unsigned int cpu)60static inline void numa_remove_cpu(unsigned int cpu) { } init_gi_nodes(void)61static inline void init_gi_nodes(void) { } 62 #endif /* CONFIG_NUMA */ 63 64 #ifdef CONFIG_DEBUG_PER_CPU_MAPS 65 void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable); 66 #endif 67 68 #endif /* _ASM_X86_NUMA_H */ 69