]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: qat - fix DMA direction for compression on GEN2 devices
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Mon, 14 Jul 2025 07:07:49 +0000 (08:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:08:56 +0000 (12:08 +0200)
commit1c178ccb6caf10d86fd5d6104b640698bb8c976e
tree8d1df7346394ec18e86b91d22d40ef60032cd905
parent9ff4de5bd11a7d5852e994ee2dc6e0a7e6461c08
crypto: qat - fix DMA direction for compression on GEN2 devices

[ Upstream commit d41d75fe1b751ee6b347bf1cb1cfe9accc4fcb12 ]

QAT devices perform an additional integrity check during compression by
decompressing the output. Starting from QAT GEN4, this verification is
done in-line by the hardware. However, on GEN2 devices, the hardware
reads back the compressed output from the destination buffer and performs
a decompression operation using it as the source.

In the current QAT driver, destination buffers are always marked as
write-only. This is incorrect for QAT GEN2 compression, where the buffer
is also read during verification. Since commit 6f5dc7658094
("iommu/vt-d: Restore WO permissions on second-level paging entries"),
merged in v6.16-rc1, write-only permissions are strictly enforced, leading
to DMAR errors when using QAT GEN2 devices for compression, if VT-d is
enabled.

Mark the destination buffers as DMA_BIDIRECTIONAL. This ensures
compatibility with GEN2 devices, even though it is not required for
QAT GEN4 and later.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Fixes: cf5bb835b7c8 ("crypto: qat - fix DMA transfer direction")
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/intel/qat/qat_common/qat_bl.c
drivers/crypto/intel/qat/qat_common/qat_compression.c