From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Subject: [PATCH 1/2] crypto: caam: map DMA buffers before sync
Date: Thu, 7 Mar 2024 09:39:35 +0100 [thread overview]
Message-ID: <20240307083936.1195215-1-r.czerwinski@pengutronix.de> (raw)
With dma api debugging enabled, Barebox complains correctly that the
result and desc buffer are never mapped correctly. Add the correct map
and unmap sequence.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
drivers/crypto/caam/rng_self_test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/crypto/caam/rng_self_test.c b/drivers/crypto/caam/rng_self_test.c
index b6fcc3bc09..f5ab974a98 100644
--- a/drivers/crypto/caam/rng_self_test.c
+++ b/drivers/crypto/caam/rng_self_test.c
@@ -186,6 +186,8 @@ int caam_rng_self_test(struct device *dev, const u8 caam_era, const u8 rngvid,
construct_rng_self_test_jobdesc(desc, rng_st_dsc, result, desc_size);
+ dma_map_single(dev, desc, desc_size * sizeof(*desc), DMA_TO_DEVICE);
+ dma_map_single(dev, result, result_size * sizeof(*result), DMA_FROM_DEVICE);
dma_sync_single_for_device(dev, (unsigned long)desc,
desc_size * sizeof(*desc), DMA_TO_DEVICE);
dma_sync_single_for_device(dev, (unsigned long)result,
@@ -218,6 +220,8 @@ int caam_rng_self_test(struct device *dev, const u8 caam_era, const u8 rngvid,
ret = 0;
err:
+ dma_unmap_single(dev, (dma_addr_t)desc, desc_size * sizeof(*desc), DMA_TO_DEVICE);
+ dma_unmap_single(dev, (dma_addr_t)result, result_size * sizeof(*result), DMA_FROM_DEVICE);
dma_free(desc);
dma_free(result);
return ret;
--
2.39.2
next reply other threads:[~2024-03-07 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 8:39 Rouven Czerwinski [this message]
2024-03-07 8:39 ` [PATCH 2/2] crypto: caam: caamrng: map desc and buffer Rouven Czerwinski
2024-03-07 9:13 ` Lucas Stach
2024-03-07 9:09 ` [PATCH 1/2] crypto: caam: map DMA buffers before sync Lucas Stach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240307083936.1195215-1-r.czerwinski@pengutronix.de \
--to=r.czerwinski@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox