64 lines
1.8 KiB
Diff
64 lines
1.8 KiB
Diff
From 762363d2cb5de264973f08453279400cd570935c Mon Sep 17 00:00:00 2001
|
|
From: David Abdurachmanov <davidlt@rivosinc.com>
|
|
Date: Thu, 21 Aug 2025 15:47:31 +0000
|
|
Subject: [PATCH] Add support for riscv64
|
|
|
|
Signed-off-by: Andrew Lukoshko <alukoshko@almalinux.org>
|
|
---
|
|
Makefile | 11 ++++++++++-
|
|
src/stalld.h | 2 +-
|
|
2 files changed, 11 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index 2027791..e70d8e0 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -33,6 +33,11 @@ ifeq ($(ARCH),powerpc)
|
|
USE_BPF := 0
|
|
MTUNE := -mtune=powerpc
|
|
endif
|
|
+ifeq ($(ARCH),riscv64)
|
|
+FCF_PROTECTION := "-fcf-protection=none"
|
|
+M64 :=
|
|
+MTUNE := -mtune=generic-ooo
|
|
+endif
|
|
|
|
$(info USE_BPF=$(USE_BPF))
|
|
$(info FCF_PROTECTION=$(FCF_PROTECTION))
|
|
@@ -134,6 +139,10 @@ endif
|
|
ifeq ($(ARCH),s390x)
|
|
CLANGARCH=-D__s390x__
|
|
endif
|
|
+ifeq ($(ARCH),riscv64)
|
|
+CLANGARCH="-D__riscv"
|
|
+CLANGFLAGS="-D__riscv_xlen=64"
|
|
+endif
|
|
|
|
.PHONY: all tests
|
|
|
|
@@ -154,7 +163,7 @@ bpf/vmlinux.h:
|
|
# The .bpf.c needs to be transformed into the .bpf.o.
|
|
# The .bpf.o is then required to build the .skel.h.
|
|
bpf/stalld.bpf.o: bpf/vmlinux.h bpf/stalld.bpf.c
|
|
- @$(CLANG) -g -O2 -target bpf $(CLANGARCH) -DDEBUG_STALLD=$(DEBUG) -D__TARGET_ARCH_$(ARCH) \
|
|
+ @$(CLANG) -g -O2 -target bpf $(CLANGARCH) $(CLANGFLAGS) -DDEBUG_STALLD=$(DEBUG) -D__TARGET_ARCH_$(ARCH) \
|
|
$(INCLUDES) $(CLANG_BPF_SYS_INCLUDES) -c $(filter %.c,$^) -o $@
|
|
@$(LLVM_STRIP) -g $@ # strip useless DWARF info
|
|
|
|
diff --git a/src/stalld.h b/src/stalld.h
|
|
index 68a89a0..1350bb8 100644
|
|
--- a/src/stalld.h
|
|
+++ b/src/stalld.h
|
|
@@ -122,7 +122,7 @@ struct stalld_backend {
|
|
#elif __arm__
|
|
# define __NR_sched_setattr 380
|
|
# define __NR_sched_getattr 381
|
|
-#elif __aarch64__ || __loongarch64
|
|
+#elif __aarch64__ || __loongarch64 || __riscv
|
|
# define __NR_sched_setattr 274
|
|
# define __NR_sched_getattr 275
|
|
#elif __powerpc__
|
|
--
|
|
2.43.7
|
|
|