@@ -1462,35 +1462,69 @@ static int __init decode_uv_systab(void)
1462
1462
return 0 ;
1463
1463
}
1464
1464
1465
+ /*
1466
+ * Given a bitmask 'bits' representing presnt blades, numbered
1467
+ * starting at 'base', masking off unused high bits of blade number
1468
+ * with 'mask', update the minimum and maximum blade numbers that we
1469
+ * have found. (Masking with 'mask' necessary because of BIOS
1470
+ * treatment of system partitioning when creating this table we are
1471
+ * interpreting.)
1472
+ */
1473
+ static inline void blade_update_min_max (unsigned long bits , int base , int mask , int * min , int * max )
1474
+ {
1475
+ int first , last ;
1476
+
1477
+ if (!bits )
1478
+ return ;
1479
+ first = (base + __ffs (bits )) & mask ;
1480
+ last = (base + __fls (bits )) & mask ;
1481
+
1482
+ if (* min > first )
1483
+ * min = first ;
1484
+ if (* max < last )
1485
+ * max = last ;
1486
+ }
1487
+
1465
1488
/* Set up physical blade translations from UVH_NODE_PRESENT_TABLE */
1466
1489
static __init void boot_init_possible_blades (struct uv_hub_info_s * hub_info )
1467
1490
{
1468
1491
unsigned long np ;
1469
1492
int i , uv_pb = 0 ;
1493
+ int sock_min = INT_MAX , sock_max = -1 , s_mask ;
1494
+
1495
+ s_mask = (1 << uv_cpuid .n_skt ) - 1 ;
1470
1496
1471
1497
if (UVH_NODE_PRESENT_TABLE ) {
1472
1498
pr_info ("UV: NODE_PRESENT_DEPTH = %d\n" ,
1473
1499
UVH_NODE_PRESENT_TABLE_DEPTH );
1474
1500
for (i = 0 ; i < UVH_NODE_PRESENT_TABLE_DEPTH ; i ++ ) {
1475
1501
np = uv_read_local_mmr (UVH_NODE_PRESENT_TABLE + i * 8 );
1476
1502
pr_info ("UV: NODE_PRESENT(%d) = 0x%016lx\n" , i , np );
1477
- uv_pb += hweight64 (np );
1503
+ blade_update_min_max (np , i * 64 , s_mask , & sock_min , & sock_max );
1478
1504
}
1479
1505
}
1480
1506
if (UVH_NODE_PRESENT_0 ) {
1481
1507
np = uv_read_local_mmr (UVH_NODE_PRESENT_0 );
1482
1508
pr_info ("UV: NODE_PRESENT_0 = 0x%016lx\n" , np );
1483
- uv_pb += hweight64 (np );
1509
+ blade_update_min_max (np , 0 , s_mask , & sock_min , & sock_max );
1484
1510
}
1485
1511
if (UVH_NODE_PRESENT_1 ) {
1486
1512
np = uv_read_local_mmr (UVH_NODE_PRESENT_1 );
1487
1513
pr_info ("UV: NODE_PRESENT_1 = 0x%016lx\n" , np );
1488
- uv_pb += hweight64 (np );
1514
+ blade_update_min_max (np , 64 , s_mask , & sock_min , & sock_max );
1515
+ }
1516
+
1517
+ /* Only update if we actually found some bits indicating blades present */
1518
+ if (sock_max >= sock_min ) {
1519
+ _min_socket = sock_min ;
1520
+ _max_socket = sock_max ;
1521
+ uv_pb = sock_max - sock_min + 1 ;
1489
1522
}
1490
1523
if (uv_possible_blades != uv_pb )
1491
1524
uv_possible_blades = uv_pb ;
1492
1525
1493
- pr_info ("UV: number nodes/possible blades %d\n" , uv_pb );
1526
+ pr_info ("UV: number nodes/possible blades %d (%d - %d)\n" ,
1527
+ uv_pb , sock_min , sock_max );
1494
1528
}
1495
1529
1496
1530
static int __init alloc_conv_table (int num_elem , unsigned short * * table )
0 commit comments