mcst-linux-kernel/patches-2024.06.26/ucx-1.9.0/0011-Additional-porting-for...

218 lines
5.6 KiB
Diff

From 7e95752437e800b435f3dedcf65b6ea1bc317237 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: Wed, 4 Nov 2020 23:02:54 +0300
Subject: [PATCH] Additional porting for 1.8.1 version
---
src/ucs/Makefile.am | 5 +++++
src/ucs/arch/cpu.c | 5 +++++
src/ucs/arch/cpu.h | 1 +
src/ucs/arch/e2k/cpu.h | 32 ++++++++++++++++++++++++++++++++
src/ucs/arch/e2k/global_opts.c | 24 ++++++++++++++++++++++++
src/ucs/arch/e2k/global_opts.h | 23 +++++++++++++++++++++++
src/ucs/arch/global_opts.h | 2 ++
src/ucs/sys/sock.c | 2 +-
8 files changed, 93 insertions(+), 1 deletion(-)
create mode 100644 src/ucs/arch/e2k/global_opts.c
create mode 100644 src/ucs/arch/e2k/global_opts.h
diff --git a/src/ucs/Makefile.am b/src/ucs/Makefile.am
index 2bd0a8d..c3c761f 100644
--- a/src/ucs/Makefile.am
+++ b/src/ucs/Makefile.am
@@ -58,6 +58,7 @@ nobase_dist_libucs_la_HEADERS = \
arch/x86_64/global_opts.h \
arch/aarch64/global_opts.h \
arch/ppc64/global_opts.h \
+ arch/e2k/global_opts.h \
arch/global_opts.h
noinst_HEADERS = \
@@ -67,6 +68,9 @@ noinst_HEADERS = \
arch/generic/cpu.h \
arch/ppc64/bitops.h \
arch/ppc64/cpu.h \
+ arch/e2k/bitops.h \
+ arch/e2k/cpu.h \
+ arch/e2k/atomic.h \
arch/x86_64/atomic.h \
arch/x86_64/bitops.h \
arch/x86_64/cpu.h \
@@ -110,6 +114,7 @@ libucs_la_SOURCES = \
arch/aarch64/global_opts.c \
arch/ppc64/timebase.c \
arch/ppc64/global_opts.c \
+ arch/e2k/global_opts.c \
arch/x86_64/cpu.c \
arch/x86_64/global_opts.c \
arch/cpu.c \
diff --git a/src/ucs/arch/cpu.c b/src/ucs/arch/cpu.c
index e81f540..ee210b3 100644
--- a/src/ucs/arch/cpu.c
+++ b/src/ucs/arch/cpu.c
@@ -54,6 +54,10 @@ const ucs_cpu_builtin_memcpy_t ucs_cpu_builtin_memcpy[UCS_CPU_VENDOR_LAST] = {
.min = UCS_MEMUNITS_INF,
.max = UCS_MEMUNITS_INF
},
+ [UCS_CPU_VENDOR_GENERIC_E2K] = {
+ .min = UCS_MEMUNITS_INF,
+ .max = UCS_MEMUNITS_INF
+ },
[UCS_CPU_VENDOR_GENERIC_PPC] = {
.min = UCS_MEMUNITS_INF,
.max = UCS_MEMUNITS_INF
@@ -65,6 +69,7 @@ const size_t ucs_cpu_est_bcopy_bw[UCS_CPU_VENDOR_LAST] = {
[UCS_CPU_VENDOR_INTEL] = 5800 * UCS_MBYTE,
[UCS_CPU_VENDOR_AMD] = 5008 * UCS_MBYTE,
[UCS_CPU_VENDOR_GENERIC_ARM] = 5800 * UCS_MBYTE,
+ [UCS_CPU_VENDOR_GENERIC_E2K] = 5800 * UCS_MBYTE,
[UCS_CPU_VENDOR_GENERIC_PPC] = 5800 * UCS_MBYTE,
[UCS_CPU_VENDOR_FUJITSU_ARM] = 5800 * UCS_MBYTE
};
diff --git a/src/ucs/arch/cpu.h b/src/ucs/arch/cpu.h
index a2c6a61..1d63c01 100644
--- a/src/ucs/arch/cpu.h
+++ b/src/ucs/arch/cpu.h
@@ -58,6 +58,7 @@ typedef enum ucs_cpu_vendor {
UCS_CPU_VENDOR_GENERIC_ARM,
UCS_CPU_VENDOR_GENERIC_PPC,
UCS_CPU_VENDOR_FUJITSU_ARM,
+ UCS_CPU_VENDOR_GENERIC_E2K,
UCS_CPU_VENDOR_LAST
} ucs_cpu_vendor_t;
diff --git a/src/ucs/arch/e2k/cpu.h b/src/ucs/arch/e2k/cpu.h
index 37caea5..658af62 100644
--- a/src/ucs/arch/e2k/cpu.h
+++ b/src/ucs/arch/e2k/cpu.h
@@ -12,6 +12,11 @@
#include <string.h>
#include <stdint.h>
+#include <ucs/sys/compiler.h>
+#include <ucs/type/status.h>
+#include <ucs/sys/compiler_def.h>
+#include <ucs/arch/generic/cpu.h>
+
BEGIN_C_DECLS
#define UCS_ARCH_CACHE_LINE_SIZE 64
@@ -62,15 +67,42 @@ static inline ucs_cpu_model_t ucs_arch_get_cpu_model()
return UCS_CPU_MODEL_UNKNOWN;
}
+static inline ucs_cpu_vendor_t ucs_arch_get_cpu_vendor()
+{
+ return UCS_CPU_VENDOR_GENERIC_E2K;
+}
+
static inline int ucs_arch_get_cpu_flag()
{
return UCS_CPU_FLAG_UNKNOWN;
}
+static inline void ucs_cpu_init()
+{
+}
+
+#define ucs_arch_wait_mem ucs_arch_generic_wait_mem
+
static inline void ucs_arch_clear_cache(void *start, void *end) {
// TODO
}
+static inline void *ucs_memcpy_relaxed(void *dst, const void *src, size_t len)
+{
+ return memcpy(dst, src, len);
+}
+
+static UCS_F_ALWAYS_INLINE void
+ucs_memcpy_nontemporal(void *dst, const void *src, size_t len)
+{
+ memcpy(dst, src, len);
+}
+
+static inline ucs_status_t ucs_arch_get_cache_size(size_t *cache_sizes)
+{
+ return UCS_ERR_UNSUPPORTED;
+}
+
END_C_DECLS
diff --git a/src/ucs/arch/e2k/global_opts.c b/src/ucs/arch/e2k/global_opts.c
new file mode 100644
index 0000000..65d6ac8
--- /dev/null
+++ b/src/ucs/arch/e2k/global_opts.c
@@ -0,0 +1,24 @@
+/**
+* Copyright (C) 2020. ALL RIGHTS RESERVED.
+*
+* See file LICENSE for terms.
+*/
+
+#if defined(__e2k__)
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <ucs/arch/global_opts.h>
+#include <ucs/config/parser.h>
+
+ucs_config_field_t ucs_arch_global_opts_table[] = {
+ {NULL}
+};
+
+void ucs_arch_print_memcpy_limits(ucs_arch_global_opts_t *config)
+{
+}
+
+#endif
diff --git a/src/ucs/arch/e2k/global_opts.h b/src/ucs/arch/e2k/global_opts.h
new file mode 100644
index 0000000..28b43b5
--- /dev/null
+++ b/src/ucs/arch/e2k/global_opts.h
@@ -0,0 +1,23 @@
+/**
+* Copyright (C) 2020. ALL RIGHTS RESERVED.
+*
+* See file LICENSE for terms.
+*/
+
+#ifndef UCS_E2K_GLOBAL_OPTS_H_
+#define UCS_E2K_GLOBAL_OPTS_H_
+
+#include <ucs/sys/compiler_def.h>
+
+BEGIN_C_DECLS
+
+#define UCS_ARCH_GLOBAL_OPTS_INITALIZER {}
+
+/* built-in memcpy config */
+typedef struct ucs_arch_global_opts {
+ char dummy;
+} ucs_arch_global_opts_t;
+
+END_C_DECLS
+
+#endif
diff --git a/src/ucs/arch/global_opts.h b/src/ucs/arch/global_opts.h
index 8786f13..589a759 100644
--- a/src/ucs/arch/global_opts.h
+++ b/src/ucs/arch/global_opts.h
@@ -15,6 +15,8 @@
# include "ppc64/global_opts.h"
#elif defined(__aarch64__)
# include "aarch64/global_opts.h"
+#elif defined(__e2k__)
+# include "e2k/global_opts.h"
#else
# error "Unsupported architecture"
#endif
--
2.28.0