Skip to contentSkip to conversation

alg: ahash: Several tests fail during boot on Turris Omnia

REGRESSION New Klaus Kudielka 6 participants 79 messages Oct 5, 2024 – Jun 17, 2025 Page 2 of 2

Subsystems (4)
lore
Share & tools
lore
maintainer
#68 lore raw

Re: crypto: marvell/cesa - dma_alloc_coherent broken but kmalloc + dma_map_single works

In reply to Herbert Xu
Quoted 5 lines · Herbert Xu

So here is the latest debugging patch with dma_map_single on top of cryptodev. Note that the partial hash mismatch code is buggy but it doesn't matter because it still prints enough info for us to interpret.

Oops, I screwed up that patch. Here is the corrected version.

Thanks,

Signature · 4 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
drivers/crypto/marvell/cesa/hash.c +10 -4
index 6815eddc9068..5c46cd267789 100644
@@ -49,8 +49,7 @@ mv_cesa_ahash_req_iter_next_op(struct mv_cesa_ahash_dma_iter *iter)
 static inline int
 mv_cesa_ahash_dma_alloc_cache(struct mv_cesa_ahash_dma_req *req, gfp_t flags)
 {
-	req->cache = dma_pool_alloc(cesa_dev->dma->cache_pool, flags,
-				    &req->cache_dma);
+	req->cache = kmalloc(CESA_MAX_HASH_BLOCK_SIZE, flags);
 	if (!req->cache)
 		return -ENOMEM;
 
@@ -63,8 +62,8 @@ mv_cesa_ahash_dma_free_cache(struct mv_cesa_ahash_dma_req *req)
 	if (!req->cache)
 		return;
 
-	dma_pool_free(cesa_dev->dma->cache_pool, req->cache,
-		      req->cache_dma);
+	dma_unmap_single(cesa_dev->dev, req->cache_dma, CESA_MAX_HASH_BLOCK_SIZE, DMA_TO_DEVICE);
+	kfree(req->cache);
 }
 
 static int mv_cesa_ahash_dma_alloc_padding(struct mv_cesa_ahash_dma_req *req,
@@ -533,6 +532,13 @@ mv_cesa_ahash_dma_add_cache(struct mv_cesa_tdma_chain *chain,
 
 	memcpy(ahashdreq->cache, creq->cache, creq->cache_ptr);
 
+	ahashdreq->cache_dma = dma_map_single(cesa_dev->dev, ahashdreq->cache, CESA_MAX_HASH_BLOCK_SIZE, DMA_TO_DEVICE);
+	if (dma_mapping_error(cesa_dev->dev, ahashdreq->cache_dma)) {
+		dev_err(cesa_dev->dev, "dma_map_single failed\n");
+		kfree(ahashdreq->cache);
+		return -ENOMEM;
+	}
+
 	return mv_cesa_dma_add_data_transfer(chain,
 					     CESA_SA_DATA_SRAM_OFFSET,
 					     ahashdreq->cache_dma,
drivers/crypto/marvell/cesa/cesa.c +2 -0
index 9c21f5d835d2..fd7f43575cb2 100644
@@ -127,6 +127,8 @@ static irqreturn_t mv_cesa_int(int irq, void *priv)
 		if (!(status & mask))
 			break;
 
+		pr_err("mv_cesa_int: %d 0x%x 0x%x\n", engine->id, status, mask);
+
 		/*
 		 * TODO: avoid clearing the FPGA_INT_STATUS if this not
 		 * relevant on some platforms.
drivers/crypto/marvell/cesa/hash.c +5 -0
index 6815eddc9068..ff0735aaed7d 100644
@@ -397,6 +397,8 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
 	}
 
 	atomic_sub(ahashreq->nbytes, &engine->load);
+
+	pr_err("mv_cesa_ahash_complete: %d 0x%lx\n", engine->id, (unsigned long)ahashreq);
 }
 
 static void mv_cesa_ahash_prepare(struct crypto_async_request *req,
@@ -418,6 +420,8 @@ static void mv_cesa_ahash_req_cleanup(struct crypto_async_request *req)
 	struct ahash_request *ahashreq = ahash_request_cast(req);
 	struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq);
 
+	pr_err("mv_cesa_ahash_req_cleanup: %d 0x%lx\n", creq->base.engine->id, (unsigned long)ahashreq);
+
 	if (creq->last_req)
 		mv_cesa_ahash_last_cleanup(ahashreq);
 
@@ -796,6 +800,7 @@ static int mv_cesa_ahash_queue_req(struct ahash_request *req)
 	engine = mv_cesa_select_engine(req->nbytes);
 	mv_cesa_ahash_prepare(&req->base, engine);
 
+	pr_err("mv_cesa_ahash_queue_req: %d 0x%lx %d %d\n", engine->id, (unsigned long)req, req->nbytes, creq->last_req);
 	ret = mv_cesa_queue_req(&req->base, &creq->base);
 
 	if (mv_cesa_req_needs_cleanup(&req->base, ret))
drivers/crypto/marvell/cesa/tdma.c +5 -0
index 243305354420..55860b480dd6 100644
@@ -47,6 +47,8 @@ void mv_cesa_dma_step(struct mv_cesa_req *dreq)
 	engine->chain_hw.last = dreq->chain.last;
 	spin_unlock_bh(&engine->lock);
 
+	pr_err("mv_cesa_dma_step: %d 0x%lx 0x%lx 0x%lx\n", engine->id, (unsigned long)dreq, (unsigned long)dreq->chain.first->cur_dma, (unsigned long)dreq->chain.last->cur_dma);
+
 	writel_relaxed(0, engine->regs + CESA_SA_CFG);
 
 	mv_cesa_set_int_mask(engine, CESA_SA_INT_ACC0_IDMA_DONE);
@@ -137,6 +139,7 @@ int mv_cesa_tdma_process(struct mv_cesa_engine *engine, u32 status)
 	int res = 0;
 
 	tdma_cur = readl(engine->regs + CESA_TDMA_CUR);
+	pr_err("mv_cesa_tdma_process: %d 0x%lx\n", engine->id, (unsigned long)tdma_cur);
 
 	for (tdma = engine->chain_hw.first; tdma; tdma = next) {
 		spin_lock_bh(&engine->lock);
@@ -186,6 +189,8 @@ int mv_cesa_tdma_process(struct mv_cesa_engine *engine, u32 status)
 			break;
 	}
 
+	pr_err("mv_cesa_tdma_process: %d %d 0x%lx\n", engine->id, res, (unsigned long)req);
+
 	/*
 	 * Save the last request in error to engine->req, so that the core
 	 * knows which request was faulty
drivers/crypto/marvell/cesa/hash.c +21 -0
index 6815eddc9068..230501fe843b 100644
@@ -374,6 +374,12 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
 
 		memcpy(ahashreq->result, data, digsize);
 	} else {
+		struct {
+			u32 digest[8];
+			u64 len;
+		} state;
+
+		memcpy(state.digest, creq->state, digsize);
 		for (i = 0; i < digsize / 4; i++)
 			creq->state[i] = readl_relaxed(engine->regs +
 						       CESA_IVDIG(i));
@@ -393,6 +399,21 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
 				for (i = 0; i < digsize / 4; i++)
 					result[i] = cpu_to_be32(creq->state[i]);
 			}
+		} else {
+			HASH_FBREQ_ON_STACK(fbreq, ahashreq);
+
+			crypto_ahash_import_core(fbreq, &state);
+			crypto_ahash_update(fbreq);
+			crypto_ahash_export_core(fbreq, &state);
+			if (memcmp(state.digest, creq->state, digsize)) {
+				pr_err("mv_cesa_ahash_complete partial hash mismatch\n");
+				print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET,
+						16, 1,
+						state.digest, digsize, false);
+				print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET,
+						16, 1,
+						creq->state, digsize, false);
+			}
 		}
 	}
 
#69 lore raw

Re: crypto: marvell/cesa - dma_alloc_coherent broken but kmalloc + dma_map_single works

Quoted 9 lines · Herbert Xu
Quoted 5 lines · Herbert Xu

So here is the latest debugging patch with dma_map_single on top of cryptodev. Note that the partial hash mismatch code is buggy but it doesn't matter because it still prints enough info for us to interpret.

Oops, I screwed up that patch. Here is the corrected version.

Hello

Here is the result:
http://kernel.montjoie.ovh/479404.log

I have built by adding also your "crypto: marvell/cesa - Fix engine load inaccuracy"

Thanks
Regards

maintainer
#70 lore raw

Re: crypto: marvell/cesa - dma_alloc_coherent broken but kmalloc + dma_map_single works

Quoted 3 lines · Corentin Labbe

Here is the result:
http://kernel.montjoie.ovh/479404.log

So the corruptions have come back, although somewhat less than before as one algorithm managed to pass all the tests.

At least we've proven that adding the printk's makes the errors a lot more frequent :)

Quoted 1 line

I have built by adding also your "crypto: marvell/cesa - Fix engine load inaccuracy"

That shouldn't affect things either way.

So now all the corruptions are all on the final hash.

Can you boot this a few times to see if the errors are always the same? I'm particularly interested to see if we've managed to crush the errors on the partial hashes or was it just pure luck.

Intriguingly the one error that went away (sha256) was actually a partial hash corruption, and sha256 now passes all the tests.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#71 lore raw

Re: crypto: marvell/cesa - dma_alloc_coherent broken but kmalloc + dma_map_single works

In reply to Corentin Labbe
Quoted 5 lines · Corentin Labbe

Here is the result:
http://kernel.montjoie.ovh/479404.log

I have built by adding also your "crypto: marvell/cesa - Fix engine load inaccuracy"

Please try this patch on top of the current mainline tree.

I've force-enabled the software finalisation code and switched it over to kmalloc + dma_map_single.

Thanks,

Signature · 4 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
drivers/crypto/marvell/cesa/hash.c +21 -13
index 6815eddc9068..e5b1d6a9add5 100644
@@ -49,8 +49,7 @@ mv_cesa_ahash_req_iter_next_op(struct mv_cesa_ahash_dma_iter *iter)
 static inline int
 mv_cesa_ahash_dma_alloc_cache(struct mv_cesa_ahash_dma_req *req, gfp_t flags)
 {
-	req->cache = dma_pool_alloc(cesa_dev->dma->cache_pool, flags,
-				    &req->cache_dma);
+	req->cache = kmalloc(CESA_MAX_HASH_BLOCK_SIZE, flags);
 	if (!req->cache)
 		return -ENOMEM;
 
@@ -63,18 +62,14 @@ mv_cesa_ahash_dma_free_cache(struct mv_cesa_ahash_dma_req *req)
 	if (!req->cache)
 		return;
 
-	dma_pool_free(cesa_dev->dma->cache_pool, req->cache,
-		      req->cache_dma);
+	dma_unmap_single(cesa_dev->dev, req->cache_dma, CESA_MAX_HASH_BLOCK_SIZE, DMA_TO_DEVICE);
+	kfree(req->cache);
 }
 
 static int mv_cesa_ahash_dma_alloc_padding(struct mv_cesa_ahash_dma_req *req,
 					   gfp_t flags)
 {
-	if (req->padding)
-		return 0;
-
-	req->padding = dma_pool_alloc(cesa_dev->dma->padding_pool, flags,
-				      &req->padding_dma);
+	req->padding = kmalloc(72, flags);
 	if (!req->padding)
 		return -ENOMEM;
 
@@ -86,9 +81,8 @@ static void mv_cesa_ahash_dma_free_padding(struct mv_cesa_ahash_dma_req *req)
 	if (!req->padding)
 		return;
 
-	dma_pool_free(cesa_dev->dma->padding_pool, req->padding,
-		      req->padding_dma);
-	req->padding = NULL;
+	dma_unmap_single(cesa_dev->dev, req->padding_dma, 72, DMA_TO_DEVICE);
+	kfree(req->padding);
 }
 
 static inline void mv_cesa_ahash_dma_last_cleanup(struct ahash_request *req)
@@ -533,6 +527,13 @@ mv_cesa_ahash_dma_add_cache(struct mv_cesa_tdma_chain *chain,
 
 	memcpy(ahashdreq->cache, creq->cache, creq->cache_ptr);
 
+	ahashdreq->cache_dma = dma_map_single(cesa_dev->dev, ahashdreq->cache, CESA_MAX_HASH_BLOCK_SIZE, DMA_TO_DEVICE);
+	if (dma_mapping_error(cesa_dev->dev, ahashdreq->cache_dma)) {
+		dev_err(cesa_dev->dev, "dma_map_single failed\n");
+		kfree(ahashdreq->cache);
+		return -ENOMEM;
+	}
+
 	return mv_cesa_dma_add_data_transfer(chain,
 					     CESA_SA_DATA_SRAM_OFFSET,
 					     ahashdreq->cache_dma,
@@ -556,7 +557,7 @@ mv_cesa_ahash_dma_last_req(struct mv_cesa_tdma_chain *chain,
 	 * If the transfer is smaller than our maximum length, and we have
 	 * some data outstanding, we can ask the engine to finish the hash.
 	 */
-	if (creq->len <= CESA_SA_DESC_MAC_SRC_TOTAL_LEN_MAX && frag_len) {
+	if (0 && creq->len <= CESA_SA_DESC_MAC_SRC_TOTAL_LEN_MAX && frag_len) {
 		op = mv_cesa_dma_add_frag(chain, &creq->op_tmpl, frag_len,
 					  flags);
 		if (IS_ERR(op))
@@ -588,6 +589,13 @@ mv_cesa_ahash_dma_last_req(struct mv_cesa_tdma_chain *chain,
 
 	trailerlen = mv_cesa_ahash_pad_req(creq, ahashdreq->padding);
 
+	ahashdreq->padding_dma = dma_map_single(cesa_dev->dev, ahashdreq->padding, 72, DMA_TO_DEVICE);
+	if (dma_mapping_error(cesa_dev->dev, ahashdreq->padding_dma)) {
+		dev_err(cesa_dev->dev, "dma_map_single failed\n");
+		kfree(ahashdreq->padding);
+		return ERR_PTR(-ENOMEM);
+	}
+
 	len = min(CESA_SA_SRAM_PAYLOAD_SIZE - frag_len, trailerlen);
 	if (len) {
 		ret = mv_cesa_dma_add_data_transfer(chain,
drivers/crypto/marvell/cesa/hash.c +21 -0
index 6815eddc9068..230501fe843b 100644
@@ -374,6 +374,12 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
 
 		memcpy(ahashreq->result, data, digsize);
 	} else {
+		struct {
+			u32 digest[8];
+			u64 len;
+		} state;
+
+		memcpy(state.digest, creq->state, digsize);
 		for (i = 0; i < digsize / 4; i++)
 			creq->state[i] = readl_relaxed(engine->regs +
 						       CESA_IVDIG(i));
@@ -393,6 +399,21 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
 				for (i = 0; i < digsize / 4; i++)
 					result[i] = cpu_to_be32(creq->state[i]);
 			}
+		} else {
+			HASH_FBREQ_ON_STACK(fbreq, ahashreq);
+
+			crypto_ahash_import_core(fbreq, &state);
+			crypto_ahash_update(fbreq);
+			crypto_ahash_export_core(fbreq, &state);
+			if (memcmp(state.digest, creq->state, digsize)) {
+				pr_err("mv_cesa_ahash_complete partial hash mismatch\n");
+				print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET,
+						16, 1,
+						state.digest, digsize, false);
+				print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET,
+						16, 1,
+						creq->state, digsize, false);
+			}
 		}
 	}
 
drivers/crypto/marvell/cesa/cesa.c +2 -0
index 9c21f5d835d2..fd7f43575cb2 100644
@@ -127,6 +127,8 @@ static irqreturn_t mv_cesa_int(int irq, void *priv)
 		if (!(status & mask))
 			break;
 
+		pr_err("mv_cesa_int: %d 0x%x 0x%x\n", engine->id, status, mask);
+
 		/*
 		 * TODO: avoid clearing the FPGA_INT_STATUS if this not
 		 * relevant on some platforms.
drivers/crypto/marvell/cesa/hash.c +5 -0
index 6815eddc9068..ff0735aaed7d 100644
@@ -397,6 +397,8 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
 	}
 
 	atomic_sub(ahashreq->nbytes, &engine->load);
+
+	pr_err("mv_cesa_ahash_complete: %d 0x%lx\n", engine->id, (unsigned long)ahashreq);
 }
 
 static void mv_cesa_ahash_prepare(struct crypto_async_request *req,
@@ -418,6 +420,8 @@ static void mv_cesa_ahash_req_cleanup(struct crypto_async_request *req)
 	struct ahash_request *ahashreq = ahash_request_cast(req);
 	struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq);
 
+	pr_err("mv_cesa_ahash_req_cleanup: %d 0x%lx\n", creq->base.engine->id, (unsigned long)ahashreq);
+
 	if (creq->last_req)
 		mv_cesa_ahash_last_cleanup(ahashreq);
 
@@ -796,6 +800,7 @@ static int mv_cesa_ahash_queue_req(struct ahash_request *req)
 	engine = mv_cesa_select_engine(req->nbytes);
 	mv_cesa_ahash_prepare(&req->base, engine);
 
+	pr_err("mv_cesa_ahash_queue_req: %d 0x%lx %d %d\n", engine->id, (unsigned long)req, req->nbytes, creq->last_req);
 	ret = mv_cesa_queue_req(&req->base, &creq->base);
 
 	if (mv_cesa_req_needs_cleanup(&req->base, ret))
drivers/crypto/marvell/cesa/tdma.c +5 -0
index 243305354420..55860b480dd6 100644
@@ -47,6 +47,8 @@ void mv_cesa_dma_step(struct mv_cesa_req *dreq)
 	engine->chain_hw.last = dreq->chain.last;
 	spin_unlock_bh(&engine->lock);
 
+	pr_err("mv_cesa_dma_step: %d 0x%lx 0x%lx 0x%lx\n", engine->id, (unsigned long)dreq, (unsigned long)dreq->chain.first->cur_dma, (unsigned long)dreq->chain.last->cur_dma);
+
 	writel_relaxed(0, engine->regs + CESA_SA_CFG);
 
 	mv_cesa_set_int_mask(engine, CESA_SA_INT_ACC0_IDMA_DONE);
@@ -137,6 +139,7 @@ int mv_cesa_tdma_process(struct mv_cesa_engine *engine, u32 status)
 	int res = 0;
 
 	tdma_cur = readl(engine->regs + CESA_TDMA_CUR);
+	pr_err("mv_cesa_tdma_process: %d 0x%lx\n", engine->id, (unsigned long)tdma_cur);
 
 	for (tdma = engine->chain_hw.first; tdma; tdma = next) {
 		spin_lock_bh(&engine->lock);
@@ -186,6 +189,8 @@ int mv_cesa_tdma_process(struct mv_cesa_engine *engine, u32 status)
 			break;
 	}
 
+	pr_err("mv_cesa_tdma_process: %d %d 0x%lx\n", engine->id, res, (unsigned long)req);
+
 	/*
 	 * Save the last request in error to engine->req, so that the core
 	 * knows which request was faulty
#72 lore raw

Re: crypto: marvell/cesa - dma_alloc_coherent broken but kmalloc + dma_map_single works

Quoted 5 lines · Herbert Xu
Quoted 4 lines · Corentin Labbe

Here is the result:
http://kernel.montjoie.ovh/479404.log

Quoted 9 lines
Quoted 1 line

I have built by adding also your "crypto: marvell/cesa - Fix engine load inaccuracy"

Please try this patch on top of the current mainline tree.

I've force-enabled the software finalisation code and switched it over to kmalloc + dma_map_single.

Thanks,

Hello

I have tried on top of torvalds/master 90b83efa6701656e02c86e7df2cb1765ea602d07

https://kernel.montjoie.ovh/479785.log

Regards

maintainer
#73 lore raw

Re: crypto: marvell/cesa - dma_alloc_coherent broken but kmalloc + dma_map_single works

In reply to Herbert Xu
Quoted 4 lines · Herbert Xu

I think we've made progress. All the simple hashes have passed and now we're only failing on hmac. So it looks it was the coherent memory being incoherent.

I've analysed the hmac errors and the good news is that they all appear to be caused by a genuine bug in the driver. When the final update is zero-length which the hardware can't handle, the driver fallback code is broken for hmac.

I'm working on a fix.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#74 lore raw

Re: [PATCH] crypto: marvell/cesa - Avoid empty transfer descriptor

In reply to Klaus Kudielka
Quoted 8 lines · Klaus Kudielka

Okay, so now I have two printk patches on top of the current cryptodev tree.

I have enabled CRYPTO_SELFTESTS

- Three successful reboot / modprobe marvell-cesa. All self-tests passed.
- But the whole self-tests sequence now take approx. 2 minutes, instead of 15 seconds with plain v6.15-rc5
- And the journal gets huge. 24k lines. I am attaching a gzipped version, hope this works.

Something doesn't look right. There are zero ahash lines in your dmesg. IOW all the output was from skcipher tests alone.

That could explain why ahash appears to be working.

What does /proc/crypto show after boot-up? Do the cesa ahash algorithms show up as tested in there?

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#75 lore raw

Re: [PATCH] crypto: marvell/cesa - Avoid empty transfer descriptor

Quoted 10 lines · Herbert Xu

Something doesn't look right.  There are zero ahash lines in your dmesg.  IOW all the output was from skcipher tests alone.

That could explain why ahash appears to be working.

What does /proc/crypto show after boot-up? Do the cesa ahash algorithms show up as tested in there?

Cheers,

Plain cryptodev tree, marvell-cesa as module.
Directly after boot, only the builtin crc32c-generic shows up.
After loading the module, the marvell-cesa ahash show up with "selftest : passed". But whether they REALLY were tested, I can't say.

# cat /proc/crypto 
name         : crc32c
driver       : crc32c-generic
module       : kernel
priority     : 100
refcnt       : 1
selftest     : passed
internal     : no
type         : shash
blocksize    : 1
digestsize   : 4
# modprobe marvell-cesa
# cat /proc/crypto 
name         : hmac(sha256)
driver       : mv-hmac-sha256
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 32

name : hmac(sha1)
driver : mv-hmac-sha1
module : marvell_cesa
priority : 0
refcnt : 1
selftest : passed
internal : no
type : ahash
async : yes
blocksize : 64
digestsize : 20

name : hmac(md5)
driver : mv-hmac-md5
module : marvell_cesa
priority : 0
refcnt : 1
selftest : passed
internal : no
type : ahash
async : yes
blocksize : 64
digestsize : 16

name : sha256
driver : mv-sha256
module : marvell_cesa
priority : 0
refcnt : 1
selftest : passed
internal : no
type : ahash
async : yes
blocksize : 64
digestsize : 32

name : sha1
driver : mv-sha1
module : marvell_cesa
priority : 0
refcnt : 1
selftest : passed
internal : no
type : ahash
async : yes
blocksize : 64
digestsize : 20

name : md5
driver : mv-md5
module : marvell_cesa
priority : 0
refcnt : 1
selftest : passed
internal : no
type : ahash
async : yes
blocksize : 64
digestsize : 16

name : cbc(aes)
driver : mv-cbc-aes
module : marvell_cesa
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : yes
blocksize : 16
min keysize : 16
max keysize : 32
ivsize : 16
chunksize : 16
walksize : 16
statesize : 0

name : ecb(aes)
driver : mv-ecb-aes
module : marvell_cesa
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : yes
blocksize : 16
min keysize : 16
max keysize : 32
ivsize : 0
chunksize : 16
walksize : 16
statesize : 0

name : cbc(des3_ede)
driver : mv-cbc-des3-ede
module : marvell_cesa
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : yes
blocksize : 8
min keysize : 24
max keysize : 24
ivsize : 8
chunksize : 8
walksize : 8
statesize : 0

name : ecb(des3_ede)
driver : mv-ecb-des3-ede
module : marvell_cesa
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : yes
blocksize : 8
min keysize : 24
max keysize : 24
ivsize : 0
chunksize : 8
walksize : 8
statesize : 0

name : cbc(des)
driver : mv-cbc-des
module : marvell_cesa
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : yes
blocksize : 8
min keysize : 8
max keysize : 8
ivsize : 8
chunksize : 8
walksize : 8
statesize : 0

name : ecb(des)
driver : mv-ecb-des
module : marvell_cesa
priority : 300
refcnt : 1
selftest : passed
internal : no
type : skcipher
async : yes
blocksize : 8
min keysize : 8
max keysize : 8
ivsize : 0
chunksize : 8
walksize : 8
statesize : 0

name : crc32c
driver : crc32c-generic
module : kernel
priority : 100
refcnt : 1
selftest : passed
internal : no
type : shash
blocksize : 1
digestsize : 4

# dmesg | tail
[    4.883366] mv88e6085 f1072004.mdio-mii:10 lan2: configuring for phy/gmii link mode
[    4.884517] br0: port 3(lan4) entered blocking state
[    4.884527] br0: port 3(lan4) entered forwarding state
[   88.867746] marvell-cesa f1090000.crypto: CESA device successfully registered
[   89.034292] alg: skcipher: skipping comparison tests for mv-cbc-des because cbc(des-generic) is unavailable
[   89.045265] alg: skcipher: skipping comparison tests for mv-cbc-des3-ede because cbc(des3_ede-generic) is unavailable
[   89.052456] alg: skcipher: skipping comparison tests for mv-cbc-aes because cbc(aes-generic) is unavailable
[   89.099763] alg: skcipher: skipping comparison tests for mv-ecb-aes because ecb(aes-generic) is unavailable
[   89.099819] alg: skcipher: skipping comparison tests for mv-ecb-des3-ede because ecb(des3_ede-generic) is unavailable
[   89.099908] alg: skcipher: skipping comparison tests for mv-ecb-des because ecb(des-generic) is unavailable
#76 lore raw

Re: [PATCH] crypto: marvell/cesa - Avoid empty transfer descriptor

Hello,

Plain v6.16-rc1 with marvell-cesa as module and CRYPTO_SELFTESTS enabled. Identical behaviour as reported previously with the cryptodev tree (see below).

According to /proc/crypto, all marvell-cesa selftests (including ahash) appear to pass reliably again.

If we can trust the information in /proc/crypto, I would suggest to revert commit e845d2399a00f866f287e0cefbd4fc7d8ef0d2f7 ("crypto: marvell/cesa - Disable hash algorithms")

Best regards, Klaus

Quoted 227 lines · Klaus Kudielka
Quoted 10 lines · Herbert Xu

Something doesn't look right.  There are zero ahash lines in your dmesg.  IOW all the output was from skcipher tests alone.

That could explain why ahash appears to be working.

What does /proc/crypto show after boot-up? Do the cesa ahash algorithms show up as tested in there?

Cheers,

Plain cryptodev tree, marvell-cesa as module.
Directly after boot, only the builtin crc32c-generic shows up.
After loading the module, the marvell-cesa ahash show up with "selftest : passed". But whether they REALLY were tested, I can't say.

# cat /proc/crypto 
name         : crc32c
driver       : crc32c-generic
module       : kernel
priority     : 100
refcnt       : 1
selftest     : passed
internal     : no
type         : shash
blocksize    : 1
digestsize   : 4
# modprobe marvell-cesa
# cat /proc/crypto 
name         : hmac(sha256)
driver       : mv-hmac-sha256
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 32

name         : hmac(sha1)
driver       : mv-hmac-sha1
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 20

name         : hmac(md5)
driver       : mv-hmac-md5
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 16

name         : sha256
driver       : mv-sha256
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 32

name         : sha1
driver       : mv-sha1
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 20

name         : md5
driver       : mv-md5
module       : marvell_cesa
priority     : 0
refcnt       : 1
selftest     : passed
internal     : no
type         : ahash
async        : yes
blocksize    : 64
digestsize   : 16

name         : cbc(aes)
driver       : mv-cbc-aes
module       : marvell_cesa
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 16
chunksize    : 16
walksize     : 16
statesize    : 0

name         : ecb(aes)
driver       : mv-ecb-aes
module       : marvell_cesa
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 0
chunksize    : 16
walksize     : 16
statesize    : 0

name         : cbc(des3_ede)
driver       : mv-cbc-des3-ede
module       : marvell_cesa
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 24
max keysize  : 24
ivsize       : 8
chunksize    : 8
walksize     : 8
statesize    : 0

name         : ecb(des3_ede)
driver       : mv-ecb-des3-ede
module       : marvell_cesa
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 24
max keysize  : 24
ivsize       : 0
chunksize    : 8
walksize     : 8
statesize    : 0

name         : cbc(des)
driver       : mv-cbc-des
module       : marvell_cesa
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 8
max keysize  : 8
ivsize       : 8
chunksize    : 8
walksize     : 8
statesize    : 0

name         : ecb(des)
driver       : mv-ecb-des
module       : marvell_cesa
priority     : 300
refcnt       : 1
selftest     : passed
internal     : no
type         : skcipher
async        : yes
blocksize    : 8
min keysize  : 8
max keysize  : 8
ivsize       : 0
chunksize    : 8
walksize     : 8
statesize    : 0

name         : crc32c
driver       : crc32c-generic
module       : kernel
priority     : 100
refcnt       : 1
selftest     : passed
internal     : no
type         : shash
blocksize    : 1
digestsize   : 4

# dmesg | tail
[    4.883366] mv88e6085 f1072004.mdio-mii:10 lan2: configuring for phy/gmii link mode
[    4.884517] br0: port 3(lan4) entered blocking state
[    4.884527] br0: port 3(lan4) entered forwarding state
[   88.867746] marvell-cesa f1090000.crypto: CESA device successfully registered
[   89.034292] alg: skcipher: skipping comparison tests for mv-cbc-des because cbc(des-generic) is unavailable
[   89.045265] alg: skcipher: skipping comparison tests for mv-cbc-des3-ede because cbc(des3_ede-generic) is unavailable
[   89.052456] alg: skcipher: skipping comparison tests for mv-cbc-aes because cbc(aes-generic) is unavailable
[   89.099763] alg: skcipher: skipping comparison tests for mv-ecb-aes because ecb(aes-generic) is unavailable
[   89.099819] alg: skcipher: skipping comparison tests for mv-ecb-des3-ede because ecb(des3_ede-generic) is unavailable
[   89.099908] alg: skcipher: skipping comparison tests for mv-ecb-des because ecb(des-generic) is unavailable
maintainer
#77 lore raw

Re: [PATCH] crypto: marvell/cesa - Avoid empty transfer descriptor

Quoted 9 lines · Klaus Kudielka

Hello,

Plain v6.16-rc1 with marvell-cesa as module and CRYPTO_SELFTESTS enabled. Identical behaviour as reported previously with the cryptodev tree (see below).

According to /proc/crypto, all marvell-cesa selftests (including ahash) appear to pass reliably again.

If we can trust the information in /proc/crypto, I would suggest to revert commit e845d2399a00f866f287e0cefbd4fc7d8ef0d2f7 ("crypto: marvell/cesa - Disable hash algorithms")

Corentin is still able to reproduce failures reliably. While I have a patch that seems to reduce the failure rate for him it is not yet a complete fix. There is also no full explanation of why my patch even works to the extent that it does (the DMA memory is supposed to be cache-coherent but perhaps it isn't).

So I think it is still premature at this point. There is also a known problem with the hmac code where it fails to deal with zero-length updates correctly.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#78 lore raw

Re: [v2 PATCH] crypto: marvell/cesa - Do not chain submitted requests

In reply to Herbert Xu
Quoted 5 lines · Herbert Xu
Quoted 2 lines · Corentin Labbe

I tested this patch and my armada-388-clearfog-pro panic with:

Thanks for testing! I didn't realise that you had one of these.

I have started a bot which try to build/boot automaticly all patches touching hardware I own. And for the moment it handles only linux-sunxi and crypto patches.
Happy it found something.

Quoted 5 lines

So just out of curiosity, does this driver actually pass the self-tests before this patch with CRYPTO_MANAGER_EXTRA_TESTS?

Is your system SMP? How many CPUs?

It fails to pass selftest on 6.14.4.
It has 2 CPU