From d866ac3a8938ebfa9dd28137a339b80068b9887f Mon Sep 17 00:00:00 2001 From: doupengda Date: Tue, 7 Mar 2023 11:27:17 +0800 Subject: [PATCH] Add loongarch64 support --- 0001-Add-loongarch64-support.patch | 66 ++++++++++++++++++++++++++++++ vdo.spec | 12 +++++- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 0001-Add-loongarch64-support.patch diff --git a/0001-Add-loongarch64-support.patch b/0001-Add-loongarch64-support.patch new file mode 100644 index 0000000..cfc9c6d --- /dev/null +++ b/0001-Add-loongarch64-support.patch @@ -0,0 +1,66 @@ +From 249491af07c735d93fc743e413a5304057e43a75 Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Tue, 7 Mar 2023 11:08:46 +0800 +Subject: [PATCH] Add loongarch64 support + +--- + utils/uds/atomicDefs.h | 8 +++++++- + utils/uds/cpu.h | 2 +- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/utils/uds/atomicDefs.h b/utils/uds/atomicDefs.h +index 0aad609..f468369 100644 +--- a/utils/uds/atomicDefs.h ++++ b/utils/uds/atomicDefs.h +@@ -96,6 +96,8 @@ static INLINE void smp_mb(void) + __asm__ __volatile__("bcr 14,0" : : : "memory"); + #elif defined __PPC__ + __asm__ __volatile__("sync" : : : "memory"); ++#elif defined __loongarch64 ++ __asm__ __volatile__("dbar 0" : : : "memory"); + #else + #error "no fence defined" + #endif +@@ -121,6 +123,8 @@ static INLINE void smp_rmb(void) + __asm__ __volatile__("bcr 14,0" : : : "memory"); + #elif defined __PPC__ + __asm__ __volatile__("lwsync" : : : "memory"); ++#elif defined __loongarch64 ++ __asm__ __volatile__("dbar 0" : : : "memory"); + #else + #error "no fence defined" + #endif +@@ -146,6 +150,8 @@ static INLINE void smp_wmb(void) + __asm__ __volatile__("bcr 14,0" : : : "memory"); + #elif defined __PPC__ + __asm__ __volatile__("lwsync" : : : "memory"); ++#elif defined __loongarch64 ++ __asm__ __volatile__("dbar 0" : : : "memory"); + #else + #error "no fence defined" + #endif +@@ -172,7 +178,7 @@ static INLINE void smp_mb__before_atomic(void) + static INLINE void smp_read_barrier_depends(void) + { + #if defined(__x86_64__) || defined(__PPC__) || defined(__s390__) \ +- || defined(__aarch64__) ++ || defined(__aarch64__) || defined(__loongarch64) + // Nothing needed for these architectures. + #else + // Default to playing it safe. +diff --git a/utils/uds/cpu.h b/utils/uds/cpu.h +index 6549f6e..e26d653 100644 +--- a/utils/uds/cpu.h ++++ b/utils/uds/cpu.h +@@ -36,7 +36,7 @@ + #define CACHE_LINE_BYTES 128 + #elif defined(__s390x__) + #define CACHE_LINE_BYTES 256 +-#elif defined(__x86_64__) || defined(__aarch64__) ++#elif defined(__x86_64__) || defined(__aarch64__) || defined(__loongarch64) + #define CACHE_LINE_BYTES 64 + #else + #error "unknown cache line size" +-- +2.33.0 + diff --git a/vdo.spec b/vdo.spec index 1d143cd..a1ffed4 100644 --- a/vdo.spec +++ b/vdo.spec @@ -1,11 +1,12 @@ Name: vdo Version: 6.2.6.14 -Release: 1 +Release: 2 Summary: Management tools for Virtual Data Optimizer License: GPLv2 URL: http://github.com/dm-vdo/vdo Source0: https://github.com/dm-vdo/vdo/archive/refs/tags/%{version}.tar.gz Patch0002: 0002-Ignore-misaligned-pointers.patch +Patch0003: 0001-Add-loongarch64-support.patch BuildRequires: gcc libuuid-devel device-mapper-devel device-mapper-event-devel BuildRequires: valgrind-devel python3 python3-devel zlib-devel systemd @@ -23,7 +24,11 @@ This package provides the user-space management tools for VDO. %package_help %prep -%autosetup -n %{name}-%{version} -p1 +%setup -q +%patch0002 -p1 +%ifarch loongarch64 +%patch0003 -p1 +%endif %build %make_build @@ -80,6 +85,9 @@ done %{_mandir}/man8/* %changelog +* Tue Mar 7 2023 doupengda - 6.2.6.14-2 +- Add loongarch64 support + * Fri May 20 2022 houyingchao - 6.2.6.14-1 - Upgrade to 6.2.6.14