blob: 01b493e5a99b3bf296ccb44aeca865e77982254f [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
13/*
14 * Too small node sizes may confuse the VM badly. Usually they
15 * result from BIOS bugs. So dont recognize nodes as standalone
16 * NUMA entities that have less than this amount of RAM listed:
17 */
18#define NODE_MIN_SIZE (4*1024*1024)
19
20extern int numa_off;
Tejun Heoef396ec2011-02-16 17:11:07 +010021
Tejun Heobbc9e2f2011-01-23 14:37:39 +010022/*
23 * __apicid_to_node[] stores the raw mapping between physical apicid and
24 * node and is used to initialize cpu_to_node mapping.
25 *
26 * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
27 * should be accessed by the accessors - set_apicid_to_node() and
28 * numa_cpu_node().
29 */
30extern s16 __apicid_to_node[MAX_LOCAL_APIC];
Tejun Heoe6df5952011-05-02 14:18:53 +020031extern nodemask_t numa_nodes_parsed __initdata;
Tejun Heobbc9e2f2011-01-23 14:37:39 +010032
Tejun Heob0d31082011-05-02 14:18:53 +020033extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
34extern void __init numa_set_distance(int from, int to, int distance);
35
Tejun Heobbc9e2f2011-01-23 14:37:39 +010036static inline void set_apicid_to_node(int apicid, s16 node)
37{
38 __apicid_to_node[apicid] = node;
39}
Tejun Heo6bd26272011-05-02 14:18:52 +020040
Paul Gortmaker148f9bb2013-06-18 18:23:59 -040041extern int numa_cpu_node(int cpu);
Tejun Heo6bd26272011-05-02 14:18:52 +020042
Tejun Heobbc9e2f2011-01-23 14:37:39 +010043#else /* CONFIG_NUMA */
44static inline void set_apicid_to_node(int apicid, s16 node)
45{
46}
Tejun Heo6bd26272011-05-02 14:18:52 +020047
48static inline int numa_cpu_node(int cpu)
49{
50 return NUMA_NO_NODE;
51}
Tejun Heobbc9e2f2011-01-23 14:37:39 +010052#endif /* CONFIG_NUMA */
53
Thomas Gleixner96a388d2007-10-11 11:20:03 +020054#ifdef CONFIG_X86_32
David Howellsa1ce3922012-10-02 18:01:25 +010055# include <asm/numa_32.h>
Thomas Gleixner96a388d2007-10-11 11:20:03 +020056#endif
Tejun Heobbc9e2f2011-01-23 14:37:39 +010057
Tejun Heo645a7912011-01-23 14:37:40 +010058#ifdef CONFIG_NUMA
Wen Congyange13fe862013-02-22 16:33:31 -080059extern void numa_set_node(int cpu, int node);
60extern void numa_clear_node(int cpu);
Tejun Heo8db78cc2011-01-23 14:37:42 +010061extern void __init init_cpu_to_node(void);
Paul Gortmaker148f9bb2013-06-18 18:23:59 -040062extern void numa_add_cpu(int cpu);
63extern void numa_remove_cpu(int cpu);
Tejun Heo645a7912011-01-23 14:37:40 +010064#else /* CONFIG_NUMA */
65static inline void numa_set_node(int cpu, int node) { }
66static inline void numa_clear_node(int cpu) { }
Tejun Heo8db78cc2011-01-23 14:37:42 +010067static inline void init_cpu_to_node(void) { }
Tejun Heode2d9442011-01-23 14:37:41 +010068static inline void numa_add_cpu(int cpu) { }
69static inline void numa_remove_cpu(int cpu) { }
Tejun Heo645a7912011-01-23 14:37:40 +010070#endif /* CONFIG_NUMA */
71
Tejun Heode2d9442011-01-23 14:37:41 +010072#ifdef CONFIG_DEBUG_PER_CPU_MAPS
David Rientjes7a6c6542011-04-20 19:19:13 -070073void debug_cpumask_set_cpu(int cpu, int node, bool enable);
Tejun Heode2d9442011-01-23 14:37:41 +010074#endif
75
Tejun Heoa4106ea2011-05-02 14:18:53 +020076#ifdef CONFIG_NUMA_EMU
77#define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
78#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
79void numa_emu_cmdline(char *);
80#endif /* CONFIG_NUMA_EMU */
81
Tejun Heobbc9e2f2011-01-23 14:37:39 +010082#endif /* _ASM_X86_NUMA_H */