|
26 | 26 | #include <linux/delay.h> |
27 | 27 | #include <linux/crash_dump.h> |
28 | 28 | #include <linux/reboot.h> |
| 29 | +#include <linux/memory.h> |
29 | 30 |
|
30 | 31 | #include <asm/uv/uv_mmrs.h> |
31 | 32 | #include <asm/uv/uv_hub.h> |
@@ -392,6 +393,51 @@ extern int uv_hub_info_version(void) |
392 | 393 | } |
393 | 394 | EXPORT_SYMBOL(uv_hub_info_version); |
394 | 395 |
|
| 396 | +/* Default UV memory block size is 2GB */ |
| 397 | +static unsigned long mem_block_size = (2UL << 30); |
| 398 | + |
| 399 | +/* Kernel parameter to specify UV mem block size */ |
| 400 | +static int parse_mem_block_size(char *ptr) |
| 401 | +{ |
| 402 | + unsigned long size = memparse(ptr, NULL); |
| 403 | + |
| 404 | + /* Size will be rounded down by set_block_size() below */ |
| 405 | + mem_block_size = size; |
| 406 | + return 0; |
| 407 | +} |
| 408 | +early_param("uv_memblksize", parse_mem_block_size); |
| 409 | + |
| 410 | +static __init int adj_blksize(u32 lgre) |
| 411 | +{ |
| 412 | + unsigned long base = (unsigned long)lgre << UV_GAM_RANGE_SHFT; |
| 413 | + unsigned long size; |
| 414 | + |
| 415 | + for (size = mem_block_size; size > MIN_MEMORY_BLOCK_SIZE; size >>= 1) |
| 416 | + if (IS_ALIGNED(base, size)) |
| 417 | + break; |
| 418 | + |
| 419 | + if (size >= mem_block_size) |
| 420 | + return 0; |
| 421 | + |
| 422 | + mem_block_size = size; |
| 423 | + return 1; |
| 424 | +} |
| 425 | + |
| 426 | +static __init void set_block_size(void) |
| 427 | +{ |
| 428 | + unsigned int order = ffs(mem_block_size); |
| 429 | + |
| 430 | + if (order) { |
| 431 | + /* adjust for ffs return of 1..64 */ |
| 432 | + set_memory_block_size_order(order - 1); |
| 433 | + pr_info("UV: mem_block_size set to 0x%lx\n", mem_block_size); |
| 434 | + } else { |
| 435 | + /* bad or zero value, default to 1UL << 31 (2GB) */ |
| 436 | + pr_err("UV: mem_block_size error with 0x%lx\n", mem_block_size); |
| 437 | + set_memory_block_size_order(31); |
| 438 | + } |
| 439 | +} |
| 440 | + |
395 | 441 | /* Build GAM range lookup table: */ |
396 | 442 | static __init void build_uv_gr_table(void) |
397 | 443 | { |
@@ -1180,23 +1226,30 @@ static void __init decode_gam_rng_tbl(unsigned long ptr) |
1180 | 1226 | << UV_GAM_RANGE_SHFT); |
1181 | 1227 | int order = 0; |
1182 | 1228 | char suffix[] = " KMGTPE"; |
| 1229 | + int flag = ' '; |
1183 | 1230 |
|
1184 | 1231 | while (size > 9999 && order < sizeof(suffix)) { |
1185 | 1232 | size /= 1024; |
1186 | 1233 | order++; |
1187 | 1234 | } |
1188 | 1235 |
|
| 1236 | + /* adjust max block size to current range start */ |
| 1237 | + if (gre->type == 1 || gre->type == 2) |
| 1238 | + if (adj_blksize(lgre)) |
| 1239 | + flag = '*'; |
| 1240 | + |
1189 | 1241 | if (!index) { |
1190 | 1242 | pr_info("UV: GAM Range Table...\n"); |
1191 | | - pr_info("UV: # %20s %14s %5s %4s %5s %3s %2s\n", "Range", "", "Size", "Type", "NASID", "SID", "PN"); |
| 1243 | + pr_info("UV: # %20s %14s %6s %4s %5s %3s %2s\n", "Range", "", "Size", "Type", "NASID", "SID", "PN"); |
1192 | 1244 | } |
1193 | | - pr_info("UV: %2d: 0x%014lx-0x%014lx %5lu%c %3d %04x %02x %02x\n", |
| 1245 | + pr_info("UV: %2d: 0x%014lx-0x%014lx%c %5lu%c %3d %04x %02x %02x\n", |
1194 | 1246 | index++, |
1195 | 1247 | (unsigned long)lgre << UV_GAM_RANGE_SHFT, |
1196 | 1248 | (unsigned long)gre->limit << UV_GAM_RANGE_SHFT, |
1197 | | - size, suffix[order], |
| 1249 | + flag, size, suffix[order], |
1198 | 1250 | gre->type, gre->nasid, gre->sockid, gre->pnode); |
1199 | 1251 |
|
| 1252 | + /* update to next range start */ |
1200 | 1253 | lgre = gre->limit; |
1201 | 1254 | if (sock_min > gre->sockid) |
1202 | 1255 | sock_min = gre->sockid; |
@@ -1427,6 +1480,7 @@ static void __init uv_system_init_hub(void) |
1427 | 1480 |
|
1428 | 1481 | build_socket_tables(); |
1429 | 1482 | build_uv_gr_table(); |
| 1483 | + set_block_size(); |
1430 | 1484 | uv_init_hub_info(&hub_info); |
1431 | 1485 | uv_possible_blades = num_possible_nodes(); |
1432 | 1486 | if (!_node_to_pnode) |
|
0 commit comments