* [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc
@ 2017-07-12 4:40 Oleksij Rempel
2017-07-12 4:40 ` [PATCH v2] " Oleksij Rempel
2017-07-12 4:41 ` [PATCH v1] " Oleksij Rempel
0 siblings, 2 replies; 6+ messages in thread
From: Oleksij Rempel @ 2017-07-12 4:40 UTC (permalink / raw)
To: barebox, l.stach; +Cc: Oleksij Rempel
It is a fixup for following patch:
| commit ef4144b4ab6301d7417af3eb4d79cfc66bf0e731
| Date: Wed Mar 22 10:14:37 2017 +0100
|
| crypto: caam - fix RNG buffer cache alignment
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/crypto/caam/caamrng.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index 31a92731d2..51c267e3d3 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -203,8 +203,6 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id)
init_job_desc_shared(desc, ctx->sh_desc_dma, sh_len, HDR_SHARE_DEFER |
HDR_REVERSE);
- bd->addr = (dma_addr_t)bd->buf;
-
append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0);
#ifdef DEBUG
print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_OFFSET, 16, 4,
@@ -218,7 +216,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id)
struct buf_data *bd = &ctx->bufs[buf_id];
int err;
- bd->buf = dma_alloc(RN_BUF_SIZE);
+ bd->buf = dma_alloc_coherent(RN_BUF_SIZE, &bd->addr);
err = rng_create_job_desc(ctx, buf_id);
if (err)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] crypto: caam: use dma_alloc_coherent instead of dma_alloc
2017-07-12 4:40 [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc Oleksij Rempel
@ 2017-07-12 4:40 ` Oleksij Rempel
2017-07-12 14:54 ` Lucas Stach
2017-07-12 4:41 ` [PATCH v1] " Oleksij Rempel
1 sibling, 1 reply; 6+ messages in thread
From: Oleksij Rempel @ 2017-07-12 4:40 UTC (permalink / raw)
To: barebox, l.stach; +Cc: Oleksij Rempel
It is a fixup for following patch:
| commit ef4144b4ab6301d7417af3eb4d79cfc66bf0e731
| Date: Wed Mar 22 10:14:37 2017 +0100
|
| crypto: caam - fix RNG buffer cache alignment
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/crypto/caam/caamrng.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index 31a92731d2..51c267e3d3 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -203,8 +203,6 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id)
init_job_desc_shared(desc, ctx->sh_desc_dma, sh_len, HDR_SHARE_DEFER |
HDR_REVERSE);
- bd->addr = (dma_addr_t)bd->buf;
-
append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0);
#ifdef DEBUG
print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_OFFSET, 16, 4,
@@ -218,7 +216,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id)
struct buf_data *bd = &ctx->bufs[buf_id];
int err;
- bd->buf = dma_alloc(RN_BUF_SIZE);
+ bd->buf = dma_alloc_coherent(RN_BUF_SIZE, &bd->addr);
err = rng_create_job_desc(ctx, buf_id);
if (err)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] crypto: caam: use dma_alloc_coherent instead of dma_alloc
2017-07-12 4:40 ` [PATCH v2] " Oleksij Rempel
@ 2017-07-12 14:54 ` Lucas Stach
0 siblings, 0 replies; 6+ messages in thread
From: Lucas Stach @ 2017-07-12 14:54 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
Am Mittwoch, den 12.07.2017, 06:40 +0200 schrieb Oleksij Rempel:
> It is a fixup for following patch:
> | commit ef4144b4ab6301d7417af3eb4d79cfc66bf0e731
> | Date: Wed Mar 22 10:14:37 2017 +0100
> |
> | crypto: caam - fix RNG buffer cache alignment
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thanks. I've applied this patch with the commit message changed to the
following, to add a bit more information about the failure this is
fixing:
crypto: caam: use dma_alloc_coherent instead of dma_alloc
dma_alloc return non-coherent memory, but the driver does no cache
maintenance on the buffer, causing memory corruption. Fix this by
requesting coherent memory for the DMA transfer.
Fixes: ef4144b4ab63 (crypto: caam - fix RNG buffer cache alignment)
> ---
> drivers/crypto/caam/caamrng.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
> index 31a92731d2..51c267e3d3 100644
> --- a/drivers/crypto/caam/caamrng.c
> +++ b/drivers/crypto/caam/caamrng.c
> @@ -203,8 +203,6 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id)
> init_job_desc_shared(desc, ctx->sh_desc_dma, sh_len, HDR_SHARE_DEFER |
> HDR_REVERSE);
>
> - bd->addr = (dma_addr_t)bd->buf;
> -
> append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0);
> #ifdef DEBUG
> print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_OFFSET, 16, 4,
> @@ -218,7 +216,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id)
> struct buf_data *bd = &ctx->bufs[buf_id];
> int err;
>
> - bd->buf = dma_alloc(RN_BUF_SIZE);
> + bd->buf = dma_alloc_coherent(RN_BUF_SIZE, &bd->addr);
>
> err = rng_create_job_desc(ctx, buf_id);
> if (err)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc
2017-07-12 4:40 [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc Oleksij Rempel
2017-07-12 4:40 ` [PATCH v2] " Oleksij Rempel
@ 2017-07-12 4:41 ` Oleksij Rempel
1 sibling, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2017-07-12 4:41 UTC (permalink / raw)
To: barebox
[-- Attachment #1.1.1: Type: text/plain, Size: 1391 bytes --]
oops, please ignore this one.
Am 12.07.2017 um 06:40 schrieb Oleksij Rempel:
> It is a fixup for following patch:
> | commit ef4144b4ab6301d7417af3eb4d79cfc66bf0e731
> | Date: Wed Mar 22 10:14:37 2017 +0100
> |
> | crypto: caam - fix RNG buffer cache alignment
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/crypto/caam/caamrng.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
> index 31a92731d2..51c267e3d3 100644
> --- a/drivers/crypto/caam/caamrng.c
> +++ b/drivers/crypto/caam/caamrng.c
> @@ -203,8 +203,6 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id)
> init_job_desc_shared(desc, ctx->sh_desc_dma, sh_len, HDR_SHARE_DEFER |
> HDR_REVERSE);
>
> - bd->addr = (dma_addr_t)bd->buf;
> -
> append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0);
> #ifdef DEBUG
> print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_OFFSET, 16, 4,
> @@ -218,7 +216,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id)
> struct buf_data *bd = &ctx->bufs[buf_id];
> int err;
>
> - bd->buf = dma_alloc(RN_BUF_SIZE);
> + bd->buf = dma_alloc_coherent(RN_BUF_SIZE, &bd->addr);
>
> err = rng_create_job_desc(ctx, buf_id);
> if (err)
>
--
Regards,
Oleksij
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc
@ 2017-07-11 14:51 Oleksij Rempel
2017-07-11 16:12 ` Robert Schwebel
0 siblings, 1 reply; 6+ messages in thread
From: Oleksij Rempel @ 2017-07-11 14:51 UTC (permalink / raw)
To: barebox, l.stach; +Cc: Oleksij Rempel
It is a fixup for fallowing patch:
| commit ef4144b4ab6301d7417af3eb4d79cfc66bf0e731
| Date: Wed Mar 22 10:14:37 2017 +0100
|
| crypto: caam - fix RNG buffer cache alignmen
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/crypto/caam/caamrng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index 31a92731d2..a991cc855a 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -218,7 +218,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id)
struct buf_data *bd = &ctx->bufs[buf_id];
int err;
- bd->buf = dma_alloc(RN_BUF_SIZE);
+ bd->buf = dma_alloc_coherent(RN_BUF_SIZE, DMA_ADDRESS_BROKEN);
err = rng_create_job_desc(ctx, buf_id);
if (err)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc
2017-07-11 14:51 Oleksij Rempel
@ 2017-07-11 16:12 ` Robert Schwebel
0 siblings, 0 replies; 6+ messages in thread
From: Robert Schwebel @ 2017-07-11 16:12 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
On Tue, Jul 11, 2017 at 04:51:41PM +0200, Oleksij Rempel wrote:
> It is a fixup for fallowing patch:
^o
> | commit ef4144b4ab6301d7417af3eb4d79cfc66bf0e731
> | Date: Wed Mar 22 10:14:37 2017 +0100
> |
> | crypto: caam - fix RNG buffer cache alignmen
^t
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/crypto/caam/caamrng.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
> index 31a92731d2..a991cc855a 100644
> --- a/drivers/crypto/caam/caamrng.c
> +++ b/drivers/crypto/caam/caamrng.c
> @@ -218,7 +218,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id)
> struct buf_data *bd = &ctx->bufs[buf_id];
> int err;
>
> - bd->buf = dma_alloc(RN_BUF_SIZE);
> + bd->buf = dma_alloc_coherent(RN_BUF_SIZE, DMA_ADDRESS_BROKEN);
>
> err = rng_create_job_desc(ctx, buf_id);
> if (err)
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-12 14:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12 4:40 [PATCH v1] crypto: caam: use dma_alloc_coherent instead of dma_alloc Oleksij Rempel
2017-07-12 4:40 ` [PATCH v2] " Oleksij Rempel
2017-07-12 14:54 ` Lucas Stach
2017-07-12 4:41 ` [PATCH v1] " Oleksij Rempel
-- strict thread matches above, loose matches on Subject: below --
2017-07-11 14:51 Oleksij Rempel
2017-07-11 16:12 ` Robert Schwebel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox