Skip to content

Commit

Permalink
add loongarch64 support (driver)
Browse files Browse the repository at this point in the history
Signed-off-by: yzewei <[email protected]>
  • Loading branch information
yzewei committed Apr 18, 2024
1 parent 6792229 commit 9458c43
Show file tree
Hide file tree
Showing 15 changed files with 1,000 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cmake/modules/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ else()
ExternalProject_Add(protobuf
PREFIX "${PROJECT_BINARY_DIR}/protobuf-prefix"
DEPENDS zlib
URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-cpp-3.17.3.tar.gz"
URL_HASH "SHA256=51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb"
URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protobuf-cpp-3.20.3.tar.gz"
URL_HASH "SHA256=e51cc8fc496f893e2a48beb417730ab6cbcb251142ad8b2cd1951faa5c76fe3d"
# TODO what if using system zlib?
CONFIGURE_COMMAND CPPFLAGS=-I${ZLIB_INCLUDE} LDFLAGS=-L${ZLIB_SRC} ./configure --with-zlib ${PROTOBUF_CONFIGURE_FLAGS} --prefix=${PROTOBUF_INSTALL_DIR}
BUILD_COMMAND make
Expand Down
5 changes: 4 additions & 1 deletion driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ if((NOT TARGET_ARCH STREQUAL "x86_64") AND
(NOT TARGET_ARCH STREQUAL "aarch64") AND
(NOT TARGET_ARCH STREQUAL "s390x") AND
(NOT TARGET_ARCH STREQUAL "riscv64") AND
(NOT TARGET_ARCH STREQUAL "ppc64le"))
(NOT TARGET_ARCH STREQUAL "ppc64le") AND
(NOT TARGET_ARCH STREQUAL "loongarch64"))
message(WARNING "Target architecture not officially supported by our drivers!")
else()
# Load current kernel version
Expand All @@ -28,6 +29,8 @@ else()
set(kmod_min_kver_map_s390x 2.6)
set(kmod_min_kver_map_riscv64 5.0)
set(kmod_min_kver_map_ppc64le 2.6)
set(kmod_min_kver_map_loongarch64 5.10)

if (LINUX_KERNEL_VERSION VERSION_LESS ${kmod_min_kver_map_${TARGET_ARCH}})
message(WARNING "[KMOD] To run this driver you need a Linux kernel version >= ${kmod_min_kver_map_${TARGET_ARCH}} but actual kernel version is: ${UNAME_RESULT}")
endif()
Expand Down
8 changes: 4 additions & 4 deletions driver/feature_gates.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ or GPL2.txt for full copies of the license.
* been introduced in the following kernel release:
* https://github.com/torvalds/linux/commit/0a16b6075843325dc402edf80c1662838b929aff
*/
#if defined(CONFIG_ARM64) || defined(CONFIG_S390) || defined(CONFIG_RISCV)
#if defined(CONFIG_ARM64) || defined(CONFIG_S390) || defined(CONFIG_RISCV) || defined(CONFIG_LOONGARCH)
#define CAPTURE_SCHED_PROC_FORK
#endif

Expand Down Expand Up @@ -156,7 +156,7 @@ or GPL2.txt for full copies of the license.
// CAPTURE_SCHED_PROC_FORK
///////////////////////////////

#if defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_riscv)
#if defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_riscv) || defined(__TARGET_ARCH_loongarch64)
#define CAPTURE_SCHED_PROC_FORK
#endif

Expand All @@ -178,7 +178,7 @@ or GPL2.txt for full copies of the license.
// CAPTURE_64BIT_ARGS_SINGLE_REGISTER
///////////////////////////////

#if defined(__x86_64__) || defined(__aarch64__)
#if defined(__x86_64__) || defined(__aarch64__) || defined(__loongarch64)
#define CAPTURE_64BIT_ARGS_SINGLE_REGISTER
#endif

Expand Down Expand Up @@ -206,7 +206,7 @@ or GPL2.txt for full copies of the license.
// CAPTURE_SCHED_PROC_FORK
///////////////////////////////

#if defined(__aarch64__) || defined(__s390x__) || defined(__riscv)
#if defined(__aarch64__) || defined(__s390x__) || defined(__riscv) || defined(__loongarch64)
#define CAPTURE_SCHED_PROC_FORK
#endif

Expand Down
2 changes: 2 additions & 0 deletions driver/ppm.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ long ppm_strncpy_from_user(char *to, const char __user *from, unsigned long n);
#define SYSCALL_TABLE_ID0 0
#elif defined CONFIG_RISCV
#define SYSCALL_TABLE_ID0 0
#elif defined CONFIG_LOONGARCH
#define SYSCALL_TABLE_ID0 0
#endif

extern const struct syscall_evt_pair g_syscall_table[];
Expand Down
Loading

0 comments on commit 9458c43

Please sign in to comment.