aports/community/spdk/isal.patch
2024-04-08 06:00:44 +00:00

266 lines
9.0 KiB
Diff

diff -Nurp a/CONFIG b/CONFIG
--- a/CONFIG 2024-01-26 15:17:18.000000000 +0000
+++ b/CONFIG 2024-03-29 10:32:22.061805545 +0000
@@ -164,6 +164,9 @@ 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
diff -Nurp a/Makefile b/Makefile
--- a/Makefile 2024-01-26 15:17:18.000000000 +0000
+++ b/Makefile 2024-03-29 10:32:22.065805595 +0000
@@ -18,7 +18,9 @@ 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
+endif
DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild
DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild
DIRS-$(CONFIG_SMA) += proto
@@ -62,10 +64,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 -Nurp a/configure b/configure
--- a/configure 2024-01-26 15:17:18.000000000 +0000
+++ b/configure 2024-03-29 14:51:50.088244865 +0000
@@ -60,6 +60,8 @@ function usage() {
echo " Implies --without-dpdk."
echo " --with-idxd Build the IDXD library and accel framework plug-in module."
echo " --without-idxd Disabled while experimental. Only built for x86 when enabled."
+ 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 " --with-crypto Build isa-l-crypto and vbdev crypto module. No path required."
echo " --without-crypto Disable isa-l-crypto and vbdev crypto module."
echo " --with-fio[=DIR] Build fio_plugin."
@@ -433,6 +435,22 @@ for i in "$@"; do
--without-dpdk)
CONFIG[DPDK_DIR]=
;;
+ --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
+ ;;
--with-wpdk=*)
check_dir "$i"
CONFIG[WPDK_DIR]=$(readlink -f ${i#*=})
@@ -1173,98 +1191,16 @@ if [[ "${CONFIG[FUZZER]}" = "y" && "$CC_
exit 1
fi
-if [[ $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"
else
- # for PPC
CONFIG[ISAL]=n
- echo "WARNING: ISA-L cannot be used due to architecture incompatibility."
+ echo "ISA-L not installed"
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
-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
fi
diff -Nurp a/lib/accel/accel_sw.c b/lib/accel/accel_sw.c
--- a/lib/accel/accel_sw.c 2024-01-26 15:17:18.000000000 +0000
+++ b/lib/accel/accel_sw.c 2024-03-29 10:32:22.065805595 +0000
@@ -20,8 +20,8 @@
#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"
#endif
#endif
diff -Nurp a/lib/util/crc16.c b/lib/util/crc16.c
--- a/lib/util/crc16.c 2024-01-26 15:17:18.000000000 +0000
+++ b/lib/util/crc16.c 2024-03-29 10:32:22.069805646 +0000
@@ -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 -Nurp a/lib/util/crc64.c b/lib/util/crc64.c
--- a/lib/util/crc64.c 2024-01-26 15:17:18.000000000 +0000
+++ b/lib/util/crc64.c 2024-03-29 16:24:20.464386622 +0000
@@ -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 -Nurp a/lib/util/crc_internal.h b/lib/util/crc_internal.h
--- a/lib/util/crc_internal.h 2024-01-26 15:17:18.000000000 +0000
+++ b/lib/util/crc_internal.h 2024-03-29 10:32:22.069805646 +0000
@@ -10,7 +10,7 @@
#ifdef SPDK_CONFIG_ISAL
#define SPDK_HAVE_ISAL
-#include <isa-l/include/crc.h>
+#include <isa-l/crc.h>
#elif defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
#define SPDK_HAVE_ARM_CRC
#include <arm_acle.h>
diff -Nurp a/lib/util/xor.c b/lib/util/xor.c
--- a/lib/util/xor.c 2024-01-26 15:17:18.000000000 +0000
+++ b/lib/util/xor.c 2024-03-29 10:32:22.069805646 +0000
@@ -85,7 +85,7 @@ xor_gen_basic(void *dest, void **sources
}
#ifdef SPDK_CONFIG_ISAL
-#include "isa-l/include/raid.h"
+#include "isa-l/raid.h"
#define SPDK_XOR_BUF_ALIGN 32
diff -Nurp a/mk/spdk.common.mk b/mk/spdk.common.mk
--- a/mk/spdk.common.mk 2024-01-26 15:17:18.000000000 +0000
+++ b/mk/spdk.common.mk 2024-04-07 20:48:45.911456449 +0000
@@ -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
@@ -397,7 +395,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) \