diff --git a/add-riscv64-support-for-papi.patch b/add-riscv64-support-for-papi.patch new file mode 100644 index 0000000000000000000000000000000000000000..626ec6c79db0f68e0033a6ff75cbd1b433e30390 --- /dev/null +++ b/add-riscv64-support-for-papi.patch @@ -0,0 +1,74 @@ +diff -ruN a/src/configure b/src/configure +--- a/src/configure 2023-12-20 14:08:12.000000000 -0500 ++++ b/src/configure 2025-05-07 02:59:44.268821712 -0400 +@@ -4952,7 +4952,7 @@ + + # First set pthread-mutexes based on arch + case $arch in +- aarch64|arm*|parisc*) ++ aarch64|arm*|parisc*|riscv*) + pthread_mutexes=yes + CFLAGS="$CFLAGS -DUSE_PTHREAD_MUTEXES" + echo "forcing use of pthread mutexes... " >&6 +diff -ruN a/src/configure.in b/src/configure.in +--- a/src/configure.in 2023-12-20 14:08:12.000000000 -0500 ++++ b/src/configure.in 2025-05-07 02:59:44.268821712 -0400 +@@ -552,7 +552,7 @@ + + # First set pthread-mutexes based on arch + case $arch in +- aarch64|arm*|parisc*) ++ aarch64|arm*|parisc*|riscv*) + pthread_mutexes=yes + CFLAGS="$CFLAGS -DUSE_PTHREAD_MUTEXES" + echo "forcing use of pthread mutexes... " >&6 +diff -ruN a/src/libpfm4/config.mk b/src/libpfm4/config.mk +--- a/src/libpfm4/config.mk 2023-12-20 14:08:12.000000000 -0500 ++++ b/src/libpfm4/config.mk 2025-05-07 02:59:44.268821712 -0400 +@@ -177,6 +177,9 @@ + CONFIG_PFMLIB_CELL=y + endif + ++ifeq ($(ARCH),riscv64) ++CONFIG_PFMLIB_ARCH_RISCV64=y ++endif + + # + # you shouldn't have to touch anything beyond this point +diff -ruN a/src/linux-context.h b/src/linux-context.h +--- a/src/linux-context.h 2025-05-07 02:58:47.758508693 -0400 ++++ b/src/linux-context.h 2025-05-07 03:07:06.351270468 -0400 +@@ -43,6 +43,8 @@ + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_pc + #elif defined(__hppa__) + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_iaoq[0] ++#elif defined(__riscv) ++#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.__gregs[REG_PC] + #else + #error "OVERFLOW_ADDRESS() undefined!" + #endif +diff -ruN a/src/linux-timer.c b/src/linux-timer.c +--- a/src/linux-timer.c 2025-05-07 02:58:47.758508693 -0400 ++++ b/src/linux-timer.c 2025-05-07 02:59:44.278821767 -0400 +@@ -310,7 +310,7 @@ + return retval; + } + +-#elif (defined(__arm__) || defined(__mips__) || defined(__hppa__)) ++#elif (defined(__arm__) || defined(__mips__) || defined(__hppa__) || defined(__riscv)) + static inline long long + get_cycles( void ) + { +diff -ruN a/src/mb.h b/src/mb.h +--- a/src/mb.h 2025-05-07 02:58:47.758508693 -0400 ++++ b/src/mb.h 2025-05-07 03:07:48.791505550 -0400 +@@ -42,6 +42,9 @@ + #elif defined(__aarch64__) + #define rmb() asm volatile("dmb ld" ::: "memory") + ++#elif defined(__riscv) ++#define rmb() asm volatile("fence ir, ir" ::: "memory") ++ + #elif defined(__loongarch__) + #define rmb() asm volatile("dbar 0" ::: "memory") + diff --git a/papi.spec b/papi.spec index 3b48c1174f9d287de53839be0307b4de42fb6d26..522ce0a6db9697ecc8a0d9a5d4f656ffeced92a1 100644 --- a/papi.spec +++ b/papi.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 # Default to no static libraries %{!?with_static: %global with_static 0} @@ -22,6 +22,7 @@ Patch3: papi-libsde.patch Patch1001: 1001-add-loongarch64-support-for-papi.patch Patch1002: papi-7.0.1-support-sw.patch +Patch1003: add-riscv64-support-for-papi.patch Requires: papi-libs = %{version}-%{release} BuildRequires: make @@ -106,6 +107,7 @@ The %{name}-doc package contains documentation files for %{name}. %patch3 -p1 -b .flags %patch1001 -p1 %patch1002 -p1 +%patch1003 -p1 %build @@ -223,6 +225,9 @@ find %{buildroot} -type f -executable ! -iname "*.py" ! -iname "*.sh" | xargs ch %doc INSTALL.txt README.md RELEASENOTES.txt %changelog +* Wed May 7 2025 Yihao Yan - 7.1.0-3 +- add support for riscv64 + * Wed Apr 2 2025 chaodong - 7.0.1-2 - support sw, papi-7.0.1-support-sw.patch