Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_NUMA_H
0003 #define _ASM_X86_NUMA_H
0004 
0005 #include <linux/nodemask.h>
0006 #include <linux/errno.h>
0007 
0008 #include <asm/topology.h>
0009 #include <asm/apicdef.h>
0010 
0011 #ifdef CONFIG_NUMA
0012 
0013 #define NR_NODE_MEMBLKS     (MAX_NUMNODES*2)
0014 
0015 /*
0016  * Too small node sizes may confuse the VM badly. Usually they
0017  * result from BIOS bugs. So dont recognize nodes as standalone
0018  * NUMA entities that have less than this amount of RAM listed:
0019  */
0020 #define NODE_MIN_SIZE (4*1024*1024)
0021 
0022 extern int numa_off;
0023 
0024 /*
0025  * __apicid_to_node[] stores the raw mapping between physical apicid and
0026  * node and is used to initialize cpu_to_node mapping.
0027  *
0028  * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
0029  * should be accessed by the accessors - set_apicid_to_node() and
0030  * numa_cpu_node().
0031  */
0032 extern s16 __apicid_to_node[MAX_LOCAL_APIC];
0033 extern nodemask_t numa_nodes_parsed __initdata;
0034 
0035 extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
0036 extern void __init numa_set_distance(int from, int to, int distance);
0037 
0038 static inline void set_apicid_to_node(int apicid, s16 node)
0039 {
0040     __apicid_to_node[apicid] = node;
0041 }
0042 
0043 extern int numa_cpu_node(int cpu);
0044 
0045 #else   /* CONFIG_NUMA */
0046 static inline void set_apicid_to_node(int apicid, s16 node)
0047 {
0048 }
0049 
0050 static inline int numa_cpu_node(int cpu)
0051 {
0052     return NUMA_NO_NODE;
0053 }
0054 #endif  /* CONFIG_NUMA */
0055 
0056 #ifdef CONFIG_X86_32
0057 # include <asm/numa_32.h>
0058 #endif
0059 
0060 #ifdef CONFIG_NUMA
0061 extern void numa_set_node(int cpu, int node);
0062 extern void numa_clear_node(int cpu);
0063 extern void __init init_cpu_to_node(void);
0064 extern void numa_add_cpu(int cpu);
0065 extern void numa_remove_cpu(int cpu);
0066 extern void init_gi_nodes(void);
0067 #else   /* CONFIG_NUMA */
0068 static inline void numa_set_node(int cpu, int node) { }
0069 static inline void numa_clear_node(int cpu)     { }
0070 static inline void init_cpu_to_node(void)       { }
0071 static inline void numa_add_cpu(int cpu)        { }
0072 static inline void numa_remove_cpu(int cpu)     { }
0073 static inline void init_gi_nodes(void)          { }
0074 #endif  /* CONFIG_NUMA */
0075 
0076 #ifdef CONFIG_DEBUG_PER_CPU_MAPS
0077 void debug_cpumask_set_cpu(int cpu, int node, bool enable);
0078 #endif
0079 
0080 #ifdef CONFIG_NUMA_EMU
0081 #define FAKE_NODE_MIN_SIZE  ((u64)32 << 20)
0082 #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
0083 int numa_emu_cmdline(char *str);
0084 #else /* CONFIG_NUMA_EMU */
0085 static inline int numa_emu_cmdline(char *str)
0086 {
0087     return -EINVAL;
0088 }
0089 #endif /* CONFIG_NUMA_EMU */
0090 
0091 #endif  /* _ASM_X86_NUMA_H */