Add RISC-V support from openEuler

This commit is contained in:
Andrew Lukoshko 2025-08-21 16:45:04 +00:00 committed by root
parent 768ab6218f
commit d95c3e318f
2 changed files with 114 additions and 1 deletions

View File

@ -0,0 +1,107 @@
From 8766d2b8f8e57f0d27200e3393a1e31f08c1fab9 Mon Sep 17 00:00:00 2001
From: Andrew Lukoshko <alukoshko@almalinux.org>
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

View File

@ -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 <alukoshko@almalinux.org> - 8.3.0.72-1.alma.1
- Add RISC-V support from openEuler
* Thu Oct 17 2024 - Chung Chung <cchung@redhat.com> - 8.3.0.72-1
- Update to 8.3.0.72
Resolves: RHEL-62965