blob: db449c7d89b3d7de7766eadaccaee53f1533ca91 [file] [log] [blame]
Tejun Heobbc9e2f2011-01-23 14:37:39 +01001#ifndef _ASM_X86_NUMA_H
2#define _ASM_X86_NUMA_H
3
Tejun Heo6bd26272011-05-02 14:18:52 +02004#include <linux/nodemask.h>
5
Tejun Heode2d9442011-01-23 14:37:41 +01006#include <asm/topology.h>
Tejun Heobbc9e2f2011-01-23 14:37:39 +01007#include <asm/apicdef.h>
8
9#ifdef CONFIG_NUMA
Tejun Heoef396ec2011-02-16 17:11:07 +010010
11#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
12
Tejun Heobbc9e2f2011-01-23 14:37:39 +010013/*
14 * __apicid_to_node[] stores the raw mapping between physical apicid and
15 * node and is used to initialize cpu_to_node mapping.
16 *
17 * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
18 * should be accessed by the accessors - set_apicid_to_node() and
19 * numa_cpu_node().
20 */
21extern s16 __apicid_to_node[MAX_LOCAL_APIC];
Tejun Heoe6df5952011-05-02 14:18:53 +020022extern nodemask_t numa_nodes_parsed __initdata;
Tejun Heobbc9e2f2011-01-23 14:37:39 +010023
Tejun Heob0d31082011-05-02 14:18:53 +020024extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
25extern void __init numa_set_distance(int from, int to, int distance);
26
Tejun Heobbc9e2f2011-01-23 14:37:39 +010027static inline void set_apicid_to_node(int apicid, s16 node)
28{
29 __apicid_to_node[apicid] = node;
30}
Tejun Heo6bd26272011-05-02 14:18:52 +020031
32extern int __cpuinit numa_cpu_node(int cpu);
33
Tejun Heobbc9e2f2011-01-23 14:37:39 +010034#else /* CONFIG_NUMA */
35static inline void set_apicid_to_node(int apicid, s16 node)
36{
37}
Tejun Heo6bd26272011-05-02 14:18:52 +020038
39static inline int numa_cpu_node(int cpu)
40{
41 return NUMA_NO_NODE;
42}
Tejun Heobbc9e2f2011-01-23 14:37:39 +010043#endif /* CONFIG_NUMA */
44
Thomas Gleixner96a388d2007-10-11 11:20:03 +020045#ifdef CONFIG_X86_32
46# include "numa_32.h"
47#else
48# include "numa_64.h"
49#endif
Tejun Heobbc9e2f2011-01-23 14:37:39 +010050
Tejun Heo645a7912011-01-23 14:37:40 +010051#ifdef CONFIG_NUMA
52extern void __cpuinit numa_set_node(int cpu, int node);
53extern void __cpuinit numa_clear_node(int cpu);
Tejun Heo8db78cc2011-01-23 14:37:42 +010054extern void __init numa_init_array(void);
55extern void __init init_cpu_to_node(void);
Tejun Heode2d9442011-01-23 14:37:41 +010056extern void __cpuinit numa_add_cpu(int cpu);
57extern void __cpuinit numa_remove_cpu(int cpu);
Tejun Heo645a7912011-01-23 14:37:40 +010058#else /* CONFIG_NUMA */
59static inline void numa_set_node(int cpu, int node) { }
60static inline void numa_clear_node(int cpu) { }
Tejun Heo8db78cc2011-01-23 14:37:42 +010061static inline void numa_init_array(void) { }
62static inline void init_cpu_to_node(void) { }
Tejun Heode2d9442011-01-23 14:37:41 +010063static inline void numa_add_cpu(int cpu) { }
64static inline void numa_remove_cpu(int cpu) { }
Tejun Heo645a7912011-01-23 14:37:40 +010065#endif /* CONFIG_NUMA */
66
Tejun Heode2d9442011-01-23 14:37:41 +010067#ifdef CONFIG_DEBUG_PER_CPU_MAPS
David Rientjes7a6c6542011-04-20 19:19:13 -070068void debug_cpumask_set_cpu(int cpu, int node, bool enable);
Tejun Heode2d9442011-01-23 14:37:41 +010069#endif
70
Tejun Heobbc9e2f2011-01-23 14:37:39 +010071#endif /* _ASM_X86_NUMA_H */