intel / QAT_Engine

Intel QuickAssist Technology( QAT) OpenSSL Engine (an OpenSSL Plug-In Engine) which provides cryptographic acceleration for both hardware and optimized software using Intel QuickAssist Technology enabled Intel platforms. https://developer.intel.com/quickassist
BSD 3-Clause "New" or "Revised" License
410 stars 128 forks source link

Cannot build QAT driver #317

Open ykshih opened 6 months ago

ykshih commented 6 months ago

System info

OS: Linux u2404 6.8.0-31-lowlatency #31.1-Ubuntu gcc: gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4)

Problem

No problem when executing ./configure

# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... `yes`
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gawk... (cached) gawk
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... none
checking for cc... cc
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking whether cc understands -c and -o together... yes
checking dependency style of cc... none
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for C compiler vendor... gnu
checking for a sed that does not truncate output... /usr/bin/sed
checking for C compiler version... 13.2.0
checking for C++ compiler vendor... gnu
checking for C++ compiler version... 13.2.0
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking libudev.h usability... yes
checking libudev.h presence... yes
checking for libudev.h... yes
checking for libudev... yes
checking for libnl... yes
checking for lspci... yes
checking for nasm... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking utmpx.h usability... yes
checking utmpx.h presence... yes
checking for utmpx.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for inline... inline
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for int8_t... yes
checking for pid_t... yes
checking for C/C++ restrict keyword... __restrict
checking for size_t... yes
checking for ssize_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking for alarm... yes
checking for getpagesize... (cached) yes
checking for gettimeofday... yes
checking for memmove... yes
checking for memset... yes
checking for mkdir... yes
checking for munmap... yes
checking for rmdir... yes
checking for select... yes
checking for strerror... yes
checking for strtol... yes
checking for strtoul... yes
checking for strtoull... yes
checking whether cc supports -Wno-unused-command-line-argument... yes
checking for kernel sources... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

============================================================================
Type make followed by make install to build QAT with the following options
============================================================================
    QAT_ENABLE_XEN [xfalse]
    ICP_ROOT [/home/user/QAT.4.25]
    ICP_ARCH_USER [x86_64]
    ICP_BUILDSYSTEM_PATH [/home/user/QAT.4.25/quickassist/build_system]
    ICP_BUILD_OUTPUT [/home/user/QAT.4.25/build]
    ICP_ENV_DIR [/home/user/QAT.4.25/quickassist/build_system/build_files/env_files]
    ICP_TOOLS_TARGET [accelcomp]
    MAX_MR [50]
    KERNEL_SOURCE_ROOT [/lib/modules/6.8.0-31-lowlatency/build]
    ICP_DEBUG [false]
    ICP_ASAN [false]
    ICP_PARAM_CHECK [false]
    DISABLE_STATS [false]
    ICP_LOG_SYSLOG [false]
    ICP_NONBLOCKING_PARTIALS_PERFORM [false]
    ICP_TRACE [false]
    ICP_DC_ONLY [false]
    ICP_DC_RETURN_COUNTERS_ON_ERROR [false]
    ICP_ENABLE_LEGACY_ALGO [false]
    ICP_THREAD_SPECIFIC_USDM [false]
    QAE_USE_128K_SLABS [false]
============================================================================

But makefails with error:

Building qat_kernel for kernel space
make[3]: Entering directory '/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src'
Creating output directory
Creating static library libadf_kernel.a
make[4]: Entering directory '/usr/src/linux-headers-6.8.0-31-lowlatency'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  You are using:           gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  CC      /home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.o
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c: In function ‘create_adf_dev_structure’:
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:102:5: error: implicit declaration of function ‘strlcpy’; did you mean ‘strscpy’? [-Werror=implicit-function-declaration]
  102 |     strlcpy(adf->deviceName, hw_data->dev_class->name, sizeof(adf->deviceName));
      |     ^~~~~~~
      |     strscpy
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c: At top level:
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:319:11: error: no previous prototype for ‘icp_adf_cfgGetParamValue’ [-Werror=missing-prototypes]
  319 | CpaStatus icp_adf_cfgGetParamValue(icp_accel_dev_t *adf,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:338:18: error: no previous prototype for ‘icp_adf_getAccelDevByAccelId’ [-Werror=missing-prototypes]
  338 | icp_accel_dev_t *icp_adf_getAccelDevByAccelId(Cpa32U accelId)
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:354:11: error: no previous prototype for ‘icp_adf_getNumInstances’ [-Werror=missing-prototypes]
  354 | CpaStatus icp_adf_getNumInstances(Cpa16U *pNumInstances)
      |           ^~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:372:11: error: no previous prototype for ‘icp_adf_getAccelDevByCapabilities’ [-Werror=missing-prototypes]
  372 | CpaStatus icp_adf_getAccelDevByCapabilities(Cpa32U capabilitiesMask,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:402:11: error: no previous prototype for ‘icp_adf_getAllAccelDevByEachCapability’ [-Werror=missing-prototypes]
  402 | CpaStatus icp_adf_getAllAccelDevByEachCapability(Cpa32U capabilitiesMask,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:429:11: error: no previous prototype for ‘icp_adf_getAllAccelDevByCapabilities’ [-Werror=missing-prototypes]
  429 | CpaStatus icp_adf_getAllAccelDevByCapabilities(Cpa32U capabilitiesMask,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:460:11: error: no previous prototype for ‘icp_adf_getAccelDevCapabilities’ [-Werror=missing-prototypes]
  460 | CpaStatus icp_adf_getAccelDevCapabilities(icp_accel_dev_t *accel_dev,
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:478:6: error: no previous prototype for ‘icp_adf_qaDevGet’ [-Werror=missing-prototypes]
  478 | void icp_adf_qaDevGet(icp_accel_dev_t *pDev)
      |      ^~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:492:6: error: no previous prototype for ‘icp_adf_qaDevPut’ [-Werror=missing-prototypes]
  492 | void icp_adf_qaDevPut(icp_accel_dev_t *pDev)
      |      ^~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:498:8: error: no previous prototype for ‘icp_adf_getBusAddress’ [-Werror=missing-prototypes]
  498 | Cpa16U icp_adf_getBusAddress(Cpa16U packageId)
      |        ^~~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:528:12: error: no previous prototype for ‘icp_adf_isDevInError’ [-Werror=missing-prototypes]
  528 | CpaBoolean icp_adf_isDevInError(icp_accel_dev_t *accel_dev)
      |            ^~~~~~~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:533:5: error: no previous prototype for ‘adf_module_load’ [-Werror=missing-prototypes]
  533 | int adf_module_load(void)
      |     ^~~~~~~~~~~~~~~
/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.c:555:6: error: no previous prototype for ‘adf_module_unload’ [-Werror=missing-prototypes]
  555 | void adf_module_unload(void)
      |      ^~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option ‘-Wno-unused-command-line-argument’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:243: /home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src/lac_adf_interface_linux.o] Error 1
make[5]: *** [/usr/src/linux-headers-6.8.0-31-lowlatency/Makefile:1926: /home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src] Error 2
make[4]: *** [Makefile:240: __sub-make] Error 2
make[4]: Leaving directory '/usr/src/linux-headers-6.8.0-31-lowlatency'
Copying outputs
mv: cannot stat 'lac_adf_interface_linux.o': No such file or directory
mv: cannot stat 'qat_transport.o': No such file or directory
mv: cannot stat 'lac_symbols.o': No such file or directory
make[3]: Leaving directory '/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel/src'

Copying qat_kernel library
cp /home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel//src/build/linux_2.6/kernel_space/libadf_kernel.a /home/user/QAT.4.25/build/;
cp: cannot stat '/home/user/QAT.4.25/quickassist/lookaside/access_layer/src/qat_kernel//src/build/linux_2.6/kernel_space/libadf_kernel.a': No such file or directory
make[2]: *** [Makefile:167: qat_kernel] Error 1
make[2]: Leaving directory '/home/user/QAT.4.25/quickassist'
make[1]: *** [Makefile:1188: quickassist-all] Error 2
make[1]: Leaving directory '/home/user/QAT.4.25'
make: *** [Makefile:783: all] Error 2

Is QAT.L.4.25.0-00001.tar.gz compliance with Linux u2404 6.8.0-31-lowlatency??

hector-cao commented 5 months ago

Hello Ubuntu 24.04 comes with QAT components available (qatlib, qatengine and qatzip). Please give it a try instead of compiling the QAT lib yourself

jdschuet commented 5 months ago

Can you provide output of the following command: lspci -nn | egrep -e '8086:37c8|8086:19e2|8086:0435|8086:6f54|8086:4940|8086:4942'

This will help us understand the hardware we are working with. Thanks, Joel

ykshih commented 5 months ago

Hi Joel @jdschuet and @hector-cao

Thanks for your reply.

root@u2404:~# lspci -nn | egrep -e '8086:37c8|8086:19e2|8086:0435|8086:6f54|8086:4940|8086:4942' b1:00.0 Co-processor [0b40]: Intel Corporation C62x Chipset QuickAssist Technology [8086:37c8] (rev 04) b2:00.0 Co-processor [0b40]: Intel Corporation C62x Chipset QuickAssist Technology [8086:37c8] (rev 04) b3:00.0 Co-processor [0b40]: Intel Corporation C62x Chipset QuickAssist Technology [8086:37c8] (rev 04)

root@u2404:~# lsmod | grep qat qat_c62xvf 12288 0 qat_c62x 16384 0 intel_qat 401408 2 qat_c62x,qat_c62xvf crc8 12288 1 intel_qat authenc 12288 1 intel_qat root@u2404:~# modinfo intel_qat filename: /lib/modules/6.8.0-31-lowlatency/kernel/drivers/crypto/intel/qat/qat_common/intel_qat.ko.zst import_ns: CRYPTO_INTERNAL version: 0.6.0 alias: crypto-intel_qat alias: intel_qat description: Intel(R) QuickAssist Technology author: Intel license: Dual BSD/GPL srcversion: 6B1DC0E65056B6B09DAB4E6 depends: crc8,authenc retpoline: Y intree: Y name: intel_qat vermagic: 6.8.0-31-lowlatency SMP preempt mod_unload modversions sig_id: PKCS#7 signer: Build time autogenerated kernel key sig_key: 0B:ED:62:48:E7:92:6A:44:FE:56:30:8B:55:30:B0:0D:3D:5E:C3:6B sig_hashalgo: sha512 signature: 65:B7:AD:AA:11:70:BA:9B:13:F8:82:B4:8D:43:46:85:A5:BC:44:81:........

root@u2404:~# modinfo qat_c62x filename: /lib/modules/6.8.0-31-lowlatency/kernel/drivers/crypto/intel/qat/qat_c62x/qat_c62x.ko.zst import_ns: CRYPTO_QAT version: 0.6.0 description: Intel(R) QuickAssist Technology firmware: qat_c62x_mmp.bin firmware: qat_c62x.bin author: Intel license: Dual BSD/GPL srcversion: 0882E7103AF516331FAD058 alias: pci:v00008086d000037C8svsdbcsci* depends: intel_qat retpoline: Y intree: Y name: qat_c62x vermagic: 6.8.0-31-lowlatency SMP preempt mod_unload modversions sig_id: PKCS#7 signer: Build time autogenerated kernel key sig_key: 0B:ED:62:48:E7:92:6A:44:FE:56:30:8B:55:30:B0:0D:3D:5E:C3:6B sig_hashalgo: sha512 signature: 2C:64:54:0C:C9:66:ED:39:54:DE:6A:D6:EB:52:9F:C0:89:C4:9C:48:..........

root@u2404:~# modinfo qat_c62xvf filename: /lib/modules/6.8.0-31-lowlatency/kernel/drivers/crypto/intel/qat/qat_c62xvf/qat_c62xvf.ko.zst import_ns: CRYPTO_QAT version: 0.6.0 description: Intel(R) QuickAssist Technology author: Intel license: Dual BSD/GPL srcversion: 6E61CD68F4E8B48CFDE6CF6 alias: pci:v00008086d000037C9svsdbcsci* depends: intel_qat retpoline: Y intree: Y name: qat_c62xvf vermagic: 6.8.0-31-lowlatency SMP preempt mod_unload modversions sig_id: PKCS#7 signer: Build time autogenerated kernel key sig_key: 0B:ED:62:48:E7:92:6A:44:FE:56:30:8B:55:30:B0:0D:3D:5E:C3:6B sig_hashalgo: sha512 signature: 3E:20:30:B8:B1:97:00:E1:01:F0:11:16:18:CF:5A:F9:5E:E1:67:1A: .............

In the version of QAT modules in Ubuntu 24.04 is 0.6.0, we try to use at lesat QAT.L.4.16.0-00017 for QAT modules. However we cannot compile QAT.L.4.16.0 successfully even if the latest version QAT.L.4.25.0.

ptpetroc commented 5 months ago

Hello -- we are currently working on releasing a new QAT CE package that is compatible with the 6.8 kernel version.

This release is currently trending July/August '24 timeframe.

Best Regards, Patrick

ykshih commented 5 months ago

Hi Patrick @ptpetroc Thanks for your information.