summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorGUI <[email protected]>2024-05-28 14:08:33 +0800
committerGitHub <[email protected]>2024-05-28 14:08:33 +0800
commit6f6b0c3ba0f308bccb5a83fa70ae1200592f13ce (patch)
tree5cada9d72246e42c3fd9a1ee3e3c1e5d8f46c60e /components/drivers/include
parent952f2c43f8a10f815f34307c7d184af8f08011ba (diff)
[DM/feature] Simple NUMA (Non-Uniform Memory Access) (#9000)
For some CPU memory access devices, that the drivers will find memory and CPU affinity to config device. Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/core/numa.h25
-rw-r--r--components/drivers/include/rtdevice.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/core/numa.h b/components/drivers/include/drivers/core/numa.h
new file mode 100644
index 0000000000..e4d35981fb
--- /dev/null
+++ b/components/drivers/include/drivers/core/numa.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-09-24 GuEe-GUI the first version
+ */
+
+#ifndef __RT_DM_NUMA_H__
+#define __RT_DM_NUMA_H__
+
+#include <rthw.h>
+#include <rtthread.h>
+
+#include <bitmap.h>
+
+/* NUMA: Non-Uniform Memory Access */
+
+int rt_numa_cpu_id(int cpuid);
+int rt_numa_device_id(struct rt_device *dev);
+rt_err_t rt_numa_memory_affinity(rt_uint64_t phy_addr, rt_bitmap_t *out_affinity);
+
+#endif /* __RT_DM_NUMA_H__ */
diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h
index afb5bb2533..863e9d8503 100644
--- a/components/drivers/include/rtdevice.h
+++ b/components/drivers/include/rtdevice.h
@@ -41,6 +41,7 @@ extern "C" {
#ifdef RT_USING_DM
#include "drivers/core/dm.h"
+#include "drivers/core/numa.h"
#include "drivers/platform.h"
#ifdef RT_USING_OFW