diff --git a/0002-add-riscv64-support-for-papi.patch b/0002-add-riscv64-support-for-papi.patch new file mode 100644 index 0000000000000000000000000000000000000000..f13530e7f559354180e56b7ced55c1591f13fee0 --- /dev/null +++ b/0002-add-riscv64-support-for-papi.patch @@ -0,0 +1,98 @@ +From 8467f9cfe483bf4d0c14c1fba200cb6fb429f996 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Fri, 23 Sep 2022 09:42:45 +0300 +Subject: [PATCH] Add initial support for riscv64 + +Signed-off-by: David Abdurachmanov +--- + src/configure | 2 +- + src/configure.in | 2 +- + src/libpfm4/config.mk | 3 +++ + src/linux-context.h | 2 ++ + src/linux-timer.c | 2 +- + src/mb.h | 3 +++ + 6 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/configure b/src/configure +index fb18bf4..4f5ab04 100755 +--- a/src/configure ++++ b/src/configure +@@ -4709,7 +4709,7 @@ _ACEOF + + # 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 --git a/src/configure.in b/src/configure.in +index f78cca2..9b4ae9f 100644 +--- a/src/configure.in ++++ b/src/configure.in +@@ -410,7 +410,7 @@ AC_DEFINE_UNQUOTED(CPU,$CPU,[cpu type]) + + # 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 --git a/src/libpfm4/config.mk b/src/libpfm4/config.mk +index daa982e..8e8e482 100644 +--- a/src/libpfm4/config.mk ++++ b/src/libpfm4/config.mk +@@ -177,6 +177,9 @@ ifeq ($(ARCH),cell) + 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 --git a/src/linux-context.h b/src/linux-context.h +index 858c4e9..de52ee4 100644 +--- a/src/linux-context.h ++++ b/src/linux-context.h +@@ -37,6 +37,8 @@ typedef ucontext_t hwd_ucontext_t; + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.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 --git a/src/linux-timer.c b/src/linux-timer.c +index 71b4aa0..97dfc53 100644 +--- a/src/linux-timer.c ++++ b/src/linux-timer.c +@@ -281,7 +281,7 @@ static inline long long get_cycles() + 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 --git a/src/mb.h b/src/mb.h +index 1019691..0b82a9d 100644 +--- a/src/mb.h ++++ b/src/mb.h +@@ -39,6 +39,9 @@ + #elif defined(__aarch64__) + #define rmb() asm volatile("dmb ld" ::: "memory") + ++#elif defined(__riscv) ++#define rmb() asm volatile("fence ir, ir" ::: "memory") ++ + #elif defined(__mips__) + #define rmb() asm volatile( \ + ".set mips2\n\t" \ +-- +2.35.1 + diff --git a/papi.spec b/papi.spec index 773566710a4393cb56ac66c949149462769b8583..9962c4db4700eb46bebccd4984b6a096f6e99e47 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} @@ -18,6 +18,7 @@ Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.g Patch1: papi-python3.patch Patch2: papi-nostatic.patch Patch3: 0001-add-loongarch64-support-for-papi.patch +Patch4: 0002-add-riscv64-support-for-papi.patch Requires: papi-libs = %{version}-%{release} BuildRequires: make @@ -95,7 +96,14 @@ The %{name}-doc package contains documentation files for %{name}. %setup -q %patch1 -p1 -b .python3 %patch2 -p1 + +%ifarch loongarch64 %patch3 -p1 +%endif + +%ifarch riscv64 +%patch4 -p1 +%endif %build @@ -213,6 +221,10 @@ find %{buildroot} -type f -executable ! -iname "*.py" ! -iname "*.sh" | xargs ch %doc INSTALL.txt README.md RELEASENOTES.txt %changelog +* Wed Oct 11 2023 Guoguo - 7.0.1-3 +- add riscv64 support for papi +- Patch from http://fedora.riscv.rocks:3000/rpms/papi/raw/commit/9cf9703cd1e31597fc7b1ae141acf8f4c9a39dca/0001-Add-initial-support-for-riscv64.patch + * Tue Oct 10 2023 Wenlong Zhang - 7.0.1-2 - add loongarch64 support for papi - disable generate_compatibility_deps to fix build timeout