diff --git a/.gitmodules b/.gitmodules index 7cf5d42be..dcd2978df 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "xnvme"] path = xnvme url = https://github.com/OpenMPDK/xNVMe.git +[submodule "isa-l-crypto"] + path = isa-l-crypto + url = https://github.com/intel/isa-l_crypto diff --git a/CHANGELOG.md b/CHANGELOG.md index d36e6ba15..0c4a569a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## v23.01: (Upcoming Release) +### accel + +New library isa-l-crypto has been added, it is used by accel library in crypto operations. + ### bdev Both of interleaved and separated metadata are now supported by the malloc bdev module. diff --git a/CONFIG b/CONFIG index 75391212c..b24e5640b 100644 --- a/CONFIG +++ b/CONFIG @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (C) 2015 Intel Corporation. # All rights reserved. -# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2021, 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # configure options: __CONFIGURE_OPTIONS__ @@ -161,6 +161,9 @@ CONFIG_CUSTOMOCF=n # Build ISA-L library CONFIG_ISAL=y +# Build ISA-L-crypto library +CONFIG_ISAL_CRYPTO=y + # Build with IO_URING support CONFIG_URING=n diff --git a/Makefile b/Makefile index 24957f22f..8aa7327d9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (C) 2015 Intel Corporation. # Copyright (c) 2020, Mellanox Corporation. +# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES # All rights reserved. # @@ -18,6 +19,7 @@ DIRS-$(CONFIG_APPS) += app DIRS-y += test DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild DIRS-$(CONFIG_ISAL) += isalbuild +DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild DIRS-$(CONFIG_SMA) += proto DIRS-$(CONFIG_XNVME) += xnvmebuild @@ -62,6 +64,10 @@ ifeq ($(CONFIG_ISAL),y) ISALBUILD = isalbuild LIB += isalbuild DPDK_DEPS += isalbuild +ifeq ($(CONFIG_ISAL_CRYPTO),y) +ISALCRYPTOBUILD = isalcryptobuild +LIB += isalcryptobuild +endif endif ifeq ($(CONFIG_VFIO_USER),y) @@ -90,7 +96,7 @@ dpdkdeps $(DPDK_DEPS): $(WPDK) dpdkbuild: $(WPDK) $(DPDK_DEPS) endif -lib: $(WPDK) $(DPDKBUILD) $(VFIOUSERBUILD) $(XNVMEBUILD) $(ISALBUILD) +lib: $(WPDK) $(DPDKBUILD) $(VFIOUSERBUILD) $(XNVMEBUILD) $(ISALBUILD) $(ISALCRYPTOBUILD) module: lib shared_lib: module app: $(LIB) diff --git a/configure b/configure index 2a040d7ee..3aded8b48 100755 --- a/configure +++ b/configure @@ -56,8 +56,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-crypto Build vbdev crypto module." - echo " --without-crypto No path required." + 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." echo " --without-fio default: /usr/src/fio" echo " --with-xnvme Build xNVMe bdev module." @@ -1136,6 +1136,18 @@ if [[ $arch == x86_64* ]] || [[ $arch == aarch64* ]]; then 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 'NR==1{print $7}') + 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 else # for PPC CONFIG[ISAL]=n @@ -1163,6 +1175,31 @@ else CONFIG[VBDEV_COMPRESS]=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 + ISAL_CRYPTO_OPTS+=("--enable-shared=no") + 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 + if [[ "${CONFIG[SMA]}" = "y" ]]; then if ! python3 -c 'import grpc; import grpc_tools' 2> /dev/null; then echo "--with-sma requires grpcio and grpcio-tools python packages." diff --git a/isa-l-crypto b/isa-l-crypto new file mode 160000 index 000000000..08297dc3e --- /dev/null +++ b/isa-l-crypto @@ -0,0 +1 @@ +Subproject commit 08297dc3e76d65e1bad83a9c9f9e49059cf806b5 diff --git a/isalcryptobuild/Makefile b/isalcryptobuild/Makefile new file mode 100644 index 000000000..53135890e --- /dev/null +++ b/isalcryptobuild/Makefile @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) Intel Corporation. +# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. +# All rights reserved. +# + +SPDK_ROOT_DIR := $(abspath $(CURDIR)/..) +include $(SPDK_ROOT_DIR)/mk/spdk.common.mk + +.PHONY: all clean install + +ifneq ($(Q),) +REDIRECT=> /dev/null +endif + +# Force-disable scan-build +SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC)) + +$(ISAL_CRYPTO_DIR)/isa-l-crypto: + @ln -s $(ISAL_CRYPTO_DIR)/include $(ISAL_CRYPTO_DIR)/isa-l-crypto + +all: $(ISAL_CRYPTO_DIR)/isa-l-crypto + $(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/isa-l-crypto all CC="$(SUB_CC)" $(REDIRECT) + +install: all + +uninstall: + @: + +clean: + $(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/isa-l-crypto clean $(REDIRECT) + $(Q)rm -rf $(ISAL_CRYPTO_DIR)/isa-l-crypto diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index df485810e..7f509e989 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -2,6 +2,7 @@ # Copyright (C) 2015 Intel Corporation. # Copyright (c) 2017, IBM Corporation. # Copyright (c) 2019, 2021 Mellanox Corporation. +# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES # All rights reserved. # @@ -166,9 +167,14 @@ endif IPSEC_MB_DIR=$(CONFIG_IPSEC_MB_DIR) ISAL_DIR=$(SPDK_ROOT_DIR)/isa-l +ISAL_CRYPTO_DIR=$(SPDK_ROOT_DIR)/isa-l-crypto ifeq ($(CONFIG_ISAL), y) SYS_LIBS += -L$(ISAL_DIR)/.libs -lisal COMMON_CFLAGS += -I$(ISAL_DIR)/.. +ifeq ($(CONFIG_ISAL_CRYPTO), y) +SYS_LIBS += -L$(ISAL_CRYPTO_DIR)/.libs -lisal_crypto +COMMON_CFLAGS += -I$(ISAL_CRYPTO_DIR)/.. +endif endif ifeq ($(CONFIG_VFIO_USER), y)