Skip to content

Commit a93084c

Browse files
author
CKI KWF Bot
committed
Merge: crypto: iaa: update Intel IAA crypto driver to v6.15-rc1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/768 ``` JIRA: https://issues.redhat.com/browse/RHEL-87766 Upstream Status: 3 commits are merged into the linux.git 2 commits are from herbert/crypto-2.6.git Bring in the latest Intel IAA driver bugfixes and updates. Two commits have conflict in contexts due to missing commit which is a part of a bigger patchset which was not backported. Signed-off-by: Vladis Dronov <vdronov@redhat.com> ``` Approved-by: Herbert Xu <zxu@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 6a6fa8e + 7269198 commit a93084c

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

Documentation/driver-api/crypto/iaa/iaa-crypto.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ The available attributes are:
272272
echo async_irq > /sys/bus/dsa/drivers/crypto/sync_mode
273273

274274
Async mode without interrupts (caller must poll) can be enabled by
275-
writing 'async' to it::
275+
writing 'async' to it (please see Caveat)::
276276

277277
echo async > /sys/bus/dsa/drivers/crypto/sync_mode
278278

@@ -283,6 +283,13 @@ The available attributes are:
283283

284284
The default mode is 'sync'.
285285

286+
Caveat: since the only mechanism that iaa_crypto currently implements
287+
for async polling without interrupts is via the 'sync' mode as
288+
described earlier, writing 'async' to
289+
'/sys/bus/dsa/drivers/crypto/sync_mode' will internally enable the
290+
'sync' mode. This is to ensure correct iaa_crypto behavior until true
291+
async polling without interrupts is enabled in iaa_crypto.
292+
286293
.. _iaa_default_config:
287294

288295
IAA Default Configuration

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11467,6 +11467,7 @@ F: drivers/dma/ioat*
1146711467

1146811468
INTEL IAA CRYPTO DRIVER
1146911469
M: Kristen Accardi <kristen.c.accardi@intel.com>
11470+
M: Vinicius Costa Gomes <vinicius.gomes@intel.com>
1147011471
L: linux-crypto@vger.kernel.org
1147111472
S: Supported
1147211473
F: Documentation/driver-api/crypto/iaa/iaa-crypto.rst

drivers/crypto/intel/iaa/iaa_crypto_main.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int set_iaa_sync_mode(const char *name)
173173
async_mode = false;
174174
use_irq = false;
175175
} else if (sysfs_streq(name, "async")) {
176-
async_mode = true;
176+
async_mode = false;
177177
use_irq = false;
178178
} else if (sysfs_streq(name, "async_irq")) {
179179
async_mode = true;
@@ -1025,8 +1025,7 @@ static int iaa_remap_for_verify(struct device *dev, struct iaa_wq *iaa_wq,
10251025
static int iaa_compress_verify(struct crypto_tfm *tfm, struct acomp_req *req,
10261026
struct idxd_wq *wq,
10271027
dma_addr_t src_addr, unsigned int slen,
1028-
dma_addr_t dst_addr, unsigned int *dlen,
1029-
u32 compression_crc);
1028+
dma_addr_t dst_addr, unsigned int *dlen);
10301029

10311030
static void iaa_desc_complete(struct idxd_desc *idxd_desc,
10321031
enum idxd_complete_type comp_type,
@@ -1092,10 +1091,10 @@ static void iaa_desc_complete(struct idxd_desc *idxd_desc,
10921091
}
10931092

10941093
if (ctx->compress && compression_ctx->verify_compress) {
1094+
u32 *compression_crc = acomp_request_ctx(ctx->req);
10951095
dma_addr_t src_addr, dst_addr;
1096-
u32 compression_crc;
10971096

1098-
compression_crc = idxd_desc->iax_completion->crc;
1097+
*compression_crc = idxd_desc->iax_completion->crc;
10991098

11001099
ret = iaa_remap_for_verify(dev, iaa_wq, ctx->req, &src_addr, &dst_addr);
11011100
if (ret) {
@@ -1105,8 +1104,7 @@ static void iaa_desc_complete(struct idxd_desc *idxd_desc,
11051104
}
11061105

11071106
ret = iaa_compress_verify(ctx->tfm, ctx->req, iaa_wq->wq, src_addr,
1108-
ctx->req->slen, dst_addr, &ctx->req->dlen,
1109-
compression_crc);
1107+
ctx->req->slen, dst_addr, &ctx->req->dlen);
11101108
if (ret) {
11111109
dev_dbg(dev, "%s: compress verify failed ret=%d\n", __func__, ret);
11121110
err = -EIO;
@@ -1136,11 +1134,11 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
11361134
struct idxd_wq *wq,
11371135
dma_addr_t src_addr, unsigned int slen,
11381136
dma_addr_t dst_addr, unsigned int *dlen,
1139-
u32 *compression_crc,
11401137
bool disable_async)
11411138
{
11421139
struct iaa_device_compression_mode *active_compression_mode;
11431140
struct iaa_compression_ctx *ctx = crypto_tfm_ctx(tfm);
1141+
u32 *compression_crc = acomp_request_ctx(req);
11441142
struct iaa_device *iaa_device;
11451143
struct idxd_desc *idxd_desc;
11461144
struct iax_hw_desc *desc;
@@ -1193,8 +1191,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
11931191
" src_addr %llx, dst_addr %llx\n", __func__,
11941192
active_compression_mode->name,
11951193
src_addr, dst_addr);
1196-
} else if (ctx->async_mode && !disable_async)
1197-
req->base.data = idxd_desc;
1194+
}
11981195

11991196
dev_dbg(dev, "%s: compression mode %s,"
12001197
" desc->src1_addr %llx, desc->src1_size %d,"
@@ -1288,11 +1285,11 @@ static int iaa_remap_for_verify(struct device *dev, struct iaa_wq *iaa_wq,
12881285
static int iaa_compress_verify(struct crypto_tfm *tfm, struct acomp_req *req,
12891286
struct idxd_wq *wq,
12901287
dma_addr_t src_addr, unsigned int slen,
1291-
dma_addr_t dst_addr, unsigned int *dlen,
1292-
u32 compression_crc)
1288+
dma_addr_t dst_addr, unsigned int *dlen)
12931289
{
12941290
struct iaa_device_compression_mode *active_compression_mode;
12951291
struct iaa_compression_ctx *ctx = crypto_tfm_ctx(tfm);
1292+
u32 *compression_crc = acomp_request_ctx(req);
12961293
struct iaa_device *iaa_device;
12971294
struct idxd_desc *idxd_desc;
12981295
struct iax_hw_desc *desc;
@@ -1352,10 +1349,10 @@ static int iaa_compress_verify(struct crypto_tfm *tfm, struct acomp_req *req,
13521349
goto err;
13531350
}
13541351

1355-
if (compression_crc != idxd_desc->iax_completion->crc) {
1352+
if (*compression_crc != idxd_desc->iax_completion->crc) {
13561353
ret = -EINVAL;
13571354
dev_dbg(dev, "(verify) iaa comp/decomp crc mismatch:"
1358-
" comp=0x%x, decomp=0x%x\n", compression_crc,
1355+
" comp=0x%x, decomp=0x%x\n", *compression_crc,
13591356
idxd_desc->iax_completion->crc);
13601357
print_hex_dump(KERN_INFO, "cmp-rec: ", DUMP_PREFIX_OFFSET,
13611358
8, 1, idxd_desc->iax_completion, 64, 0);
@@ -1431,8 +1428,7 @@ static int iaa_decompress(struct crypto_tfm *tfm, struct acomp_req *req,
14311428
" src_addr %llx, dst_addr %llx\n", __func__,
14321429
active_compression_mode->name,
14331430
src_addr, dst_addr);
1434-
} else if (ctx->async_mode && !disable_async)
1435-
req->base.data = idxd_desc;
1431+
}
14361432

14371433
dev_dbg(dev, "%s: decompression mode %s,"
14381434
" desc->src1_addr %llx, desc->src1_size %d,"
@@ -1503,7 +1499,6 @@ static int iaa_comp_acompress(struct acomp_req *req)
15031499
bool disable_async = false;
15041500
int nr_sgs, cpu, ret = 0;
15051501
struct iaa_wq *iaa_wq;
1506-
u32 compression_crc;
15071502
struct idxd_wq *wq;
15081503
struct device *dev;
15091504
int order = -1;
@@ -1537,7 +1532,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
15371532
iaa_wq = idxd_wq_get_private(wq);
15381533

15391534
if (!req->dst) {
1540-
gfp_t flags = req->flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC;
1535+
gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC;
15411536

15421537
/* incompressible data will always be < 2 * slen */
15431538
req->dlen = 2 * req->slen;
@@ -1580,7 +1575,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
15801575
req->dst, req->dlen, sg_dma_len(req->dst));
15811576

15821577
ret = iaa_compress(tfm, req, wq, src_addr, req->slen, dst_addr,
1583-
&req->dlen, &compression_crc, disable_async);
1578+
&req->dlen, disable_async);
15841579
if (ret == -EINPROGRESS)
15851580
return ret;
15861581

@@ -1592,7 +1587,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
15921587
}
15931588

15941589
ret = iaa_compress_verify(tfm, req, wq, src_addr, req->slen,
1595-
dst_addr, &req->dlen, compression_crc);
1590+
dst_addr, &req->dlen);
15961591
if (ret)
15971592
dev_dbg(dev, "asynchronous compress verification failed ret=%d\n", ret);
15981593

@@ -1619,7 +1614,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
16191614

16201615
static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req)
16211616
{
1622-
gfp_t flags = req->flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
1617+
gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
16231618
GFP_KERNEL : GFP_ATOMIC;
16241619
struct crypto_tfm *tfm = req->base.tfm;
16251620
dma_addr_t src_addr, dst_addr;
@@ -1823,6 +1818,7 @@ static struct acomp_alg iaa_acomp_fixed_deflate = {
18231818
.compress = iaa_comp_acompress,
18241819
.decompress = iaa_comp_adecompress,
18251820
.dst_free = dst_free,
1821+
.reqsize = sizeof(u32),
18261822
.base = {
18271823
.cra_name = "deflate",
18281824
.cra_driver_name = "deflate-iaa",

0 commit comments

Comments
 (0)