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

[XEN RFC PATCH 21/40] xen/arm: introduce device_tree_numa as a switch for device tree NUMA


  • To: <wei.chen@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, <jbeulich@xxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Wed, 11 Aug 2021 18:24:04 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C7gc62amk+AdDN6sirEJxKpJ++i0p773bONvwikpyjY=; b=BNMxZtmhrMlNsgYDtcFAvgHl2i7SAytbzm7cpXvTj4DvPBw99qON4QrgAFk5jUzNLw9VMsirXyaGGmdN2cF/zqI6OGkQJwLEEL2hUdQEXXBF88FPEc1Lf7zNIPpLotg8KIRRQhaOyrtU8PawATfHEcO/rX/oqOqTZZWc80/2hTyIE3zFxsmAXhffWiIaCwVFTYZ2DnYdMEyBmWqx3nAKzyWzYHpi/LZzZ8WAA6ESHy13te9jxf3at4ixoI80ULWtKlK26zJHcPbgyoEOFNB5O2GjVQzp+OufCLfaNZs5wCRz1Qk68ilYNrPeTqC2bsvGMxl9DirYtwVKShewcXYn0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqLFEiskTVOKDvjS+Tmi08Qn97Vx2tQv3bZkcd2BJn3YJzL1QWMjyvIO+zJ4e8e6W73vMFzUdxvxFRTzJWI1eZPMANwZUTTsrT4XpTzQTsGHWTFdYxYjUdmh5eMW9ULPZkHCmF+/2C6RZu5l9NlIu9tT4EtIYHvDBYUlkS1JgeXC6Exr3aoeuGhQhli4QCdB3Yk0ZaFWQZglKufX9uBqjtinyjF7F3nGKD7Ig3Q+vwkXaEgOXz44919JVC0Ag6LVG/544wDsvO9Rtgfxe3whLgcMSYqm2MPWgnhX56LWV1fG95eXMkWO9WHyqaKjRjEooJ9KAr+GOPBa7TGyICFykQ==
  • Cc: <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Wed, 11 Aug 2021 10:31:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

Like acpi_numa in x86 as a switch for ACPI based NUMA, we introduce
device_tree_numa as a switch for Arm device tree based NUMA. When
NUMA information in device tree is invalid, this switch will be set
to -1, then NUMA support for Arm will be disabled, even if user set
numa_off=0.

Keep using bad_srat and srat_disabled functions name, because we will
reuse node_covers_memory and acpi_scan_nodes code for Arm. These
functions are using these two API names. And, as device tree can be
treated as one kind of static resource table. So we keep these two
function names.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
 xen/arch/arm/Makefile           |  1 +
 xen/arch/arm/numa_device_tree.c | 35 +++++++++++++++++++++++++++++++++
 xen/include/asm-arm/numa.h      |  2 ++
 3 files changed, 38 insertions(+)
 create mode 100644 xen/arch/arm/numa_device_tree.c

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 6e3fb8033e..13e1549be0 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -36,6 +36,7 @@ obj-y += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
 obj-$(CONFIG_NUMA) += numa.o
+obj-$(CONFIG_DEVICE_TREE_NUMA) += numa_device_tree.o
 obj-y += p2m.o
 obj-y += percpu.o
 obj-y += platform.o
diff --git a/xen/arch/arm/numa_device_tree.c b/xen/arch/arm/numa_device_tree.c
new file mode 100644
index 0000000000..1c74ad135d
--- /dev/null
+++ b/xen/arch/arm/numa_device_tree.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Arm Architecture support layer for NUMA.
+ *
+ * Copyright (C) 2021 Arm Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <xen/init.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
+
+s8 device_tree_numa = 0;
+
+int srat_disabled(void)
+{
+    return numa_off || device_tree_numa < 0;
+}
+
+void __init bad_srat(void)
+{
+    printk(KERN_ERR "DT: NUMA information is not used.\n");
+    device_tree_numa = -1;
+}
diff --git a/xen/include/asm-arm/numa.h b/xen/include/asm-arm/numa.h
index 559b028a01..756ad82d07 100644
--- a/xen/include/asm-arm/numa.h
+++ b/xen/include/asm-arm/numa.h
@@ -23,6 +23,8 @@ typedef u8 nodeid_t;
 #define NUMA_LOCAL_DISTANCE     10
 #define NUMA_REMOTE_DISTANCE    20
 
+extern s8 device_tree_numa;
+
 extern void numa_init(bool acpi_off);
 extern void numa_set_distance(nodeid_t from, nodeid_t to, uint32_t distance);
 
-- 
2.25.1




 


Rackspace

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