Message ID | 1425365453-19358-3-git-send-email-yanjiang.jin@windriver.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Herbert Xu |
Headers | show |
On Tue, 3 Mar 2015 14:50:52 +0800 <yanjiang.jin@windriver.com> wrote: > - 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); alignment: the 'd' in desc_bytes should fall directly under the 'j' in jrdev. Also, DESC_RNG_LEN should be corrected to (4 * CAAM_CMD_SZ). Kim -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2015?03?04? 03:31, Kim Phillips wrote: > On Tue, 3 Mar 2015 14:50:52 +0800 > <yanjiang.jin@windriver.com> wrote: > >> - 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); > alignment: the 'd' in desc_bytes should fall directly under the 'j' > in jrdev. > > Also, DESC_RNG_LEN should be corrected to (4 * CAAM_CMD_SZ). Hi Kim, I can't find the obvious limitation for the RNG descriptor length in Freescale documents, could you point out it? Thanks! Yanjiang > > Kim > > -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 4 Mar 2015 13:33:22 +0800 yjin <yanjiang.jin@windriver.com> wrote: > On 2015?03?04? 03:31, Kim Phillips wrote: > > On Tue, 3 Mar 2015 14:50:52 +0800 > > <yanjiang.jin@windriver.com> wrote: > > > >> - 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); > > alignment: the 'd' in desc_bytes should fall directly under the 'j' > > in jrdev. > > > > Also, DESC_RNG_LEN should be corrected to (4 * CAAM_CMD_SZ). > > Hi Kim, > > I can't find the obvious limitation for the RNG descriptor length in > Freescale documents, could you point out it? ? rng_create_sh_desc() creates a fixed descriptor of exactly 4 command-lengths. Kim -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2015?03?05? 02:36, Kim Phillips wrote: > On Wed, 4 Mar 2015 13:33:22 +0800 > yjin <yanjiang.jin@windriver.com> wrote: > >> On 2015?03?04? 03:31, Kim Phillips wrote: >>> On Tue, 3 Mar 2015 14:50:52 +0800 >>> <yanjiang.jin@windriver.com> wrote: >>> >>>> - 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); >>> alignment: the 'd' in desc_bytes should fall directly under the 'j' >>> in jrdev. >>> >>> Also, DESC_RNG_LEN should be corrected to (4 * CAAM_CMD_SZ). >> Hi Kim, >> >> I can't find the obvious limitation for the RNG descriptor length in >> Freescale documents, could you point out it? > ? rng_create_sh_desc() creates a fixed descriptor of exactly 4 > command-lengths. Hi Kim, Do you mean that the code itself limits the descriptor length? Not a hardware limitation. If so, I prefer to dma_unmap with desc_bytes(ctx->sh_desc) as my previous patch, and correct DESC_RNG_LEN to (4 * CAAM_CMD_SZ). Thanks! Yanjiang > > Kim -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 5 Mar 2015 10:52:37 +0800 yjin <yanjiang.jin@windriver.com> wrote: > On 2015?03?05? 02:36, Kim Phillips wrote: > > On Wed, 4 Mar 2015 13:33:22 +0800 > > yjin <yanjiang.jin@windriver.com> wrote: > > > >> On 2015?03?04? 03:31, Kim Phillips wrote: > >>> On Tue, 3 Mar 2015 14:50:52 +0800 > >>> <yanjiang.jin@windriver.com> wrote: > >>> > >>>> - 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); > >>> alignment: the 'd' in desc_bytes should fall directly under the 'j' > >>> in jrdev. > >>> > >>> Also, DESC_RNG_LEN should be corrected to (4 * CAAM_CMD_SZ). > >> > >> I can't find the obvious limitation for the RNG descriptor length in > >> Freescale documents, could you point out it? > > ? rng_create_sh_desc() creates a fixed descriptor of exactly 4 > > command-lengths. > > Do you mean that the code itself limits the descriptor length? Not a > hardware limitation. the code writes descriptors such that they don't reach h/w limitations. > If so, I prefer to dma_unmap with desc_bytes(ctx->sh_desc) as my > previous patch, and correct DESC_RNG_LEN to (4 * CAAM_CMD_SZ). please. Kim -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index ae31e55..314f73d 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -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]); }