Skip to content

Commit 73b3108

Browse files
swahlhpehansendc
authored andcommitted
x86/platform/uv: Update UV[23] platform code for SNC
Previous Sub-NUMA Clustering changes need not just a count of blades present, but a count that includes any missing ids for blades not present; in other words, the range from lowest to highest blade id. Signed-off-by: Steve Wahl <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Link: https://lore.kernel.org/all/20230519190752.3297140-9-steve.wahl%40hpe.com
1 parent 8982756 commit 73b3108

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,35 +1462,69 @@ static int __init decode_uv_systab(void)
14621462
return 0;
14631463
}
14641464

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+
14651488
/* Set up physical blade translations from UVH_NODE_PRESENT_TABLE */
14661489
static __init void boot_init_possible_blades(struct uv_hub_info_s *hub_info)
14671490
{
14681491
unsigned long np;
14691492
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;
14701496

14711497
if (UVH_NODE_PRESENT_TABLE) {
14721498
pr_info("UV: NODE_PRESENT_DEPTH = %d\n",
14731499
UVH_NODE_PRESENT_TABLE_DEPTH);
14741500
for (i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++) {
14751501
np = uv_read_local_mmr(UVH_NODE_PRESENT_TABLE + i * 8);
14761502
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);
14781504
}
14791505
}
14801506
if (UVH_NODE_PRESENT_0) {
14811507
np = uv_read_local_mmr(UVH_NODE_PRESENT_0);
14821508
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);
14841510
}
14851511
if (UVH_NODE_PRESENT_1) {
14861512
np = uv_read_local_mmr(UVH_NODE_PRESENT_1);
14871513
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;
14891522
}
14901523
if (uv_possible_blades != uv_pb)
14911524
uv_possible_blades = uv_pb;
14921525

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);
14941528
}
14951529

14961530
static int __init alloc_conv_table(int num_elem, unsigned short **table)

0 commit comments

Comments
 (0)