From d95c3e318f5f4c31cd17f5dedcb604cfe973ce74 Mon Sep 17 00:00:00 2001 From: Andrew Lukoshko Date: Thu, 21 Aug 2025 16:45:04 +0000 Subject: [PATCH] Add RISC-V support from openEuler --- 0001-Add-RISC-V-support.patch | 107 ++++++++++++++++++++++++++++++++++ vdo.spec | 8 ++- 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 0001-Add-RISC-V-support.patch diff --git a/0001-Add-RISC-V-support.patch b/0001-Add-RISC-V-support.patch new file mode 100644 index 0000000..1c3cf16 --- /dev/null +++ b/0001-Add-RISC-V-support.patch @@ -0,0 +1,107 @@ +From 8766d2b8f8e57f0d27200e3393a1e31f08c1fab9 Mon Sep 17 00:00:00 2001 +From: Andrew Lukoshko +Date: Thu, 21 Aug 2025 16:39:49 +0000 +Subject: [PATCH] Add RISC-V support + +--- + utils/uds/Makefile | 6 +++++- + utils/uds/linux/atomic.h | 6 ++++++ + utils/uds/linux/cache.h | 2 +- + utils/vdo/Makefile | 6 +++++- + 4 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/utils/uds/Makefile b/utils/uds/Makefile +index d12df61..4f91733 100644 +--- a/utils/uds/Makefile ++++ b/utils/uds/Makefile +@@ -30,6 +30,10 @@ ifeq ($(origin CC), default) + CC := gcc + endif + ++ifeq ($(filter riscv64%,$(MAKE_HOST)),) ++ Wcast-align = -Wcast-align ++endif ++ + ifeq ($(findstring clang, $(CC)),clang) + # Ignore additional warnings for clang + WARNS = -Wno-compare-distinct-pointer-types \ +@@ -38,7 +42,7 @@ ifeq ($(findstring clang, $(CC)),clang) + -Wno-implicit-const-int-float-conversion \ + -Wno-language-extension-token + else +- WARNS = -Wcast-align \ ++ WARNS = $(Wcast-align) \ + -Wcast-qual \ + -Wformat=2 \ + -Wlogical-op +diff --git a/utils/uds/linux/atomic.h b/utils/uds/linux/atomic.h +index af2b765..31b5ec0 100644 +--- a/utils/uds/linux/atomic.h ++++ b/utils/uds/linux/atomic.h +@@ -98,6 +98,8 @@ static inline void smp_mb(void) + __asm__ __volatile__("fence rw,rw" : : : "memory"); + #elif defined __loongarch64 + __asm__ __volatile__("dbar 0" : : : "memory"); ++#elif defined __riscv ++ __asm__ __volatile__("fence rw,rw" : : : "memory"); + #else + #error "no fence defined" + #endif +@@ -127,6 +129,8 @@ static inline void smp_rmb(void) + __asm__ __volatile__("fence r,r" : : : "memory"); + #elif defined __loongarch64 + __asm__ __volatile__("dbar 0" : : : "memory"); ++#elif defined __riscv ++ __asm__ __volatile__("fence r,r" : : : "memory"); + #else + #error "no fence defined" + #endif +@@ -156,6 +160,8 @@ static inline void smp_wmb(void) + __asm__ __volatile__("fence w,w" : : : "memory"); + #elif defined __loongarch64 + __asm__ __volatile__("dbar 0" : : : "memory"); ++#elif defined __riscv ++ __asm__ __volatile__("fence w,w" : : : "memory"); + #else + #error "no fence defined" + #endif +diff --git a/utils/uds/linux/cache.h b/utils/uds/linux/cache.h +index cd32a5b..9155c8f 100644 +--- a/utils/uds/linux/cache.h ++++ b/utils/uds/linux/cache.h +@@ -15,7 +15,7 @@ + #define L1_CACHE_BYTES 128 + #elif defined(__s390x__) + #define L1_CACHE_BYTES 256 +-#elif defined(__x86_64__) || defined(__aarch64__) || defined(__riscv) || defined (__loongarch64) ++#elif defined(__x86_64__) || defined(__aarch64__) || defined(__riscv) || defined (__loongarch64) || defined(__riscv) + #define L1_CACHE_BYTES 64 + #else + #error "unknown cache line size" +diff --git a/utils/vdo/Makefile b/utils/vdo/Makefile +index d9f6587..5474595 100644 +--- a/utils/vdo/Makefile ++++ b/utils/vdo/Makefile +@@ -30,6 +30,10 @@ ifeq ($(origin CC), default) + CC := gcc + endif + ++ifeq ($(filter riscv64%,$(MAKE_HOST)),) ++ Wcast-align = -Wcast-align ++endif ++ + ifeq ($(findstring clang, $(CC)),clang) + # Ignore additional warnings for clang + WARNS = -Wno-compare-distinct-pointer-types \ +@@ -38,7 +42,7 @@ ifeq ($(findstring clang, $(CC)),clang) + -Wno-implicit-const-int-float-conversion \ + -Wno-language-extension-token + else +- WARNS = -Wcast-align \ ++ WARNS = $(Wcast-align) \ + -Wcast-qual \ + -Wformat=2 \ + -Wlogical-op +-- +2.43.7 + diff --git a/vdo.spec b/vdo.spec index 7eb5947..a3170c4 100755 --- a/vdo.spec +++ b/vdo.spec @@ -1,12 +1,15 @@ Summary: Management tools for Virtual Data Optimizer Name: vdo Version: 8.3.0.72 -Release: 1%{?dist} +Release: 1%{?dist}.alma.1 License: GPL-2.0-only URL: https://github.com/dm-vdo/vdo Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# AlmaLinux Patch +Patch1001: 0001-Add-RISC-V-support.patch + %if 0%{?fedora} ExcludeArch: %{ix86} %endif @@ -93,6 +96,9 @@ This package provides the user-space support tools for VDO. %{_mandir}/man8/vdorecover.8* %changelog +* Thu Aug 21 2025 Andrew Lukoshko - 8.3.0.72-1.alma.1 +- Add RISC-V support from openEuler + * Thu Oct 17 2024 - Chung Chung - 8.3.0.72-1 - Update to 8.3.0.72 Resolves: RHEL-62965