Re: [PATCH 2/2] crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem
On Fri, 6 Mar 2015 10:34:42 +0800 wrote: > From: Yanjiang Jin > > Fix rng_unmap_ctx's DMA_UNMAP size problem for caam_rng, else system would > report the below calltrace during cleanup caam_rng. > Since rng_create_sh_desc() creates a fixed descriptor of exactly 4 > command-lengths now, also update DESC_RNG_LEN to (4 * CAAM_CMD_SZ). > > caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different > size [device address=0x7f080010] [map size=16 bytes] [unmap size=40 > bytes] > [ cut here ] > WARNING: at lib/dma-debug.c:887 > Modules linked in: > task: c000f7cdaa80 ti: c000e534 task.ti: c000e534 > NIP: c04f5bc8 LR: c04f5bc4 CTR: c05f69b0 > REGS: c000e53433c0 TRAP: 0700 Not tainted > MSR: 80029000 CR: 24088482 XER: > SOFTE: 0 > > GPR00: c04f5bc4 c000e5343640 c12af360 009f > GPR04: 00a0 c0d02070 c00015980660 > GPR08: c0cff360 c12da018 > GPR12: 01e3 c1fff780 100f 0001 > GPR16: 0002 > GPR20: 0001 > GPR24: 0001 0001 0001 > GPR28: c1556b90 c1565b80 c000e5343750 c000f9427480 > NIP [c04f5bc8] .check_unmap+0x538/0x9c0 > LR [c04f5bc4] .check_unmap+0x534/0x9c0 > Call Trace: > [c000e5343640] [c04f5bc4] .check_unmap+0x534/0x9c0 (unreliable) > [c000e53436e0] [c04f60d4] .debug_dma_unmap_page+0x84/0xb0 > [c000e5343810] [c082f9d4] .caam_cleanup+0x1d4/0x240 > [c000e53438a0] [c056cc88] .hwrng_unregister+0xd8/0x1c0 > Instruction dump: > 7c641b78 41de0410 e8a90050 2fa5 419e0484 e8de0028 e8ff0030 3c62ff90 > e91e0030 38638388 48546ed9 6000 <0fe0> 3c62ff8f 38637fc8 48546ec5 > ---[ end trace e43fd1734d6600df ]--- > > Signed-off-by: Yanjiang Jin > --- Acked-by: Kim Phillips Thanks, Kim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem
On Fri, 6 Mar 2015 10:34:42 +0800 yanjiang@windriver.com wrote: From: Yanjiang Jin yanjiang@windriver.com Fix rng_unmap_ctx's DMA_UNMAP size problem for caam_rng, else system would report the below calltrace during cleanup caam_rng. Since rng_create_sh_desc() creates a fixed descriptor of exactly 4 command-lengths now, also update DESC_RNG_LEN to (4 * CAAM_CMD_SZ). caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different size [device address=0x7f080010] [map size=16 bytes] [unmap size=40 bytes] [ cut here ] WARNING: at lib/dma-debug.c:887 Modules linked in: task: c000f7cdaa80 ti: c000e534 task.ti: c000e534 NIP: c04f5bc8 LR: c04f5bc4 CTR: c05f69b0 REGS: c000e53433c0 TRAP: 0700 Not tainted MSR: 80029000 CE,EE,ME CR: 24088482 XER: SOFTE: 0 GPR00: c04f5bc4 c000e5343640 c12af360 009f GPR04: 00a0 c0d02070 c00015980660 GPR08: c0cff360 c12da018 GPR12: 01e3 c1fff780 100f 0001 GPR16: 0002 GPR20: 0001 GPR24: 0001 0001 0001 GPR28: c1556b90 c1565b80 c000e5343750 c000f9427480 NIP [c04f5bc8] .check_unmap+0x538/0x9c0 LR [c04f5bc4] .check_unmap+0x534/0x9c0 Call Trace: [c000e5343640] [c04f5bc4] .check_unmap+0x534/0x9c0 (unreliable) [c000e53436e0] [c04f60d4] .debug_dma_unmap_page+0x84/0xb0 [c000e5343810] [c082f9d4] .caam_cleanup+0x1d4/0x240 [c000e53438a0] [c056cc88] .hwrng_unregister+0xd8/0x1c0 Instruction dump: 7c641b78 41de0410 e8a90050 2fa5 419e0484 e8de0028 e8ff0030 3c62ff90 e91e0030 38638388 48546ed9 6000 0fe0 3c62ff8f 38637fc8 48546ec5 ---[ end trace e43fd1734d6600df ]--- Signed-off-by: Yanjiang Jin yanjiang@windriver.com --- Acked-by: Kim Phillips kim.phill...@freescale.com Thanks, Kim -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem
From: Yanjiang Jin Fix rng_unmap_ctx's DMA_UNMAP size problem for caam_rng, else system would report the below calltrace during cleanup caam_rng. Since rng_create_sh_desc() creates a fixed descriptor of exactly 4 command-lengths now, also update DESC_RNG_LEN to (4 * CAAM_CMD_SZ). caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different size [device address=0x7f080010] [map size=16 bytes] [unmap size=40 bytes] [ cut here ] WARNING: at lib/dma-debug.c:887 Modules linked in: task: c000f7cdaa80 ti: c000e534 task.ti: c000e534 NIP: c04f5bc8 LR: c04f5bc4 CTR: c05f69b0 REGS: c000e53433c0 TRAP: 0700 Not tainted MSR: 80029000 CR: 24088482 XER: SOFTE: 0 GPR00: c04f5bc4 c000e5343640 c12af360 009f GPR04: 00a0 c0d02070 c00015980660 GPR08: c0cff360 c12da018 GPR12: 01e3 c1fff780 100f 0001 GPR16: 0002 GPR20: 0001 GPR24: 0001 0001 0001 GPR28: c1556b90 c1565b80 c000e5343750 c000f9427480 NIP [c04f5bc8] .check_unmap+0x538/0x9c0 LR [c04f5bc4] .check_unmap+0x534/0x9c0 Call Trace: [c000e5343640] [c04f5bc4] .check_unmap+0x534/0x9c0 (unreliable) [c000e53436e0] [c04f60d4] .debug_dma_unmap_page+0x84/0xb0 [c000e5343810] [c082f9d4] .caam_cleanup+0x1d4/0x240 [c000e53438a0] [c056cc88] .hwrng_unregister+0xd8/0x1c0 Instruction dump: 7c641b78 41de0410 e8a90050 2fa5 419e0484 e8de0028 e8ff0030 3c62ff90 e91e0030 38638388 48546ed9 6000 <0fe0> 3c62ff8f 38637fc8 48546ec5 ---[ end trace e43fd1734d6600df ]--- Signed-off-by: Yanjiang Jin --- 1. Fix an alignment issue; 2. update DESC_RNG_LEN to (4 * CAAM_CMD_SZ). drivers/crypto/caam/caamrng.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index ae31e55..26a544b 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -52,7 +52,7 @@ /* length of descriptors */ #define DESC_JOB_O_LEN (CAAM_CMD_SZ * 2 + CAAM_PTR_SZ * 2) -#define DESC_RNG_LEN (10 * CAAM_CMD_SZ) +#define DESC_RNG_LEN (4 * CAAM_CMD_SZ) /* Buffer, its dma address and lock */ struct buf_data { @@ -90,8 +90,8 @@ static inline void rng_unmap_ctx(struct caam_rng_ctx *ctx) struct device *jrdev = ctx->jrdev; if (ctx->sh_desc_dma) - dma_unmap_single(jrdev, ctx->sh_desc_dma, DESC_RNG_LEN, -DMA_TO_DEVICE); + dma_unmap_single(jrdev, ctx->sh_desc_dma, +desc_bytes(ctx->sh_desc), DMA_TO_DEVICE); rng_unmap_buf(jrdev, >bufs[0]); rng_unmap_buf(jrdev, >bufs[1]); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem
From: Yanjiang Jin yanjiang@windriver.com Fix rng_unmap_ctx's DMA_UNMAP size problem for caam_rng, else system would report the below calltrace during cleanup caam_rng. Since rng_create_sh_desc() creates a fixed descriptor of exactly 4 command-lengths now, also update DESC_RNG_LEN to (4 * CAAM_CMD_SZ). caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different size [device address=0x7f080010] [map size=16 bytes] [unmap size=40 bytes] [ cut here ] WARNING: at lib/dma-debug.c:887 Modules linked in: task: c000f7cdaa80 ti: c000e534 task.ti: c000e534 NIP: c04f5bc8 LR: c04f5bc4 CTR: c05f69b0 REGS: c000e53433c0 TRAP: 0700 Not tainted MSR: 80029000 CE,EE,ME CR: 24088482 XER: SOFTE: 0 GPR00: c04f5bc4 c000e5343640 c12af360 009f GPR04: 00a0 c0d02070 c00015980660 GPR08: c0cff360 c12da018 GPR12: 01e3 c1fff780 100f 0001 GPR16: 0002 GPR20: 0001 GPR24: 0001 0001 0001 GPR28: c1556b90 c1565b80 c000e5343750 c000f9427480 NIP [c04f5bc8] .check_unmap+0x538/0x9c0 LR [c04f5bc4] .check_unmap+0x534/0x9c0 Call Trace: [c000e5343640] [c04f5bc4] .check_unmap+0x534/0x9c0 (unreliable) [c000e53436e0] [c04f60d4] .debug_dma_unmap_page+0x84/0xb0 [c000e5343810] [c082f9d4] .caam_cleanup+0x1d4/0x240 [c000e53438a0] [c056cc88] .hwrng_unregister+0xd8/0x1c0 Instruction dump: 7c641b78 41de0410 e8a90050 2fa5 419e0484 e8de0028 e8ff0030 3c62ff90 e91e0030 38638388 48546ed9 6000 0fe0 3c62ff8f 38637fc8 48546ec5 ---[ end trace e43fd1734d6600df ]--- Signed-off-by: Yanjiang Jin yanjiang@windriver.com --- 1. Fix an alignment issue; 2. update DESC_RNG_LEN to (4 * CAAM_CMD_SZ). drivers/crypto/caam/caamrng.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index ae31e55..26a544b 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -52,7 +52,7 @@ /* length of descriptors */ #define DESC_JOB_O_LEN (CAAM_CMD_SZ * 2 + CAAM_PTR_SZ * 2) -#define DESC_RNG_LEN (10 * CAAM_CMD_SZ) +#define DESC_RNG_LEN (4 * CAAM_CMD_SZ) /* Buffer, its dma address and lock */ struct buf_data { @@ -90,8 +90,8 @@ static inline void rng_unmap_ctx(struct caam_rng_ctx *ctx) struct device *jrdev = ctx-jrdev; if (ctx-sh_desc_dma) - dma_unmap_single(jrdev, ctx-sh_desc_dma, DESC_RNG_LEN, -DMA_TO_DEVICE); + dma_unmap_single(jrdev, ctx-sh_desc_dma, +desc_bytes(ctx-sh_desc), DMA_TO_DEVICE); rng_unmap_buf(jrdev, ctx-bufs[0]); rng_unmap_buf(jrdev, ctx-bufs[1]); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/