diff --git a/0013-add-system-isal-support.patch b/0013-add-system-isal-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..7f6933fa0517fb6c437586e351629c1c555e09d0 --- /dev/null +++ b/0013-add-system-isal-support.patch @@ -0,0 +1,323 @@ +From 6ada650a55efc219e3ce8b79bfcbea994c1e301f Mon Sep 17 00:00:00 2001 +From: lizhipeng +Date: Wed, 16 Jul 2025 17:32:17 +0800 +Subject: [PATCH] add system isal support + +Signed-off-by: lizhipeng +--- + CONFIG | 6 ++ + Makefile | 4 ++ + configure | 112 ++++++++----------------------------- + lib/accel/accel_sw.c | 5 +- + lib/util/crc16.c | 2 +- + lib/util/crc64.c | 2 +- + lib/util/crc_internal.h | 2 +- + lib/util/xor.c | 2 +- + mk/spdk.common.mk | 3 - + module/bdev/aio/bdev_aio.c | 3 + + 10 files changed, 44 insertions(+), 97 deletions(-) + +diff --git a/CONFIG b/CONFIG +index a7674ff..2763e88 100644 +--- a/CONFIG ++++ b/CONFIG +@@ -167,9 +167,15 @@ CONFIG_CUSTOMOCF=n + + # Build ISA-L library + CONFIG_ISAL=y ++CONFIG_ISAL_INC_DIR= ++CONFIG_ISAL_LIB_DIR= ++CONFIG_ISAL_PKG_CONFIG=n + + # Build ISA-L-crypto library + CONFIG_ISAL_CRYPTO=y ++CONFIG_ISAL_CRYPTO_INC_DIR= ++CONFIG_ISAL_CRYPTO_LIB_DIR= ++CONFIG_ISAL_CRYPTO_PKG_CONFIG=n + + # Build with IO_URING support + CONFIG_URING=n +diff --git a/Makefile b/Makefile +index 6ad42d7..1080db4 100644 +--- a/Makefile ++++ b/Makefile +@@ -24,8 +24,10 @@ DIRS-$(CONFIG_EXAMPLES) += examples + DIRS-$(CONFIG_APPS) += app + DIRS-y += test + DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild ++ifneq ($(CONFIG_ISAL_PKG_CONFIG),y) + DIRS-$(CONFIG_ISAL) += isalbuild + DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild ++endif + DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild + DIRS-$(CONFIG_SMA) += proto + DIRS-$(CONFIG_XNVME) += xnvmebuild +@@ -68,10 +70,12 @@ LIB += ipsecbuild + DPDK_DEPS += ipsecbuild + endif + ++ifneq ($(CONFIG_ISAL_PKG_CONFIG),y) + ifeq ($(CONFIG_ISAL),y) + ISALBUILD = isalbuild + LIB += isalbuild + DPDK_DEPS += isalbuild ++endif + ifeq ($(CONFIG_ISAL_CRYPTO),y) + ISALCRYPTOBUILD = isalcryptobuild + LIB += isalcryptobuild +diff --git a/configure b/configure +index 2177acd..16a7620 100755 +--- a/configure ++++ b/configure +@@ -132,6 +132,8 @@ function usage() { + echo " --without-avahi No path required." + echo " --with-golang Build with components written in Go" + echo " --without-golang No path required." ++ echo " --with-system-isal Build against a system isa-l version. By default, the isa-l" ++ echo " submodule in spdk tree will be used." + echo " --without-isal Build with ISAL-L. DIsabled by default" + echo "" + echo "Environment variables:" +@@ -686,6 +688,22 @@ for i in "$@"; do + --without-isal) + CONFIG[ISAL]=n + ;; ++ --with-system-isal) ++ # Can we use pkg-config? ++ if command -v "pkg-config" > /dev/null 2>&1 && pkg-config --exists libisal; then ++ isal_libdir=$(pkg-config --variable=libdir libisal) ++ isal_libdir=$(readlink -f $isal_libdir) ++ isal_incdir=$(pkg-config --variable=includedir libisal) ++ echo "Using isa-l lib dir $isal_libdir" ++ CONFIG[ISAL_LIB_DIR]=$isal_libdir ++ CONFIG[ISAL_INC_DIR]=$isal_incdir ++ CONFIG[ISAL_PKG_CONFIG]=y ++ CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libisal)" ++ else ++ echo "libisal.pc not found, aborting" ++ exit 1 ++ fi ++ ;; + --) + break + ;; +@@ -1185,99 +1203,17 @@ if [[ "${CONFIG[FUZZER]}" = "y" && "$CC_TYPE" != "clang" ]]; then + exit 1 + fi + +-if [[ "${CONFIG[ISAL]}" != "n" ]] && ([[ $arch == x86_64* ]] || [[ $arch == aarch64* ]]); then +- CONFIG[ISAL]=y +- # make sure the submodule is initialized +- if [ ! -f "$rootdir"/isa-l/autogen.sh ]; then +- echo "ISA-L is required but was not found, please init the submodule with:" +- echo " git submodule update --init" +- echo "and then re-run this script." +- exit 1 +- fi +- # for x86 only, check the nasm version for ISA-L and IPSEC +- if [[ $arch == x86_64* ]]; then +- ver=$(nasm -v 2> /dev/null | awk '{print $3}' | awk -Fr '{print $1}') +- if lt "$ver" 2.14; then +- CONFIG[ISAL]=n +- # IPSEC has nasm requirement and DPDK crypto relies on IPSEC +- CONFIG[IPSEC_MB]=n +- echo "WARNING: ISA-L & DPDK crypto cannot be used as nasm ver must be 2.14 or newer." +- fi +- fi +- # check gas version on aarch64 +- if [[ $arch == aarch64* ]]; then +- ver=$(as --version 2> /dev/null | awk '/GNU assembler/{print $NF}') +- if lt "$ver" 2.24; then +- # ISA-L, compression & crypto require gas version 2.24 or newer. +- CONFIG[ISAL]=n +- echo "Notice: ISA-L, compression & crypto require GAS version 2.24 or newer. Turning off default ISA-L and crypto features." +- elif lt "$ver" 2.34; then +- #For gas v2.24~v2.34, sve2 instructions are not supported. To workaround it, sve2 optimization should be disabled +- ISAL_CRYPTO_OPTS+=("--disable-sve2") +- fi +- fi ++if [[ "${CONFIG[ISAL_PKG_CONFIG]}" = "y" ]]; then ++ echo "Using system ISA-L" ++ CONFIG[ISAL]=y + else +- # for PPC +- CONFIG[ISAL]=n +- echo "WARNING: ISA-L cannot be used due to architecture incompatibility." +-fi +- +-# now either configure ISA-L or disable unavailable features +-if [[ "${CONFIG[ISAL]}" = "y" ]]; then +- cd $rootdir/isa-l +- ISAL_LOG=$rootdir/isa-l/spdk-isal.log +- if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then +- ISAL_OPTS=("--host=${CONFIG[CROSS_PREFIX]}") +- else +- ISAL_OPTS=() +- fi +- if [[ -n "${CONFIG[SHARED]}" ]]; then +- ISAL_OPTS+=("--enable-shared=yes") +- else +- ISAL_OPTS+=("--enable-shared=no") +- fi +- ISAL_OPTS+=("--prefix=${CONFIG[PREFIX]}") +- echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..." +- ./autogen.sh &> $ISAL_LOG +- ./configure CFLAGS="-fPIC -g -O2" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1 +- echo "done." +- cd $rootdir +-else +- echo "Without ISA-L, there is no software support for crypto or compression," +- echo "so these features will be disabled." +- CONFIG[CRYPTO]=n +- CONFIG[VBDEV_COMPRESS]=n +- CONFIG[DPDK_COMPRESSDEV]=n ++ CONFIG[ISAL]=n ++ echo "ISA-L not installed." + fi + + # ISA-L-crypto complements ISA-L functionality, it is only enabled together with ISA-L + if [[ "${CONFIG[ISAL]}" = "y" ]]; then +- if [ ! -f "$rootdir"/isa-l-crypto/autogen.sh ]; then +- echo "ISA-L-crypto is required but was not found, please init the submodule with:" +- echo " git submodule update --init" +- echo "and then re-run this script." +- exit 1 +- fi +- +- cd $rootdir/isa-l-crypto +- ISAL_CRYPTO_LOG=$rootdir/isa-l-crypto/spdk-isal-crypto.log +- if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then +- ISAL_CRYPTO_OPTS+=("--host=${CONFIG[CROSS_PREFIX]}") +- fi +- if [[ -n "${CONFIG[SHARED]}" ]]; then +- ISAL_CRYPTO_OPTS+=("--enable-shared=yes") +- else +- ISAL_CRYPTO_OPTS+=("--enable-shared=no") +- fi +- ISAL_CRYPTO_OPTS+=("--prefix=${CONFIG[PREFIX]}") +- echo -n "Configuring ISA-L-crypto (logfile: $ISAL_CRYPTO_LOG)..." +- ./autogen.sh &> $ISAL_CRYPTO_LOG +- ./configure CFLAGS="-fPIC -g -O2" "${ISAL_CRYPTO_OPTS[@]}" >> $ISAL_CRYPTO_LOG 2>&1 +- echo "done." +- cd $rootdir +- CONFIG[ISAL_CRYPTO]=y +-else +- CONFIG[ISAL_CRYPTO]=n ++ CONFIG[ISAL_CRYPTO]=n + fi + + if [[ "${CONFIG[SMA]}" = "y" ]]; then +diff --git a/lib/accel/accel_sw.c b/lib/accel/accel_sw.c +index 049d38c..4ee76b0 100644 +--- a/lib/accel/accel_sw.c ++++ b/lib/accel/accel_sw.c +@@ -20,9 +20,10 @@ + #include "spdk/dif.h" + + #ifdef SPDK_CONFIG_ISAL +-#include "../isa-l/include/igzip_lib.h" +-#ifdef SPDK_CONFIG_ISAL_CRYPTO ++#include "isa-l/igzip_lib.h" ++#if defined(SPDK_CONFIG_ISAL_CRYPTO) + #include "../isa-l-crypto/include/aes_xts.h" ++#include "isa-l_crypto/isal_crypto_api.h" + #endif + #endif + +diff --git a/lib/util/crc16.c b/lib/util/crc16.c +index f085a28..052133e 100644 +--- a/lib/util/crc16.c ++++ b/lib/util/crc16.c +@@ -11,7 +11,7 @@ + */ + + #ifdef SPDK_CONFIG_ISAL +-#include "isa-l/include/crc.h" ++#include "isa-l/crc.h" + + uint16_t + spdk_crc16_t10dif(uint16_t init_crc, const void *buf, size_t len) +diff --git a/lib/util/crc64.c b/lib/util/crc64.c +index b1a37af..30322f1 100644 +--- a/lib/util/crc64.c ++++ b/lib/util/crc64.c +@@ -7,7 +7,7 @@ + #include "spdk/crc64.h" + + #ifdef SPDK_CONFIG_ISAL +-#include "isa-l/include/crc64.h" ++#include "isa-l/crc64.h" + + uint64_t + spdk_crc64_nvme(const void *buf, size_t len, uint64_t crc) +diff --git a/lib/util/crc_internal.h b/lib/util/crc_internal.h +index b432d0d..bfc7607 100644 +--- a/lib/util/crc_internal.h ++++ b/lib/util/crc_internal.h +@@ -10,7 +10,7 @@ + + #ifdef SPDK_CONFIG_ISAL + #define SPDK_HAVE_ISAL +-#include ++#include + #elif defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) + #define SPDK_HAVE_ARM_CRC + #include +diff --git a/lib/util/xor.c b/lib/util/xor.c +index 07eca5f..53edfcd 100644 +--- a/lib/util/xor.c ++++ b/lib/util/xor.c +@@ -85,7 +85,7 @@ xor_gen_basic(void *dest, void **sources, uint32_t n, uint32_t len) + } + + #ifdef SPDK_CONFIG_ISAL +-#include "isa-l/include/raid.h" ++#include "isa-l/raid.h" + + #define SPDK_XOR_BUF_ALIGN 32 + +diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk +index 2765c04..9a7c31a 100644 +--- a/mk/spdk.common.mk ++++ b/mk/spdk.common.mk +@@ -182,7 +182,6 @@ ifeq ($(CONFIG_ISAL), y) + COMMON_CFLAGS += -I$(ISAL_DIR)/.. + ifeq ($(CONFIG_SHARED),y) + SYS_LIBS += -L$(ISAL_DIR)/.libs -lisal +-LDFLAGS += -Wl,-rpath=$(ISAL_DIR)/.libs + else + SYS_LIBS += $(ISAL_DIR)/.libs/libisal.a + endif +@@ -190,7 +189,6 @@ ifeq ($(CONFIG_ISAL_CRYPTO), y) + COMMON_CFLAGS += -I$(ISAL_CRYPTO_DIR)/.. + ifeq ($(CONFIG_SHARED),y) + SYS_LIBS += -L$(ISAL_CRYPTO_DIR)/.libs -lisal_crypto +-LDFLAGS += -Wl,-rpath=$(ISAL_CRYPTO_DIR)/.libs + else + SYS_LIBS += $(ISAL_CRYPTO_DIR)/.libs/libisal_crypto.a + endif +@@ -398,7 +396,6 @@ LINK_CXX=\ + # Provide function to ease build of a shared lib + define spdk_build_realname_shared_lib + $(1) -o $@ -shared $(CPPFLAGS) $(LDFLAGS) \ +- -Wl,-rpath=$(DESTDIR)/$(libdir) \ + -Wl,--soname,$(notdir $@) \ + -Wl,--whole-archive $(2) -Wl,--no-whole-archive \ + -Wl,--version-script=$(3) \ +diff --git a/module/bdev/aio/bdev_aio.c b/module/bdev/aio/bdev_aio.c +index 7b33c71..37298c4 100644 +--- a/module/bdev/aio/bdev_aio.c ++++ b/module/bdev/aio/bdev_aio.c +@@ -26,6 +26,9 @@ + #ifndef __FreeBSD__ + #include + #endif ++#if !defined(CONFIG_FALLOCATE_ZERO_RANGE) ++#include ++#endif + + struct bdev_aio_io_channel { + uint64_t io_inflight; +-- +2.43.0 + diff --git a/spdk.spec b/spdk.spec index b9a014d8b81d7717a90fe39e34a328c6aef33161..323f99241b0dbc5bab83d976e3eb561b022306d7 100644 --- a/spdk.spec +++ b/spdk.spec @@ -4,7 +4,7 @@ Name: spdk Version: 24.01 -Release: 8 +Release: 9 Summary: Set of libraries and utilities for high performance user-mode storage License: BSD and MIT URL: http://spdk.io @@ -21,6 +21,7 @@ Patch9: 0009-spdk-add-nvme-support-for-HSAK.patch Patch10: 0010-Add-CUSE-switch-for-nvme-ctrlr.patch Patch11: 0011-Adapt-for-ES3000-serial-vendor-special-opcode-in-CUS.patch Patch12: 0012-adapt-for-spdk-24.01.patch +Patch13: 0013-add-system-isal-support.patch %define package_version %{version}-%{release} @@ -46,6 +47,7 @@ BuildRequires: libboundscheck BuildRequires: patchelf BuildRequires: CUnit, CUnit-devel, chrpath BuildRequires: python3-pip, python3-setuptools, python3-wheel +BuildRequires: libisal-devel %if %{with doc} BuildRequires: doxygen mscgen graphviz %endif @@ -109,7 +111,7 @@ BuildArch: noarch --disable-unit-tests \ --disable-apps \ --without-crypto \ - --without-isal \ + --with-system-isal \ --with-dpdk \ --without-fio \ --with-vhost \ @@ -200,6 +202,9 @@ mv doc/output/html/ %{install_docdir} %changelog +* Wed Jul 16 2025 lizhipeng - 24.01-9 +- add system isal support + * Sat Feb 08 2025 Weifeng Su - 24.01-8 - Fix build isue for spdk-tools