|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 01/21] xen/device-tree: Initial framework for Device Tree NUMA support
Introduce the initial framework for Device Tree-based NUMA support
on ARM Xen. This patch adds the required Device Tree-dependent
helper functions needed for NUMA configuration. Note that some
functions currently contain stub implementations.
---
xen/common/device-tree/Makefile | 1 +
xen/common/device-tree/numa.c | 24 ++++++++++++++++++++++++
xen/include/xen/bootinfo.h | 14 ++++++++++++++
xen/include/xen/dt-numa.h | 29 +++++++++++++++++++++++++++++
4 files changed, 68 insertions(+)
create mode 100644 xen/common/device-tree/numa.c
create mode 100644 xen/include/xen/dt-numa.h
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index 9036e455d6..fab038d357 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += kernel.o
obj-$(CONFIG_STATIC_EVTCHN) += static-evtchn.init.o
obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
obj-$(CONFIG_STATIC_SHM) += static-shmem.init.o
+obj-$(CONFIG_DEVICE_TREE_NUMA) += numa.o
diff --git a/xen/common/device-tree/numa.c b/xen/common/device-tree/numa.c
new file mode 100644
index 0000000000..06f2c8b102
--- /dev/null
+++ b/xen/common/device-tree/numa.c
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <xen/bootinfo.h>
+#include <xen/device_tree.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/bootfdt.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
+
+#define LOCAL_DISTANCE 10
+#define REMOTE_DISTANCE 20
+
+/*
+ * Get the distance between node 'a' and node 'b'.
+ */
+u8 dt_node_distance(u8 a, u8 b)
+{
+ if ( a != b )
+ return REMOTE_DISTANCE;
+ return LOCAL_DISTANCE;
+}
+
diff --git a/xen/include/xen/bootinfo.h b/xen/include/xen/bootinfo.h
index dbf492c2e3..7923be2b38 100644
--- a/xen/include/xen/bootinfo.h
+++ b/xen/include/xen/bootinfo.h
@@ -6,6 +6,7 @@
#include <xen/kernel.h>
#include <xen/macros.h>
#include <xen/xmalloc.h>
+#include <xen/errno.h>
#define NR_MEM_BANKS 256
#define NR_SHMEM_BANKS 32
@@ -214,4 +215,17 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
void (*cb)(paddr_t ps, paddr_t pe),
unsigned int first);
+static inline int bootinfo_get_ram_range(unsigned int idx, paddr_t *start,
paddr_t *end)
+{
+ struct membanks *mem = bootinfo_get_mem();
+
+ if ( idx >= mem->nr_banks)
+ return -ENOENT;
+
+ *start = mem->bank[idx].start;
+ *end = *start + mem->bank[idx].size;
+
+ return 0;
+}
+
#endif /* XEN_BOOTINFO_H */
diff --git a/xen/include/xen/dt-numa.h b/xen/include/xen/dt-numa.h
new file mode 100644
index 0000000000..721e8955fa
--- /dev/null
+++ b/xen/include/xen/dt-numa.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef XEN_DT_NUMA_H
+#define XEN_DT_NUMA_H
+
+#include <xen/types.h>
+#include <xen/device_tree.h>
+
+static inline unsigned int numa_node_to_dt_nid(u32 n)
+{
+ return n;
+}
+
+#ifdef CONFIG_DEVICE_TREE_NUMA
+
+u8 dt_node_distance(u8 a, u8 b);
+
+#endif /* CONFIG_DEVICE_TREE_NUMA */
+
+#endif /* XEN_DT_NUMA_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |