blob: bfacd2ccf651cfd0346ff254ebfdc76de6791431 [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)
Tejun Heoa4106ea2011-05-02 14:18:53 +020012#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
13
14/*
15 * Too small node sizes may confuse the VM badly. Usually they
16 * result from BIOS bugs. So dont recognize nodes as standalone
17 * NUMA entities that have less than this amount of RAM listed:
18 */
19#define NODE_MIN_SIZE (4*1024*1024)
20
21extern int numa_off;
Tejun Heoef396ec2011-02-16 17:11:07 +010022
Tejun Heobbc9e2f2011-01-23 14:37:39 +010023/*
24 * __apicid_to_node[] stores the raw mapping between physical apicid and
25 * node and is used to initialize cpu_to_node mapping.
26 *
27 * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
28 * should be accessed by the accessors - set_apicid_to_node() and
29 * numa_cpu_node().
30 */
31extern s16 __apicid_to_node[MAX_LOCAL_APIC];
Tejun Heoe6df5952011-05-02 14:18:53 +020032extern nodemask_t numa_nodes_parsed __initdata;
Tejun Heobbc9e2f2011-01-23 14:37:39 +010033
Tejun Heob0d31082011-05-02 14:18:53 +020034extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
35extern void __init numa_set_distance(int from, int to, int distance);
36
Tejun Heobbc9e2f2011-01-23 14:37:39 +010037static inline void set_apicid_to_node(int apicid, s16 node)
38{
39 __apicid_to_node[apicid] = node;
40}
Tejun Heo6bd26272011-05-02 14:18:52 +020041
42extern int __cpuinit numa_cpu_node(int cpu);
43
Tejun Heobbc9e2f2011-01-23 14:37:39 +010044#else /* CONFIG_NUMA */
45static inline void set_apicid_to_node(int apicid, s16 node)
46{
47}
Tejun Heo6bd26272011-05-02 14:18:52 +020048
49static inline int numa_cpu_node(int cpu)
50{
51 return NUMA_NO_NODE;
52}
Tejun Heobbc9e2f2011-01-23 14:37:39 +010053#endif /* CONFIG_NUMA */
54
Thomas Gleixner96a388d2007-10-11 11:20:03 +020055#ifdef CONFIG_X86_32
56# include "numa_32.h"
57#else
58# include "numa_64.h"
59#endif
Tejun Heobbc9e2f2011-01-23 14:37:39 +010060
Tejun Heo645a7912011-01-23 14:37:40 +010061#ifdef CONFIG_NUMA
62extern void __cpuinit numa_set_node(int cpu, int node);
63extern void __cpuinit numa_clear_node(int cpu);
Tejun Heo8db78cc2011-01-23 14:37:42 +010064extern void __init init_cpu_to_node(void);
Tejun Heode2d9442011-01-23 14:37:41 +010065extern void __cpuinit numa_add_cpu(int cpu);
66extern void __cpuinit numa_remove_cpu(int cpu);
Tejun Heo645a7912011-01-23 14:37:40 +010067#else /* CONFIG_NUMA */
68static inline void numa_set_node(int cpu, int node) { }
69static inline void numa_clear_node(int cpu) { }
Tejun Heo8db78cc2011-01-23 14:37:42 +010070static inline void init_cpu_to_node(void) { }
Tejun Heode2d9442011-01-23 14:37:41 +010071static inline void numa_add_cpu(int cpu) { }
72static inline void numa_remove_cpu(int cpu) { }
Tejun Heo645a7912011-01-23 14:37:40 +010073#endif /* CONFIG_NUMA */
74
Tejun Heode2d9442011-01-23 14:37:41 +010075#ifdef CONFIG_DEBUG_PER_CPU_MAPS
David Rientjes7a6c6542011-04-20 19:19:13 -070076void debug_cpumask_set_cpu(int cpu, int node, bool enable);
Tejun Heode2d9442011-01-23 14:37:41 +010077#endif
78
Tejun Heoa4106ea2011-05-02 14:18:53 +020079#ifdef CONFIG_NUMA_EMU
80#define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
81#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
82void numa_emu_cmdline(char *);
83#endif /* CONFIG_NUMA_EMU */
84
Tejun Heobbc9e2f2011-01-23 14:37:39 +010085#endif /* _ASM_X86_NUMA_H */