return 0;
}
-int __node_distance(nodeid_t a, nodeid_t b)
+u8 __node_distance(nodeid_t a, nodeid_t b)
{
- int index;
+ unsigned index;
+ u8 slit_val;
if (!acpi_slit)
return a == b ? 10 : 20;
index = acpi_slit->locality_count * node_to_pxm(a);
- return acpi_slit->entry[index + node_to_pxm(b)];
+ slit_val = acpi_slit->entry[index + node_to_pxm(b)];
+
+ /* ACPI defines 0xff as an unreachable node and 0-9 are undefined */
+ if ((slit_val == 0xff) || (slit_val <= 9))
+ return NUMA_NO_DISTANCE;
+ else
+ return slit_val;
}
EXPORT_SYMBOL(__node_distance);
/* Figure out which NODE CPUs are close. */
for_each_online_node ( j )
{
- int distance;
+ u8 distance;
if ( cpumask_empty(&node_to_cpumask(j)) )
continue;
distance = __node_distance(i, j);
- if ( distance < last_distance )
+ if ( (distance < last_distance) && (distance != NUMA_NO_DISTANCE) )
{
last_distance = distance;
best_node = j;
{
uint32_t distance = ~0u;
if ( node_online(i) && node_online(j) )
- distance = __node_distance(i, j);
+ {
+ u8 d = __node_distance(i, j);
+
+ if ( d != NUMA_NO_DISTANCE )
+ distance = d;
+ }
if ( copy_to_guest_offset(
ni->node_to_node_distance,
i*(max_node_index+1) + j, &distance, 1) )
#endif
void srat_parse_regions(u64 addr);
-extern int __node_distance(nodeid_t a, nodeid_t b);
+extern u8 __node_distance(nodeid_t a, nodeid_t b);
#endif
#define NODES_SHIFT 0
#endif
-#define NUMA_NO_NODE 0xFF
+#define NUMA_NO_NODE 0xFF
+#define NUMA_NO_DISTANCE 0xFF
#define MAX_NUMNODES (1 << NODES_SHIFT)