diff options
Diffstat (limited to 'include/asm-x86/uv/uv_hub.h')
-rw-r--r-- | include/asm-x86/uv/uv_hub.h | 190 |
1 files changed, 130 insertions, 60 deletions
diff --git a/include/asm-x86/uv/uv_hub.h b/include/asm-x86/uv/uv_hub.h index 26b9240d1e23..a4ef26e5850b 100644 --- a/include/asm-x86/uv/uv_hub.h +++ b/include/asm-x86/uv/uv_hub.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * SGI UV architectural definitions | 6 | * SGI UV architectural definitions |
7 | * | 7 | * |
8 | * Copyright (C) 2007 Silicon Graphics, Inc. All rights reserved. | 8 | * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __ASM_X86_UV_HUB_H__ | 11 | #ifndef __ASM_X86_UV_HUB_H__ |
@@ -20,26 +20,49 @@ | |||
20 | /* | 20 | /* |
21 | * Addressing Terminology | 21 | * Addressing Terminology |
22 | * | 22 | * |
23 | * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of | 23 | * M - The low M bits of a physical address represent the offset |
24 | * routers always have low bit of 1, C/MBricks have low bit | 24 | * into the blade local memory. RAM memory on a blade is physically |
25 | * equal to 0. Most addressing macros that target UV hub chips | 25 | * contiguous (although various IO spaces may punch holes in |
26 | * right shift the NASID by 1 to exclude the always-zero bit. | 26 | * it).. |
27 | * | 27 | * |
28 | * SNASID - NASID right shifted by 1 bit. | 28 | * N - Number of bits in the node portion of a socket physical |
29 | * address. | ||
30 | * | ||
31 | * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of | ||
32 | * routers always have low bit of 1, C/MBricks have low bit | ||
33 | * equal to 0. Most addressing macros that target UV hub chips | ||
34 | * right shift the NASID by 1 to exclude the always-zero bit. | ||
35 | * NASIDs contain up to 15 bits. | ||
36 | * | ||
37 | * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead | ||
38 | * of nasids. | ||
39 | * | ||
40 | * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant | ||
41 | * of the nasid for socket usage. | ||
42 | * | ||
43 | * | ||
44 | * NumaLink Global Physical Address Format: | ||
45 | * +--------------------------------+---------------------+ | ||
46 | * |00..000| GNODE | NodeOffset | | ||
47 | * +--------------------------------+---------------------+ | ||
48 | * |<-------53 - M bits --->|<--------M bits -----> | ||
49 | * | ||
50 | * M - number of node offset bits (35 .. 40) | ||
29 | * | 51 | * |
30 | * | 52 | * |
31 | * Memory/UV-HUB Processor Socket Address Format: | 53 | * Memory/UV-HUB Processor Socket Address Format: |
32 | * +--------+---------------+---------------------+ | 54 | * +----------------+---------------+---------------------+ |
33 | * |00..0000| SNASID | NodeOffset | | 55 | * |00..000000000000| PNODE | NodeOffset | |
34 | * +--------+---------------+---------------------+ | 56 | * +----------------+---------------+---------------------+ |
35 | * <--- N bits --->|<--------M bits -----> | 57 | * <--- N bits --->|<--------M bits -----> |
36 | * | 58 | * |
37 | * M number of node offset bits (35 .. 40) | 59 | * M - number of node offset bits (35 .. 40) |
38 | * N number of SNASID bits (0 .. 10) | 60 | * N - number of PNODE bits (0 .. 10) |
39 | * | 61 | * |
40 | * Note: M + N cannot currently exceed 44 (x86_64) or 46 (IA64). | 62 | * Note: M + N cannot currently exceed 44 (x86_64) or 46 (IA64). |
41 | * The actual values are configuration dependent and are set at | 63 | * The actual values are configuration dependent and are set at |
42 | * boot time | 64 | * boot time. M & N values are set by the hardware/BIOS at boot. |
65 | * | ||
43 | * | 66 | * |
44 | * APICID format | 67 | * APICID format |
45 | * NOTE!!!!!! This is the current format of the APICID. However, code | 68 | * NOTE!!!!!! This is the current format of the APICID. However, code |
@@ -48,14 +71,14 @@ | |||
48 | * | 71 | * |
49 | * 1111110000000000 | 72 | * 1111110000000000 |
50 | * 5432109876543210 | 73 | * 5432109876543210 |
51 | * nnnnnnnnnnlc0cch | 74 | * pppppppppplc0cch |
52 | * sssssssssss | 75 | * sssssssssss |
53 | * | 76 | * |
54 | * n = snasid bits | 77 | * p = pnode bits |
55 | * l = socket number on board | 78 | * l = socket number on board |
56 | * c = core | 79 | * c = core |
57 | * h = hyperthread | 80 | * h = hyperthread |
58 | * s = bits that are in the socket CSR | 81 | * s = bits that are in the SOCKET_ID CSR |
59 | * | 82 | * |
60 | * Note: Processor only supports 12 bits in the APICID register. The ACPI | 83 | * Note: Processor only supports 12 bits in the APICID register. The ACPI |
61 | * tables hold all 16 bits. Software needs to be aware of this. | 84 | * tables hold all 16 bits. Software needs to be aware of this. |
@@ -74,7 +97,7 @@ | |||
74 | * This value is also the value of the maximum number of non-router NASIDs | 97 | * This value is also the value of the maximum number of non-router NASIDs |
75 | * in the numalink fabric. | 98 | * in the numalink fabric. |
76 | * | 99 | * |
77 | * NOTE: a brick may be 1 or 2 OS nodes. Don't get these confused. | 100 | * NOTE: a brick may contain 1 or 2 OS nodes. Don't get these confused. |
78 | */ | 101 | */ |
79 | #define UV_MAX_NUMALINK_BLADES 16384 | 102 | #define UV_MAX_NUMALINK_BLADES 16384 |
80 | 103 | ||
@@ -96,8 +119,12 @@ | |||
96 | */ | 119 | */ |
97 | struct uv_hub_info_s { | 120 | struct uv_hub_info_s { |
98 | unsigned long global_mmr_base; | 121 | unsigned long global_mmr_base; |
99 | unsigned short local_nasid; | 122 | unsigned long gpa_mask; |
100 | unsigned short gnode_upper; | 123 | unsigned long gnode_upper; |
124 | unsigned long lowmem_remap_top; | ||
125 | unsigned long lowmem_remap_base; | ||
126 | unsigned short pnode; | ||
127 | unsigned short pnode_mask; | ||
101 | unsigned short coherency_domain_number; | 128 | unsigned short coherency_domain_number; |
102 | unsigned short numa_blade_id; | 129 | unsigned short numa_blade_id; |
103 | unsigned char blade_processor_id; | 130 | unsigned char blade_processor_id; |
@@ -112,83 +139,126 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | |||
112 | * Local & Global MMR space macros. | 139 | * Local & Global MMR space macros. |
113 | * Note: macros are intended to be used ONLY by inline functions | 140 | * Note: macros are intended to be used ONLY by inline functions |
114 | * in this file - not by other kernel code. | 141 | * in this file - not by other kernel code. |
142 | * n - NASID (full 15-bit global nasid) | ||
143 | * g - GNODE (full 15-bit global nasid, right shifted 1) | ||
144 | * p - PNODE (local part of nsids, right shifted 1) | ||
115 | */ | 145 | */ |
116 | #define UV_SNASID(n) ((n) >> 1) | 146 | #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask) |
117 | #define UV_NASID(n) ((n) << 1) | 147 | #define UV_PNODE_TO_NASID(p) (((p) << 1) | uv_hub_info->gnode_upper) |
118 | 148 | ||
119 | #define UV_LOCAL_MMR_BASE 0xf4000000UL | 149 | #define UV_LOCAL_MMR_BASE 0xf4000000UL |
120 | #define UV_GLOBAL_MMR32_BASE 0xf8000000UL | 150 | #define UV_GLOBAL_MMR32_BASE 0xf8000000UL |
121 | #define UV_GLOBAL_MMR64_BASE (uv_hub_info->global_mmr_base) | 151 | #define UV_GLOBAL_MMR64_BASE (uv_hub_info->global_mmr_base) |
152 | #define UV_LOCAL_MMR_SIZE (64UL * 1024 * 1024) | ||
153 | #define UV_GLOBAL_MMR32_SIZE (64UL * 1024 * 1024) | ||
122 | 154 | ||
123 | #define UV_GLOBAL_MMR32_SNASID_MASK 0x3ff | 155 | #define UV_GLOBAL_MMR32_PNODE_SHIFT 15 |
124 | #define UV_GLOBAL_MMR32_SNASID_SHIFT 15 | 156 | #define UV_GLOBAL_MMR64_PNODE_SHIFT 26 |
125 | #define UV_GLOBAL_MMR64_SNASID_SHIFT 26 | ||
126 | 157 | ||
127 | #define UV_GLOBAL_MMR32_NASID_BITS(n) \ | 158 | #define UV_GLOBAL_MMR32_PNODE_BITS(p) ((p) << (UV_GLOBAL_MMR32_PNODE_SHIFT)) |
128 | (((UV_SNASID(n) & UV_GLOBAL_MMR32_SNASID_MASK)) << \ | ||
129 | (UV_GLOBAL_MMR32_SNASID_SHIFT)) | ||
130 | 159 | ||
131 | #define UV_GLOBAL_MMR64_NASID_BITS(n) \ | 160 | #define UV_GLOBAL_MMR64_PNODE_BITS(p) \ |
132 | ((unsigned long)UV_SNASID(n) << UV_GLOBAL_MMR64_SNASID_SHIFT) | 161 | ((unsigned long)(p) << UV_GLOBAL_MMR64_PNODE_SHIFT) |
162 | |||
163 | #define UV_APIC_PNODE_SHIFT 6 | ||
164 | |||
165 | /* | ||
166 | * Macros for converting between kernel virtual addresses, socket local physical | ||
167 | * addresses, and UV global physical addresses. | ||
168 | * Note: use the standard __pa() & __va() macros for converting | ||
169 | * between socket virtual and socket physical addresses. | ||
170 | */ | ||
171 | |||
172 | /* socket phys RAM --> UV global physical address */ | ||
173 | static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr) | ||
174 | { | ||
175 | if (paddr < uv_hub_info->lowmem_remap_top) | ||
176 | paddr += uv_hub_info->lowmem_remap_base; | ||
177 | return paddr | uv_hub_info->gnode_upper; | ||
178 | } | ||
179 | |||
180 | |||
181 | /* socket virtual --> UV global physical address */ | ||
182 | static inline unsigned long uv_gpa(void *v) | ||
183 | { | ||
184 | return __pa(v) | uv_hub_info->gnode_upper; | ||
185 | } | ||
186 | |||
187 | /* socket virtual --> UV global physical address */ | ||
188 | static inline void *uv_vgpa(void *v) | ||
189 | { | ||
190 | return (void *)uv_gpa(v); | ||
191 | } | ||
192 | |||
193 | /* UV global physical address --> socket virtual */ | ||
194 | static inline void *uv_va(unsigned long gpa) | ||
195 | { | ||
196 | return __va(gpa & uv_hub_info->gpa_mask); | ||
197 | } | ||
198 | |||
199 | /* pnode, offset --> socket virtual */ | ||
200 | static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset) | ||
201 | { | ||
202 | return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset); | ||
203 | } | ||
133 | 204 | ||
134 | #define UV_APIC_NASID_SHIFT 6 | ||
135 | 205 | ||
136 | /* | 206 | /* |
137 | * Extract a NASID from an APICID (full apicid, not processor subset) | 207 | * Extract a PNODE from an APICID (full apicid, not processor subset) |
138 | */ | 208 | */ |
139 | static inline int uv_apicid_to_nasid(int apicid) | 209 | static inline int uv_apicid_to_pnode(int apicid) |
140 | { | 210 | { |
141 | return (UV_NASID(apicid >> UV_APIC_NASID_SHIFT)); | 211 | return (apicid >> UV_APIC_PNODE_SHIFT); |
142 | } | 212 | } |
143 | 213 | ||
144 | /* | 214 | /* |
145 | * Access global MMRs using the low memory MMR32 space. This region supports | 215 | * Access global MMRs using the low memory MMR32 space. This region supports |
146 | * faster MMR access but not all MMRs are accessible in this space. | 216 | * faster MMR access but not all MMRs are accessible in this space. |
147 | */ | 217 | */ |
148 | static inline unsigned long *uv_global_mmr32_address(int nasid, | 218 | static inline unsigned long *uv_global_mmr32_address(int pnode, |
149 | unsigned long offset) | 219 | unsigned long offset) |
150 | { | 220 | { |
151 | return __va(UV_GLOBAL_MMR32_BASE | | 221 | return __va(UV_GLOBAL_MMR32_BASE | |
152 | UV_GLOBAL_MMR32_NASID_BITS(nasid) | offset); | 222 | UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset); |
153 | } | 223 | } |
154 | 224 | ||
155 | static inline void uv_write_global_mmr32(int nasid, unsigned long offset, | 225 | static inline void uv_write_global_mmr32(int pnode, unsigned long offset, |
156 | unsigned long val) | 226 | unsigned long val) |
157 | { | 227 | { |
158 | *uv_global_mmr32_address(nasid, offset) = val; | 228 | *uv_global_mmr32_address(pnode, offset) = val; |
159 | } | 229 | } |
160 | 230 | ||
161 | static inline unsigned long uv_read_global_mmr32(int nasid, | 231 | static inline unsigned long uv_read_global_mmr32(int pnode, |
162 | unsigned long offset) | 232 | unsigned long offset) |
163 | { | 233 | { |
164 | return *uv_global_mmr32_address(nasid, offset); | 234 | return *uv_global_mmr32_address(pnode, offset); |
165 | } | 235 | } |
166 | 236 | ||
167 | /* | 237 | /* |
168 | * Access Global MMR space using the MMR space located at the top of physical | 238 | * Access Global MMR space using the MMR space located at the top of physical |
169 | * memory. | 239 | * memory. |
170 | */ | 240 | */ |
171 | static inline unsigned long *uv_global_mmr64_address(int nasid, | 241 | static inline unsigned long *uv_global_mmr64_address(int pnode, |
172 | unsigned long offset) | 242 | unsigned long offset) |
173 | { | 243 | { |
174 | return __va(UV_GLOBAL_MMR64_BASE | | 244 | return __va(UV_GLOBAL_MMR64_BASE | |
175 | UV_GLOBAL_MMR64_NASID_BITS(nasid) | offset); | 245 | UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset); |
176 | } | 246 | } |
177 | 247 | ||
178 | static inline void uv_write_global_mmr64(int nasid, unsigned long offset, | 248 | static inline void uv_write_global_mmr64(int pnode, unsigned long offset, |
179 | unsigned long val) | 249 | unsigned long val) |
180 | { | 250 | { |
181 | *uv_global_mmr64_address(nasid, offset) = val; | 251 | *uv_global_mmr64_address(pnode, offset) = val; |
182 | } | 252 | } |
183 | 253 | ||
184 | static inline unsigned long uv_read_global_mmr64(int nasid, | 254 | static inline unsigned long uv_read_global_mmr64(int pnode, |
185 | unsigned long offset) | 255 | unsigned long offset) |
186 | { | 256 | { |
187 | return *uv_global_mmr64_address(nasid, offset); | 257 | return *uv_global_mmr64_address(pnode, offset); |
188 | } | 258 | } |
189 | 259 | ||
190 | /* | 260 | /* |
191 | * Access node local MMRs. Faster than using global space but only local MMRs | 261 | * Access hub local MMRs. Faster than using global space but only local MMRs |
192 | * are accessible. | 262 | * are accessible. |
193 | */ | 263 | */ |
194 | static inline unsigned long *uv_local_mmr_address(unsigned long offset) | 264 | static inline unsigned long *uv_local_mmr_address(unsigned long offset) |
@@ -207,15 +277,15 @@ static inline void uv_write_local_mmr(unsigned long offset, unsigned long val) | |||
207 | } | 277 | } |
208 | 278 | ||
209 | /* | 279 | /* |
210 | * Structures and definitions for converting between cpu, node, and blade | 280 | * Structures and definitions for converting between cpu, node, pnode, and blade |
211 | * numbers. | 281 | * numbers. |
212 | */ | 282 | */ |
213 | struct uv_blade_info { | 283 | struct uv_blade_info { |
214 | unsigned short nr_posible_cpus; | 284 | unsigned short nr_possible_cpus; |
215 | unsigned short nr_online_cpus; | 285 | unsigned short nr_online_cpus; |
216 | unsigned short nasid; | 286 | unsigned short pnode; |
217 | }; | 287 | }; |
218 | struct uv_blade_info *uv_blade_info; | 288 | extern struct uv_blade_info *uv_blade_info; |
219 | extern short *uv_node_to_blade; | 289 | extern short *uv_node_to_blade; |
220 | extern short *uv_cpu_to_blade; | 290 | extern short *uv_cpu_to_blade; |
221 | extern short uv_possible_blades; | 291 | extern short uv_possible_blades; |
@@ -244,16 +314,16 @@ static inline int uv_node_to_blade_id(int nid) | |||
244 | return uv_node_to_blade[nid]; | 314 | return uv_node_to_blade[nid]; |
245 | } | 315 | } |
246 | 316 | ||
247 | /* Convert a blade id to the NASID of the blade */ | 317 | /* Convert a blade id to the PNODE of the blade */ |
248 | static inline int uv_blade_to_nasid(int bid) | 318 | static inline int uv_blade_to_pnode(int bid) |
249 | { | 319 | { |
250 | return uv_blade_info[bid].nasid; | 320 | return uv_blade_info[bid].pnode; |
251 | } | 321 | } |
252 | 322 | ||
253 | /* Determine the number of possible cpus on a blade */ | 323 | /* Determine the number of possible cpus on a blade */ |
254 | static inline int uv_blade_nr_possible_cpus(int bid) | 324 | static inline int uv_blade_nr_possible_cpus(int bid) |
255 | { | 325 | { |
256 | return uv_blade_info[bid].nr_posible_cpus; | 326 | return uv_blade_info[bid].nr_possible_cpus; |
257 | } | 327 | } |
258 | 328 | ||
259 | /* Determine the number of online cpus on a blade */ | 329 | /* Determine the number of online cpus on a blade */ |
@@ -262,16 +332,16 @@ static inline int uv_blade_nr_online_cpus(int bid) | |||
262 | return uv_blade_info[bid].nr_online_cpus; | 332 | return uv_blade_info[bid].nr_online_cpus; |
263 | } | 333 | } |
264 | 334 | ||
265 | /* Convert a cpu id to the NASID of the blade containing the cpu */ | 335 | /* Convert a cpu id to the PNODE of the blade containing the cpu */ |
266 | static inline int uv_cpu_to_nasid(int cpu) | 336 | static inline int uv_cpu_to_pnode(int cpu) |
267 | { | 337 | { |
268 | return uv_blade_info[uv_cpu_to_blade_id(cpu)].nasid; | 338 | return uv_blade_info[uv_cpu_to_blade_id(cpu)].pnode; |
269 | } | 339 | } |
270 | 340 | ||
271 | /* Convert a node number to the NASID of the blade */ | 341 | /* Convert a linux node number to the PNODE of the blade */ |
272 | static inline int uv_node_to_nasid(int nid) | 342 | static inline int uv_node_to_pnode(int nid) |
273 | { | 343 | { |
274 | return uv_blade_info[uv_node_to_blade_id(nid)].nasid; | 344 | return uv_blade_info[uv_node_to_blade_id(nid)].pnode; |
275 | } | 345 | } |
276 | 346 | ||
277 | /* Maximum possible number of blades */ | 347 | /* Maximum possible number of blades */ |