]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: qat - add support for zstd
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Sat, 28 Mar 2026 22:29:47 +0000 (22:29 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 3 Apr 2026 00:56:13 +0000 (08:56 +0800)
commit879a4f78ea3f8ce113fb0e99b8ead85542133ceb
tree0e558db2eb657ca61fd6a579431c5bcc2289cb35
parent35ecb77ae0749a2f1b04872c9978d9d7ddbbeb79
crypto: qat - add support for zstd

Add support for the ZSTD algorithm for QAT GEN4, GEN5 and GEN6 via the
acomp API.

For GEN4 and GEN5, compression is performed in hardware using LZ4s, a
QAT-specific variant of LZ4. The compressed output is post-processed to
generate ZSTD sequences, and the ZSTD library is then used to produce
the final ZSTD stream via zstd_compress_sequences_and_literals(). Only
inputs between 8 KB and 512 KB are offloaded to the device. The minimum
size restriction will be relaxed once polling support is added. The
maximum size is limited by the use of pre-allocated per-CPU scratch
buffers. On these generations, only compression is offloaded to hardware;
decompression always falls back to software.

For GEN6, both compression and decompression are offloaded to the
accelerator, which natively supports the ZSTD algorithm. There is no
limit on the input buffer size supported. However, since GEN6 is limited
to a history size of 64 KB, decompression of frames compressed with a
larger history falls back to software.

Since GEN2 devices do not support ZSTD or LZ4s, add a mechanism that
prevents selecting GEN2 compression instances for ZSTD or LZ4s when a
GEN2 plug-in card is present on a system with an embedded GEN4, GEN5 or
GEN6 device.

In addition, modify the algorithm registration logic to allow
registering the correct implementation, i.e. LZ4s based for GEN4 and
GEN5 or native ZSTD for GEN6.

Co-developed-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Signed-off-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Laurent M Coquerel <laurent.m.coquerel@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
17 files changed:
drivers/crypto/intel/qat/Kconfig
drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c
drivers/crypto/intel/qat/qat_6xxx/adf_6xxx_hw_data.c
drivers/crypto/intel/qat/qat_common/Makefile
drivers/crypto/intel/qat/qat_common/adf_accel_devices.h
drivers/crypto/intel/qat/qat_common/adf_common_drv.h
drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c
drivers/crypto/intel/qat/qat_common/adf_init.c
drivers/crypto/intel/qat/qat_common/icp_qat_fw.h
drivers/crypto/intel/qat/qat_common/icp_qat_fw_comp.h
drivers/crypto/intel/qat/qat_common/icp_qat_hw.h
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c
drivers/crypto/intel/qat/qat_common/qat_comp_req.h
drivers/crypto/intel/qat/qat_common/qat_comp_zstd_utils.c [new file with mode: 0644]
drivers/crypto/intel/qat/qat_common/qat_comp_zstd_utils.h [new file with mode: 0644]
drivers/crypto/intel/qat/qat_common/qat_compression.c