Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_NUMA_H
3#define _ASM_X86_NUMA_H
4
5#include <linux/nodemask.h>
6
7#include <asm/topology.h>
8#include <asm/apicdef.h>
9
10#ifdef CONFIG_NUMA
11
12#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
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;
22
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 */
31extern s16 __apicid_to_node[MAX_LOCAL_APIC];
32extern nodemask_t numa_nodes_parsed __initdata;
33
34extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);
35extern void __init numa_set_distance(int from, int to, int distance);
36
37static inline void set_apicid_to_node(int apicid, s16 node)
38{
39 __apicid_to_node[apicid] = node;
40}
41
42extern int numa_cpu_node(int cpu);
43
44#else /* CONFIG_NUMA */
45static inline void set_apicid_to_node(int apicid, s16 node)
46{
47}
48
49static inline int numa_cpu_node(int cpu)
50{
51 return NUMA_NO_NODE;
52}
53#endif /* CONFIG_NUMA */
54
55#ifdef CONFIG_X86_32
56# include <asm/numa_32.h>
57#endif
58
59#ifdef CONFIG_NUMA
60extern void numa_set_node(int cpu, int node);
61extern void numa_clear_node(int cpu);
62extern void __init init_cpu_to_node(void);
63extern void numa_add_cpu(int cpu);
64extern void numa_remove_cpu(int cpu);
65#else /* CONFIG_NUMA */
66static inline void numa_set_node(int cpu, int node) { }
67static inline void numa_clear_node(int cpu) { }
68static inline void init_cpu_to_node(void) { }
69static inline void numa_add_cpu(int cpu) { }
70static inline void numa_remove_cpu(int cpu) { }
71#endif /* CONFIG_NUMA */
72
73#ifdef CONFIG_DEBUG_PER_CPU_MAPS
74void debug_cpumask_set_cpu(int cpu, int node, bool enable);
75#endif
76
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))
80void numa_emu_cmdline(char *);
81#endif /* CONFIG_NUMA_EMU */
82
83#endif /* _ASM_X86_NUMA_H */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_NUMA_H
3#define _ASM_X86_NUMA_H
4
5#include <linux/nodemask.h>
6#include <linux/errno.h>
7
8#include <asm/topology.h>
9#include <asm/apicdef.h>
10
11#ifdef CONFIG_NUMA
12
13extern int numa_off;
14
15/*
16 * __apicid_to_node[] stores the raw mapping between physical apicid and
17 * node and is used to initialize cpu_to_node mapping.
18 *
19 * The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus
20 * should be accessed by the accessors - set_apicid_to_node() and
21 * numa_cpu_node().
22 */
23extern s16 __apicid_to_node[MAX_LOCAL_APIC];
24extern nodemask_t numa_nodes_parsed __initdata;
25
26static inline void set_apicid_to_node(int apicid, s16 node)
27{
28 __apicid_to_node[apicid] = node;
29}
30
31extern int numa_cpu_node(int cpu);
32
33#else /* CONFIG_NUMA */
34static inline void set_apicid_to_node(int apicid, s16 node)
35{
36}
37
38static inline int numa_cpu_node(int cpu)
39{
40 return NUMA_NO_NODE;
41}
42#endif /* CONFIG_NUMA */
43
44#ifdef CONFIG_X86_32
45# include <asm/numa_32.h>
46#endif
47
48#ifdef CONFIG_NUMA
49extern void numa_set_node(int cpu, int node);
50extern void numa_clear_node(int cpu);
51extern void __init init_cpu_to_node(void);
52extern void numa_add_cpu(unsigned int cpu);
53extern void numa_remove_cpu(unsigned int cpu);
54extern void init_gi_nodes(void);
55#else /* CONFIG_NUMA */
56static inline void numa_set_node(int cpu, int node) { }
57static inline void numa_clear_node(int cpu) { }
58static inline void init_cpu_to_node(void) { }
59static inline void numa_add_cpu(unsigned int cpu) { }
60static inline void numa_remove_cpu(unsigned int cpu) { }
61static inline void init_gi_nodes(void) { }
62#endif /* CONFIG_NUMA */
63
64#ifdef CONFIG_DEBUG_PER_CPU_MAPS
65void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable);
66#endif
67
68#endif /* _ASM_X86_NUMA_H */