blob: 5982d418c35888c8a0143c1ff3fd804fdd24f11c [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];
22
23static inline void set_apicid_to_node(int apicid, s16 node)
24{
25 __apicid_to_node[apicid] = node;
26}
Tejun Heo6bd26272011-05-02 14:18:52 +020027
28extern int __cpuinit numa_cpu_node(int cpu);
29
Tejun Heobbc9e2f2011-01-23 14:37:39 +010030#else /* CONFIG_NUMA */
31static inline void set_apicid_to_node(int apicid, s16 node)
32{
33}
Tejun Heo6bd26272011-05-02 14:18:52 +020034
35static inline int numa_cpu_node(int cpu)
36{
37 return NUMA_NO_NODE;
38}
Tejun Heobbc9e2f2011-01-23 14:37:39 +010039#endif /* CONFIG_NUMA */
40
Thomas Gleixner96a388d2007-10-11 11:20:03 +020041#ifdef CONFIG_X86_32
42# include "numa_32.h"
43#else
44# include "numa_64.h"
45#endif
Tejun Heobbc9e2f2011-01-23 14:37:39 +010046
Tejun Heo645a7912011-01-23 14:37:40 +010047#ifdef CONFIG_NUMA
48extern void __cpuinit numa_set_node(int cpu, int node);
49extern void __cpuinit numa_clear_node(int cpu);
Tejun Heo8db78cc2011-01-23 14:37:42 +010050extern void __init numa_init_array(void);
51extern void __init init_cpu_to_node(void);
Tejun Heode2d9442011-01-23 14:37:41 +010052extern void __cpuinit numa_add_cpu(int cpu);
53extern void __cpuinit numa_remove_cpu(int cpu);
Tejun Heo645a7912011-01-23 14:37:40 +010054#else /* CONFIG_NUMA */
55static inline void numa_set_node(int cpu, int node) { }
56static inline void numa_clear_node(int cpu) { }
Tejun Heo8db78cc2011-01-23 14:37:42 +010057static inline void numa_init_array(void) { }
58static inline void init_cpu_to_node(void) { }
Tejun Heode2d9442011-01-23 14:37:41 +010059static inline void numa_add_cpu(int cpu) { }
60static inline void numa_remove_cpu(int cpu) { }
Tejun Heo645a7912011-01-23 14:37:40 +010061#endif /* CONFIG_NUMA */
62
Tejun Heode2d9442011-01-23 14:37:41 +010063#ifdef CONFIG_DEBUG_PER_CPU_MAPS
David Rientjes7a6c6542011-04-20 19:19:13 -070064void debug_cpumask_set_cpu(int cpu, int node, bool enable);
Tejun Heode2d9442011-01-23 14:37:41 +010065#endif
66
Tejun Heobbc9e2f2011-01-23 14:37:39 +010067#endif /* _ASM_X86_NUMA_H */