Message ID | 20200127165646.19806-2-andrew.smirnov@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show |
Series | enable CAAM's HWRNG as default | expand |
On 1/27/2020 6:57 PM, Andrey Smirnov wrote: > Be consistent with the rest of the codebase and use GFP_DMA when > allocating memory for a CAAM JR descriptor. > Please use GFP_DMA32 instead. Device is not limited to less than 32 bits of addressing in any of its incarnations. s/GFP_DMA/GFP_DMA32 should be performed throughout caam driver. (But of course, I wouldn't include this change in current patch series). Horia
On Tue, Feb 4, 2020 at 6:08 AM Horia Geanta <horia.geanta@nxp.com> wrote: > > On 1/27/2020 6:57 PM, Andrey Smirnov wrote: > > Be consistent with the rest of the codebase and use GFP_DMA when > > allocating memory for a CAAM JR descriptor. > > > Please use GFP_DMA32 instead. > Device is not limited to less than 32 bits of addressing > in any of its incarnations. > > s/GFP_DMA/GFP_DMA32 should be performed throughout caam driver. > (But of course, I wouldn't include this change in current patch series). > Will do in v8. Thanks, Andrey Smirnov
On Tue, Feb 4, 2020 at 6:08 AM Horia Geanta <horia.geanta@nxp.com> wrote: > > On 1/27/2020 6:57 PM, Andrey Smirnov wrote: > > Be consistent with the rest of the codebase and use GFP_DMA when > > allocating memory for a CAAM JR descriptor. > > > Please use GFP_DMA32 instead. > Device is not limited to less than 32 bits of addressing > in any of its incarnations. > > s/GFP_DMA/GFP_DMA32 should be performed throughout caam driver. > (But of course, I wouldn't include this change in current patch series). > Hmm, I am triggering https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/slub.c?h=v5.6-rc6#n1721 by using GFP_DMA32. AFAICT, GFP_DMA32 can't be used in SLUB/SLAB allocated memory: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/internal.h?h=v5.6-rc6#n32 I'll stick with GFP_DMA for now, unless you have a different preference. Thanks, Andrey Smirnov
On 3/16/2020 6:15 AM, Andrey Smirnov wrote: > On Tue, Feb 4, 2020 at 6:08 AM Horia Geanta <horia.geanta@nxp.com> wrote: >> >> On 1/27/2020 6:57 PM, Andrey Smirnov wrote: >>> Be consistent with the rest of the codebase and use GFP_DMA when >>> allocating memory for a CAAM JR descriptor. >>> >> Please use GFP_DMA32 instead. >> Device is not limited to less than 32 bits of addressing >> in any of its incarnations. >> >> s/GFP_DMA/GFP_DMA32 should be performed throughout caam driver. >> (But of course, I wouldn't include this change in current patch series). >> > > Hmm, I am triggering > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/slub.c?h=v5.6-rc6#n1721 > by using GFP_DMA32. AFAICT, GFP_DMA32 can't be used in SLUB/SLAB > allocated memory: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/internal.h?h=v5.6-rc6#n32 > Indeed. > I'll stick with GFP_DMA for now, unless you have a different preference. > I'm ok with this, will deal with memory allocation separately. Thanks, Horia
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 6659c8d9672e..a11c13a89ef8 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -194,7 +194,7 @@ static int deinstantiate_rng(struct device *ctrldev, int state_handle_mask) u32 *desc, status; int sh_idx, ret = 0; - desc = kmalloc(CAAM_CMD_SZ * 3, GFP_KERNEL); + desc = kmalloc(CAAM_CMD_SZ * 3, GFP_KERNEL | GFP_DMA); if (!desc) return -ENOMEM; @@ -271,7 +271,7 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask, int ret = 0, sh_idx; ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl; - desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL); + desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL | GFP_DMA); if (!desc) return -ENOMEM;
Be consistent with the rest of the codebase and use GFP_DMA when allocating memory for a CAAM JR descriptor. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Horia Geantă <horia.geanta@nxp.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Iuliana Prodan <iuliana.prodan@nxp.com> Cc: linux-imx@nxp.com Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/crypto/caam/ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)