diff --git a/0001-Add-support-for-loongarch64.patch b/0001-Add-support-for-loongarch64.patch new file mode 100644 index 0000000000000000000000000000000000000000..2456ead1b0a04d6e87a0adb843cee0220c748d44 --- /dev/null +++ b/0001-Add-support-for-loongarch64.patch @@ -0,0 +1,100 @@ +From 602997d492f2338b337a25d9b738d2bb3053f6ce Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Wed, 5 Jul 2023 02:30:53 +0000 +Subject: [PATCH] Add support for loongarch64 + +--- + arch/arch-loongarch64.h | 10 ++++++++++ + arch/arch.h | 3 +++ + configure | 3 +++ + libfio.c | 3 ++- + os/os-linux-syscall.h | 7 +++++++ + 5 files changed, 25 insertions(+), 1 deletion(-) + create mode 100644 arch/arch-loongarch64.h + +diff --git a/arch/arch-loongarch64.h b/arch/arch-loongarch64.h +new file mode 100644 +index 0000000..43ea83b +--- /dev/null ++++ b/arch/arch-loongarch64.h +@@ -0,0 +1,10 @@ ++#ifndef ARCH_LOONGARCH64_H ++#define ARCH_LOONGARCH64_H ++ ++#define FIO_ARCH (arch_loongarch64) ++ ++#define read_barrier() __asm__ __volatile__("dbar 0": : :"memory") ++#define write_barrier() __asm__ __volatile__("dbar 0": : :"memory") ++#define nop __asm__ __volatile__("dbar 0": : :"memory") ++ ++#endif +diff --git a/arch/arch.h b/arch/arch.h +index fca003b..2c11c0f 100644 +--- a/arch/arch.h ++++ b/arch/arch.h +@@ -27,6 +27,7 @@ enum { + arch_generic, + + arch_nr, ++ arch_loongarch64, + }; + + enum { +@@ -97,6 +98,8 @@ extern unsigned long arch_flags; + #include "arch-hppa.h" + #elif defined(__aarch64__) + #include "arch-aarch64.h" ++#elif defined(__loongarch64) ++#include "arch-loongarch64.h" + #else + #warning "Unknown architecture, attempting to use generic model." + #include "arch-generic.h" +diff --git a/configure b/configure +index 45d10a3..46d6d9a 100755 +--- a/configure ++++ b/configure +@@ -523,6 +523,9 @@ case "$cpu" in + mips*) + cpu="mips" + ;; ++ loongarch64) ++ cpu="loongarch64" ++ ;; + sparc|sun4[cdmuv]) + cpu="sparc" + ;; +diff --git a/libfio.c b/libfio.c +index a52014c..d2227f4 100644 +--- a/libfio.c ++++ b/libfio.c +@@ -74,7 +74,8 @@ static const char *fio_arch_strings[arch_nr] = { + "hppa", + "mips", + "aarch64", +- "generic" ++ "generic", ++ "loongarch64" + }; + + static void reset_io_counters(struct thread_data *td, int all) +diff --git a/os/os-linux-syscall.h b/os/os-linux-syscall.h +index c399b2f..3524966 100644 +--- a/os/os-linux-syscall.h ++++ b/os/os-linux-syscall.h +@@ -270,6 +270,13 @@ + #define __NR_ioprio_get 31 + #endif + ++/* Linux syscalls for loongarch64 */ ++#elif defined(ARCH_LOONGARCH64_H) ++#ifndef __NR_ioprio_set ++#define __NR_ioprio_set 30 ++#define __NR_ioprio_get 31 ++#endif ++ + #else + #warning "Unknown architecture" + #endif +-- +2.33.0 + diff --git a/fio.spec b/fio.spec index a1d9e443bf6fd9a0721382a67c8773ae7351da1f..9f0c5b3d165618c2c7c090c30ef9b865ff17196f 100644 --- a/fio.spec +++ b/fio.spec @@ -1,11 +1,12 @@ Name: fio Version: 3.34 -Release: 1 +Release: 2 Summary: Multithreaded IO generation tool License: GPLv2 URL: http://git.kernel.dk/?p=fio.git;a=summary Source0: http://brick.kernel.dk/snaps/%{name}-%{version}.tar.bz2 +Patch100: 0001-Add-support-for-loongarch64.patch BuildRequires: gcc @@ -77,6 +78,9 @@ make test %changelog +* Wed Jul 5 2023 doupengda - 3.34-2 +- Add support for loongarch64 + * Thu Apr 27 2023 liyanan - 3.34-1 - Update to 3.34