AnsweredAssumed Answered

CAAM operation fails with DMA Error when using global buffers

Question asked by dhanushka dangampola on Feb 29, 2016
Latest reply on May 19, 2016 by Yuri Muhin

I'm using CAAM through Linux Crypto API as shown in kernel source tree crypto/tcrypt.c in a kernel module.

See the code segment below. I've changed the test_acipher_speed taken from tcrypt.c in my kernel module implementation to use BUFFSIZE instead of PAGE_SIZE.

When I build this to use memory allocated by kmalloc, the encryption succeeds, but when I build it to use the global array, buf, the encryption fails with the following error:

caam_jr 2142000.jr1: 40001016: DECO: desc idx 16: DMA Error


I'm running this on an iMX6UL with a 3.14.38 kernel. Why does global array test fail? Thank you.


//#define USE_KMALLOC

#define TVMEMSIZE 4

#define BUFFSIZE  128


static char *tvmem[TVMEMSIZE];

static u32 block_sizes[] = { 16, 0 };

static u8 speed_template_16[] = {16};

static char buf[BUFFSIZE*TVMEMSIZE];


static int __init testmodule_init(void)


   int i;


#ifndef  USE_KMALLOC

   char* buffer = buf;

#else // USE_KMALLOC

   char* buffer = (char*)kmalloc(BUFFSIZE*TVMEMSIZE, GFP_KERNEL);

#endif   // USE_KMALLOC


   for (i = 0; i < TVMEMSIZE; i++)


      tvmem[i] = buffer + i*BUFFSIZE;



   test_acipher_speed("ecb(aes)", ENCRYPT, 0, NULL, 0, speed_template_16);



   if (buffer)




#endif   // USE_KMALLOC


   return 0;