Add loongarch64 support

This commit is contained in:
doupengda 2023-03-07 11:27:17 +08:00
parent aab78a3292
commit d866ac3a89
2 changed files with 76 additions and 2 deletions

View File

@ -0,0 +1,66 @@
From 249491af07c735d93fc743e413a5304057e43a75 Mon Sep 17 00:00:00 2001
From: doupengda <doupengda@loongson.cn>
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

View File

@ -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 <doupengda@loongson.cn> - 6.2.6.14-2
- Add loongarch64 support
* Fri May 20 2022 houyingchao <houyingchao@h-partners.com> - 6.2.6.14-1
- Upgrade to 6.2.6.14