From c3a727d7b66ed6491d48adb53c8c2b87ef2f019e Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Fri, 25 Feb 2022 10:03:21 +0800 Subject: [PATCH] Fix build error on ARM ThunderX2 and neoverse N1 platform Signed-off-by: Hongtao Zhang --- ...M-ThunderX2-and-neoverse_N1_platform.patch | 47 ++++++++++++++++ ...n-check-for-ARM-Neoverse-N1_platform.patch | 53 +++++++++++++++++++ spdk.spec | 7 ++- 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 0014-mk-Fix-debug-build-error-on-ARM-ThunderX2-and-neoverse_N1_platform.patch create mode 100644 0015-configure-add-gcc-version-check-for-ARM-Neoverse-N1_platform.patch diff --git a/0014-mk-Fix-debug-build-error-on-ARM-ThunderX2-and-neoverse_N1_platform.patch b/0014-mk-Fix-debug-build-error-on-ARM-ThunderX2-and-neoverse_N1_platform.patch new file mode 100644 index 0000000..ca6534d --- /dev/null +++ b/0014-mk-Fix-debug-build-error-on-ARM-ThunderX2-and-neoverse_N1_platform.patch @@ -0,0 +1,47 @@ +From de8f3a50ee33c8218ba59bc16297e953121206d7 Mon Sep 17 00:00:00 2001 +From: root +Date: Fri, 19 Mar 2021 15:38:55 +0800 +Subject: [PATCH] mk: Fix debug build error on ARM ThunderX2 and neoverse N1 + platform + +When building spdk on ARM platform like thunderx2 with --enable-debug, +there are following error: + +/tmp/ccOBb4AF.s: Assembler messages: +/tmp/ccOBb4AF.s:45: Error: selected processor does not support `casp x0,x1,x2,x3,[x4]' +/tmp/ccOBb4AF.s:77: Error: selected processor does not support `caspa x0,x1,x2,x3,[x4]' +/tmp/ccOBb4AF.s:109: Error: selected processor does not support `caspl x0,x1,x2,x3,[x4]' +/tmp/ccOBb4AF.s:141: Error: selected processor does not support `caspal x0,x1,x2,x3,[x4]' + +The reason is that DPDK is built with -march=armv8.1-a or -march=armv8.2-a+lse which +have these instructions while SPDK is built with -march=armv8-a+crc which does not support +them. Change spdk build machine to native can fix this. + +Signed-off-by: Rui Chang +Change-Id: I759d4ce2c557ce5ff73a802d7a4b6579c4ba64f7 +Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7025 +Community-CI: Mellanox Build Bot +Reviewed-by: Ziye Yang +Reviewed-by: Changpeng Liu +Reviewed-by: Aleksey Marchuk +Tested-by: SPDK CI Jenkins +--- + mk/spdk.common.mk | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk +index 633a05bda79..897be4d2150 100644 +--- a/mk/spdk.common.mk ++++ b/mk/spdk.common.mk +@@ -77,11 +77,7 @@ + ifneq ($(filter powerpc%,$(TARGET_MACHINE)),) + COMMON_CFLAGS += -mcpu=$(TARGET_ARCHITECTURE) + else ifeq ($(TARGET_MACHINE),aarch64) +-ifeq ($(TARGET_ARCHITECTURE),native) +-COMMON_CFLAGS += -march=armv8-a+crc +-else + COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE) +-endif + COMMON_CFLAGS += -DPAGE_SIZE=$(shell getconf PAGESIZE) + else + COMMON_CFLAGS += -march=$(TARGET_ARCHITECTURE) diff --git a/0015-configure-add-gcc-version-check-for-ARM-Neoverse-N1_platform.patch b/0015-configure-add-gcc-version-check-for-ARM-Neoverse-N1_platform.patch new file mode 100644 index 0000000..7b4d6ef --- /dev/null +++ b/0015-configure-add-gcc-version-check-for-ARM-Neoverse-N1_platform.patch @@ -0,0 +1,53 @@ +From fcc389490a4abe26c1efe6cc624dc2925ed6b670 Mon Sep 17 00:00:00 2001 +From: Rui Chang +Date: Tue, 18 May 2021 15:32:56 +0800 +Subject: [PATCH] configure: add gcc version check for ARM Neoverse-N1 platform + +When doing debug build on ARM Neoverse-N1 platform, if gcc version is +lower than 8.4.0, we may met following errors: + +/tmp/cc24qua1.s: Assembler messages: +/tmp/cc24qua1.s:53: Error: selected processor does not support `casp x0,x1,x2,x3,[x4]' +/tmp/cc24qua1.s:85: Error: selected processor does not support `caspa x0,x1,x2,x3,[x4]' +/tmp/cc24qua1.s:117: Error: selected processor does not support `caspl x0,x1,x2,x3,[x4]' +/tmp/cc24qua1.s:149: Error: selected processor does not support `caspal x0,x1,x2,x3,[x4]' + +The change also fix the problem by pass armv8.2-a+crypto as target architecture. + +Signed-off-by: Rui Chang +Change-Id: I2053b9440e06873066480d63e471802df2e69d4e +Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7949 +Reviewed-by: Changpeng Liu +Reviewed-by: Aleksey Marchuk +Reviewed-by: Ziye Yang +Tested-by: SPDK CI Jenkins +Community-CI: Mellanox Build Bot +--- + configure | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/configure b/configure +index 7d063f4ef3b..a2d0c5a62fb 100755 +--- a/configure ++++ b/configure +@@ -786,6 +786,20 @@ exit 1 + fi + fi + ++# For ARM Neoverse-N1 platform, debug build needs gcc version newer than 8.4 ++if [[ "${CONFIG[DEBUG]}" = "y" && $arch = aarch64* && "$CC_TYPE" = "gcc" ]]; then ++ GCC_VERSION=$($CC -dumpfullversion) ++ PART_NUM=$(grep -i -m 1 "CPU part" /proc/cpuinfo | awk '{print $4}') ++ ++ if [[ "$(printf '%s\n' "8.4.0" "$GCC_VERSION" | sort -V | head -n1)" != "8.4.0" ]]; then ++ if [[ $PART_NUM = 0xd0c ]]; then ++ echo "WARNING: For ARM Neoverse-N1 platform, debug build needs GCC version newer than 8.4." ++ echo " Will work around this by using armv8.2-a+crypto as target architecture for now." ++ CONFIG[ARCH]=armv8.2-a+crypto ++ fi ++ fi ++fi ++ + # We are now ready to generate final configuration. But first do sanity + # check to see if all keys in CONFIG array have its reflection in CONFIG file. + if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+=" $rootdir/CONFIG) -ne ${#CONFIG[@]} ]; then diff --git a/spdk.spec b/spdk.spec index 5f6d798..bb17a36 100644 --- a/spdk.spec +++ b/spdk.spec @@ -3,7 +3,7 @@ Name: spdk Version: 21.01.1 -Release: 2 +Release: 3 Summary: Set of libraries and utilities for high performance user-mode storage License: BSD and MIT URL: http://spdk.io @@ -21,6 +21,8 @@ Patch10: 0010-spdk_top-check-return-value-of-strdup-in-store_last_.patch Patch11: 0011-uring-set-fd-to-1-after-close-fd-in-uring_sock_creat.patch Patch12: 0012-spdk-use-fstack-protector-strong-instead-of-fstack-p.patch Patch13: 0013-lib-vhost-Fix-compilation-with-dpdk-21.11.patch +Patch14: 0014-mk-Fix-debug-build-error-on-ARM-ThunderX2-and-neoverse_N1_platform.patch +Patch15: 0015-configure-add-gcc-version-check-for-ARM-Neoverse-N1_platform.patch %define package_version %{version}-%{release} @@ -174,6 +176,9 @@ mv doc/output/html/ %{install_docdir} %changelog +* Fri Feb 25 2022 Hongtao Zhang - 21.01.1-3 +- Fix build error on ARM ThunderX2 and neoverse N1 platform + * Mon Jan 10 2022 Weifeng Su - 21.01.1-2 - Adapt for dpdk 21.11 -- Gitee