aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr_numa.c
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2021-11-05 23:51:37 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2021-11-09 10:32:53 +1100
commit71e6fae3a994ab5c69e37d6a52a30c840883fbfb (patch)
tree760292c2ddc22c5b75653c5d5dc7ae4ca6d8d729 /hw/ppc/spapr_numa.c
parent14fe3222e5bd74f5075b774416dd193852f1e535 (diff)
spapr_numa.c: FORM2 table handle nodes with no distance info
A configuration that specifies multiple nodes without distance info results in the non-local points in the FORM2 matrix having a distance of 0. This causes Linux to complain "Invalid distance value range" because a node distance is smaller than the local distance. Fix this by building a simple local / remote fallback for points where distance information is missing. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20211105135137.1584840-1-npiggin@gmail.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_numa.c')
-rw-r--r--hw/ppc/spapr_numa.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c
index 5822938448..56ab2a5fb6 100644
--- a/hw/ppc/spapr_numa.c
+++ b/hw/ppc/spapr_numa.c
@@ -546,12 +546,24 @@ static void spapr_numa_FORM2_write_rtas_tables(SpaprMachineState *spapr,
* NUMA nodes, but QEMU adds the default NUMA node without
* adding the numa_info to retrieve distance info from.
*/
- if (src == dst) {
- distance_table[i++] = NUMA_DISTANCE_MIN;
- continue;
+ distance_table[i] = numa_info[src].distance[dst];
+ if (distance_table[i] == 0) {
+ /*
+ * In case QEMU adds a default NUMA single node when the user
+ * did not add any, or where the user did not supply distances,
+ * the value will be 0 here. Populate the table with a fallback
+ * simple local / remote distance.
+ */
+ if (src == dst) {
+ distance_table[i] = NUMA_DISTANCE_MIN;
+ } else {
+ distance_table[i] = numa_info[src].distance[dst];
+ if (distance_table[i] < NUMA_DISTANCE_MIN) {
+ distance_table[i] = NUMA_DISTANCE_DEFAULT;
+ }
+ }
}
-
- distance_table[i++] = numa_info[src].distance[dst];
+ i++;
}
}