1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef _ASM_X86_TOPOLOGY_H
26#define _ASM_X86_TOPOLOGY_H
27
28
29
30
31
32
33#include <linux/numa.h>
34
35#ifdef CONFIG_NUMA
36#include <linux/cpumask.h>
37
38#include <asm/mpspec.h>
39#include <asm/percpu.h>
40
41
42DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
43
44#ifdef CONFIG_DEBUG_PER_CPU_MAPS
45
46
47
48extern int __cpu_to_node(int cpu);
49#define cpu_to_node __cpu_to_node
50
51extern int early_cpu_to_node(int cpu);
52
53#else
54
55
56static inline int early_cpu_to_node(int cpu)
57{
58 return early_per_cpu(x86_cpu_to_node_map, cpu);
59}
60
61#endif
62
63
64extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
65
66#ifdef CONFIG_DEBUG_PER_CPU_MAPS
67extern const struct cpumask *cpumask_of_node(int node);
68#else
69
70static inline const struct cpumask *cpumask_of_node(int node)
71{
72 return node_to_cpumask_map[node];
73}
74#endif
75
76extern void setup_node_to_cpumask_map(void);
77
78
79
80
81
82#define parent_node(node) (node)
83
84#define pcibus_to_node(bus) __pcibus_to_node(bus)
85
86extern int __node_distance(int, int);
87#define node_distance(a, b) __node_distance(a, b)
88
89#else
90
91static inline int numa_node_id(void)
92{
93 return 0;
94}
95
96
97
98#define numa_node_id numa_node_id
99
100static inline int early_cpu_to_node(int cpu)
101{
102 return 0;
103}
104
105static inline void setup_node_to_cpumask_map(void) { }
106
107#endif
108
109#include <asm-generic/topology.h>
110
111extern const struct cpumask *cpu_coregroup_mask(int cpu);
112
113#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
114#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
115#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
116
117#ifdef CONFIG_SMP
118#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
119#define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
120
121extern unsigned int __max_logical_packages;
122#define topology_max_packages() (__max_logical_packages)
123
124extern int __max_smt_threads;
125
126static inline int topology_max_smt_threads(void)
127{
128 return __max_smt_threads;
129}
130
131int topology_update_package_map(unsigned int apicid, unsigned int cpu);
132extern int topology_phys_to_logical_pkg(unsigned int pkg);
133#else
134#define topology_max_packages() (1)
135static inline int
136topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; }
137static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
138static inline int topology_max_smt_threads(void) { return 1; }
139#endif
140
141static inline void arch_fix_phys_package_id(int num, u32 slot)
142{
143}
144
145struct pci_bus;
146int x86_pci_root_bus_node(int bus);
147void x86_pci_root_bus_resources(int bus, struct list_head *resources);
148
149#endif
150