From 30e3d6e5a6abe180edabcc7d618c8b0b12d45c39 Mon Sep 17 00:00:00 2001 From: doupengda Date: Tue, 18 Jul 2023 11:26:37 +0800 Subject: [PATCH] Add support for loongarch64 --- ...fio-3.34-add-support-for-loongarch64.patch | 100 ++++++++++++++++++ fio.spec | 6 +- 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 0001-fio-3.34-add-support-for-loongarch64.patch diff --git a/0001-fio-3.34-add-support-for-loongarch64.patch b/0001-fio-3.34-add-support-for-loongarch64.patch new file mode 100644 index 0000000..c22c9ba --- /dev/null +++ b/0001-fio-3.34-add-support-for-loongarch64.patch @@ -0,0 +1,100 @@ +From fd0cd7125edebec82517dcfb16dcd4d2371df105 Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Tue, 18 Jul 2023 03:04:19 +0000 +Subject: [PATCH] fio 3.34 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..c820120 +--- /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__("": : :"memory") ++#define write_barrier() __asm__ __volatile__("": : :"memory") ++#define nop __asm__ __volatile__("": : :"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..7323d7e 100755 +--- a/configure ++++ b/configure +@@ -526,6 +526,9 @@ case "$cpu" in + sparc|sun4[cdmuv]) + cpu="sparc" + ;; ++ loongarch64) ++ cpu="loongarch64" ++ ;; + *) + echo "Unknown CPU" + ;; +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..4657096 100644 +--- a/os/os-linux-syscall.h ++++ b/os/os-linux-syscall.h +@@ -219,6 +219,13 @@ + #define __NR_ioprio_get 315 + #endif + ++/* Linux syscalls for loongarch64 */ ++#elif defined(ARCH_LOONGARCH64_H) ++#ifndef __NR_ioprio_set ++#define __NR_ioprio_set 314 ++#define __NR_ioprio_get 315 ++#endif ++ + #ifndef __NR_fadvise64 + #define __NR_fadvise64 215 + #endif +-- +2.39.3 + diff --git a/fio.spec b/fio.spec index d1b6ddc..513855e 100644 --- a/fio.spec +++ b/fio.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 Name: fio Version: 3.34 @@ -13,6 +13,7 @@ Patch0001: 0001-engines-io_uring-add-sqthread_poll_percpu-option.patch Patch0002: 0002-engines-io_uring-use-correct-type-for-fio_nvme_get_i.patch Patch0003: 0003-engines-nvme-cast-__u64-to-unsigned-long-long-for-pr.patch Patch0004: 0004-t-io_uring-fix-max_blocks-calculation-in-nvme-passth.patch +Patch0005: 0001-fio-3.34-add-support-for-loongarch64.patch BuildRequires: gcc BuildRequires: libaio-devel @@ -209,6 +210,9 @@ make install prefix=%{_prefix} mandir=%{_mandir} libdir=%{_libdir}/fio DESTDIR=$ %endif %changelog +* Tue Jul 18 2023 doupengda - 3.34-2 +- Add support for loongarch64 + * Wed Jun 21 2023 Joseph Qi 3.34-1 - update to 3.34 to support io_uring nvme passthrough -- Gitee