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

[PATCH v2 15/24] tools/libxl: Create 'distance-map' node in DomU Device Tree


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Mon, 1 Jun 2026 07:47:45 +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=5vjE+i4Pyy0yY3FTsKfqjfjpLb47e4a4LegkVylR5Ng=; b=zA5o2bPkcmTKsU9gkrdgUO3ALTwvk/L0G2gxYBtoBXKqZP1kXhigfTtnDnsuqPFswmHdmwtL8waDOaLnwnY6FA6CAYu1WCHVCb8FVpbkFsnwMBdB3/+6toTFBQc2Ym4cTHFo/f1FYFU85eWYOk7mrV1OmvtZuyAH9/SP1dPVPEGUylIf3Bk06myAOgxzEQpcWx0xyq38bEpSAaqzmJFOLJPVHP9fatskfq0TcKFRi2M6um4x+fnhpN/l03Lt6Tm8CCGey/kWIRGs69pvq7hE0OWpn6gOO8fMQR0x3v9E+KZHH3Jb8Ee/yF6bxrb2uauW2FVAye/k+dHP5ixK8tqqiA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LH645p5Tyh9SuZcgihSaeZL/hM9dbpGypGgpOJuwyo93Lq5E+D2vTH3arZiwhGnUSyzW88MVWaRAmHyYeFnbbsCQPysZFQaoCiqOme1TEQIYDnNsNfaWfjU47iUvEtg+2qPc51BXQxNher1UM2qUAzgLnBouuwksJfNwyBmTbM1cJOY6xn4pQrueoCA9oyH5g+1AYIioo29eZbUt2BoHYYzm3h3zx3KlcOMPoEl3bqzsXBHL/eHIozRFK5SX4QTda0RiK+k4CktZMSjyTZ0Ovu0HNmyRApDbj/a0lknYKkvXNfbGF4GdcMC1Qwdup2qs/oAFyKrfWwFO84oHgZ5Lig==
  • 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: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Sun, 31 May 2026 22:48:36 +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 4b0ed99229..466bee95ad 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -738,6 +738,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)
@@ -1407,6 +1440,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®.