Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 2 | #ifndef _ASM_X86_NUMA_H |
| 3 | #define _ASM_X86_NUMA_H |
| 4 | |
Tejun Heo | 6bd2627 | 2011-05-02 14:18:52 +0200 | [diff] [blame] | 5 | #include <linux/nodemask.h> |
| 6 | |
Tejun Heo | de2d944 | 2011-01-23 14:37:41 +0100 | [diff] [blame] | 7 | #include <asm/topology.h> |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 8 | #include <asm/apicdef.h> |
| 9 | |
| 10 | #ifdef CONFIG_NUMA |
Tejun Heo | ef396ec | 2011-02-16 17:11:07 +0100 | [diff] [blame] | 11 | |
| 12 | #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) |
Tejun Heo | a4106ea | 2011-05-02 14:18:53 +0200 | [diff] [blame] | 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 | |
| 21 | extern int numa_off; |
Tejun Heo | ef396ec | 2011-02-16 17:11:07 +0100 | [diff] [blame] | 22 | |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 23 | /* |
| 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 | */ |
| 31 | extern s16 __apicid_to_node[MAX_LOCAL_APIC]; |
Tejun Heo | e6df595 | 2011-05-02 14:18:53 +0200 | [diff] [blame] | 32 | extern nodemask_t numa_nodes_parsed __initdata; |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 33 | |
Tejun Heo | b0d3108 | 2011-05-02 14:18:53 +0200 | [diff] [blame] | 34 | extern int __init numa_add_memblk(int nodeid, u64 start, u64 end); |
| 35 | extern void __init numa_set_distance(int from, int to, int distance); |
| 36 | |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 37 | static inline void set_apicid_to_node(int apicid, s16 node) |
| 38 | { |
| 39 | __apicid_to_node[apicid] = node; |
| 40 | } |
Tejun Heo | 6bd2627 | 2011-05-02 14:18:52 +0200 | [diff] [blame] | 41 | |
Paul Gortmaker | 148f9bb | 2013-06-18 18:23:59 -0400 | [diff] [blame] | 42 | extern int numa_cpu_node(int cpu); |
Tejun Heo | 6bd2627 | 2011-05-02 14:18:52 +0200 | [diff] [blame] | 43 | |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 44 | #else /* CONFIG_NUMA */ |
| 45 | static inline void set_apicid_to_node(int apicid, s16 node) |
| 46 | { |
| 47 | } |
Tejun Heo | 6bd2627 | 2011-05-02 14:18:52 +0200 | [diff] [blame] | 48 | |
| 49 | static inline int numa_cpu_node(int cpu) |
| 50 | { |
| 51 | return NUMA_NO_NODE; |
| 52 | } |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 53 | #endif /* CONFIG_NUMA */ |
| 54 | |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 55 | #ifdef CONFIG_X86_32 |
David Howells | a1ce392 | 2012-10-02 18:01:25 +0100 | [diff] [blame] | 56 | # include <asm/numa_32.h> |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 57 | #endif |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 58 | |
Tejun Heo | 645a791 | 2011-01-23 14:37:40 +0100 | [diff] [blame] | 59 | #ifdef CONFIG_NUMA |
Wen Congyang | e13fe86 | 2013-02-22 16:33:31 -0800 | [diff] [blame] | 60 | extern void numa_set_node(int cpu, int node); |
| 61 | extern void numa_clear_node(int cpu); |
Tejun Heo | 8db78cc | 2011-01-23 14:37:42 +0100 | [diff] [blame] | 62 | extern void __init init_cpu_to_node(void); |
Paul Gortmaker | 148f9bb | 2013-06-18 18:23:59 -0400 | [diff] [blame] | 63 | extern void numa_add_cpu(int cpu); |
| 64 | extern void numa_remove_cpu(int cpu); |
Tejun Heo | 645a791 | 2011-01-23 14:37:40 +0100 | [diff] [blame] | 65 | #else /* CONFIG_NUMA */ |
| 66 | static inline void numa_set_node(int cpu, int node) { } |
| 67 | static inline void numa_clear_node(int cpu) { } |
Tejun Heo | 8db78cc | 2011-01-23 14:37:42 +0100 | [diff] [blame] | 68 | static inline void init_cpu_to_node(void) { } |
Tejun Heo | de2d944 | 2011-01-23 14:37:41 +0100 | [diff] [blame] | 69 | static inline void numa_add_cpu(int cpu) { } |
| 70 | static inline void numa_remove_cpu(int cpu) { } |
Tejun Heo | 645a791 | 2011-01-23 14:37:40 +0100 | [diff] [blame] | 71 | #endif /* CONFIG_NUMA */ |
| 72 | |
Tejun Heo | de2d944 | 2011-01-23 14:37:41 +0100 | [diff] [blame] | 73 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
David Rientjes | 7a6c654 | 2011-04-20 19:19:13 -0700 | [diff] [blame] | 74 | void debug_cpumask_set_cpu(int cpu, int node, bool enable); |
Tejun Heo | de2d944 | 2011-01-23 14:37:41 +0100 | [diff] [blame] | 75 | #endif |
| 76 | |
Tejun Heo | a4106ea | 2011-05-02 14:18:53 +0200 | [diff] [blame] | 77 | #ifdef CONFIG_NUMA_EMU |
| 78 | #define FAKE_NODE_MIN_SIZE ((u64)32 << 20) |
| 79 | #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) |
| 80 | void numa_emu_cmdline(char *); |
| 81 | #endif /* CONFIG_NUMA_EMU */ |
| 82 | |
Tejun Heo | bbc9e2f | 2011-01-23 14:37:39 +0100 | [diff] [blame] | 83 | #endif /* _ASM_X86_NUMA_H */ |