[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 12/21] tools/libxl: Create 'distance-map' node in DomU Device Tree


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Sun, 24 May 2026 09:02:00 +0900
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S12V8T/HbwUmUQrI5N20DCLbZwR54rjOcdi8RLCVn58=; b=DEB0YtRfWHO45kRwzwFa+xLImZeBmpuADRs+/JNzjp131yfGOlDO0iy0AD06b+Sp28X3ZHAEHQcfIYtmZ9XqJHkqnh4LTCPjNJv7X0d95XON66KCMdznweuzspgylBkj84mAtN6uotsbwxL5kwySG4v55/dUKwyHGJD032rloC5AQZmFKeOWGs8yoOSzHQUqwTc2nRF4WVJx+GfBYQkJuCXLOccOKzfXBryLuoEuQtZXmxCfbTSiDpIYx1A0Djrr+h5B0V/hDHWB3pzNbW9S68SepjCtSO08+gYCmATHbp07GWTWBTELavOJ9AOtd47nu+suNJwL0tSde9MRaNFZGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fIlEJq03wx5ft4hA/+UL5FvA4TmFRUw7qrztsKK4Xgf301nUaU/marw1kY3P1FezCAMMVXd+kAuYJTHubNul41KDFxs/vnQzzgHJtJJt4nv69dbV+L4AD5bEiBvBP1TkNCsWlFjx36OlFBGcyI57FVFR32whHVO622Zvje5OHGu1vC3/4MjIl114/HnzUJXnN/+Fd8HmkCTLMwC/s0pxunq1TiAbiSYQ6keN7a2hvIv+fDC+Rrx++3KBxeckidiupwfyghpw6mLUH16HX4LFot2uGWuqDONW+00zNfKfo+ngOCJI+lB1rJ4feHNZ+QmUOUy6MHHxTYVG+dsLcLSZkA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, michal.orzel@xxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, roger.pau@xxxxxxxxxx, sstabellini@xxxxxxxxxx, jgross@xxxxxxxx, bertrand.marquis@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, dfaggioli@xxxxxxxx, gwd@xxxxxxxxxxxxxx, Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Delivery-date: Sun, 24 May 2026 00:02:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Create the 'distance-map' node in the Device Tree passed to DomU.
This information is retrieved from the virtual NUMA configuration
in the xl domain configuration file.
---
 tools/libs/light/libxl_arm.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 05d0f18e1a..d2b505fd43 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -769,6 +769,39 @@ static int make_memory_nodes(libxl__gc *gc, void *fdt,
     return 0;
 }
 
+static int make_numa_distance_map(libxl__gc *gc, void *fdt,
+                                  const libxl_domain_build_info *b_info)
+{
+    int i, j;
+    uint32_t *matrix;
+    int nr_nodes = b_info->num_vnuma_nodes;
+    int idx = 0;
+    int res;
+
+    if (nr_nodes == 0) return 0;
+
+    res = fdt_begin_node(fdt, "distance-map");
+    if (res) return res;
+
+    res = fdt_property_string(fdt, "compatible", "numa-distance-map-v1");
+    if (res) return res;
+
+    matrix = libxl__malloc(gc, sizeof(uint32_t) * nr_nodes * nr_nodes * 3);
+
+    for (i = 0; i < nr_nodes; i++) {
+        for (j = 0; j < nr_nodes; j++) {
+            matrix[idx++] = cpu_to_fdt32(i);
+            matrix[idx++] = cpu_to_fdt32(j);
+            matrix[idx++] = cpu_to_fdt32(b_info->vnuma_nodes[i].distances[j]);
+        }
+    }
+
+    res = fdt_property(fdt, "distance-matrix", matrix, sizeof(uint32_t) * idx);
+    if (res) return res;
+
+    return fdt_end_node(fdt);
+}
+
 static int make_gicv2_node(libxl__gc *gc, void *fdt,
                            uint64_t gicd_base, uint64_t gicd_size,
                            uint64_t gicc_base, uint64_t gicc_size)
@@ -1438,6 +1471,8 @@ next_resize:
 
         FDT( make_memory_nodes(gc, fdt, info, dom) );
 
+        FDT( make_numa_distance_map(gc, fdt, info) );
+
         switch (info->arch_arm.gic_version) {
         case LIBXL_GIC_VERSION_V2:
             FDT( make_gicv2_node(gc, fdt,
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.