<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CAAM operation fails with DMA Error when using global buffers in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494258#M79421</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yuri,&lt;/P&gt;&lt;P&gt;Now I'm trying to use the secure-memory as the source and destination with CAAM async-block ciphers through Linux crypto-API. I obtain the source and destination slots from secure-memory using sm_keystore_slot_alloc as shown below in the code segment. Error checking has been omitted for brevity here, but I do check for errors in the real code.&lt;/P&gt;&lt;P&gt;The crypto operation completes successfully, but when I check the dst location, it's contents remain the same, as if no crypto operation occurred. Why is this happening?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; u8 __iomem *src, *dst;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; struct caam_drv_private_sm *kspriv = dev_get_drvdata(ksdev);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sm_establish_keystore(ksdev, 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sm_keystore_slot_alloc(ksdev, 1, slotsize, &amp;amp;keyslot1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; src = kspriv-&amp;gt;slot_get_address(ksdev, 1, keyslot1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sm_keystore_slot_alloc(ksdev, 1, slotsize, &amp;amp;keyslot2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dst = kspriv-&amp;gt;slot_get_address(ksdev, 1, keyslot2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; // use src and dst with CAAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2016 15:56:14 GMT</pubDate>
    <dc:creator>dhanushkadangam</dc:creator>
    <dc:date>2016-05-06T15:56:14Z</dc:date>
    <item>
      <title>CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494255#M79418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using CAAM through Linux Crypto API as shown in kernel source tree crypto/tcrypt.c in a kernel module. &lt;/P&gt;&lt;P&gt;See the code segment below. I've changed the&lt;STRONG&gt; test_acipher_speed&lt;/STRONG&gt; taken from &lt;STRONG&gt;tcrypt.c &lt;/STRONG&gt;in my kernel module implementation to use BUFFSIZE instead of PAGE_SIZE.&lt;/P&gt;&lt;P&gt;When I build this to use memory allocated by kmalloc, the encryption succeeds, but when I build it to use the global array, &lt;STRONG&gt;buf&lt;/STRONG&gt;, the encryption fails with the following error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;caam_jr 2142000.jr1: 40001016: DECO: desc idx 16: DMA Error&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running this on an iMX6UL with a 3.14.38 kernel. Why does global array test fail? Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//#define USE_KMALLOC&lt;/P&gt;&lt;P&gt;#define TVMEMSIZE 4&lt;/P&gt;&lt;P&gt;#define BUFFSIZE&amp;nbsp; 128&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static char *tvmem[TVMEMSIZE];&lt;/P&gt;&lt;P&gt;static u32 block_sizes[] = { 16, 0 };&lt;/P&gt;&lt;P&gt;static u8 speed_template_16[] = {16};&lt;/P&gt;&lt;P&gt;static char buf[BUFFSIZE*TVMEMSIZE];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int __init testmodule_init(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; int i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#ifndef&amp;nbsp; USE_KMALLOC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; char* buffer = buf;&lt;/P&gt;&lt;P&gt;#else // USE_KMALLOC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; char* buffer = (char*)kmalloc(BUFFSIZE*TVMEMSIZE, GFP_KERNEL);&lt;/P&gt;&lt;P&gt;#endif&amp;nbsp;&amp;nbsp; // USE_KMALLOC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; for (i = 0; i &amp;lt; TVMEMSIZE; i++)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tvmem[i] = buffer + i*BUFFSIZE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; test_acipher_speed("ecb(aes)", ENCRYPT, 0, NULL, 0, speed_template_16);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#ifdef&amp;nbsp; USE_KMALLOC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if (buffer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kfree(buffer);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;#endif&amp;nbsp;&amp;nbsp; // USE_KMALLOC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Feb 2016 11:41:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494255#M79418</guid>
      <dc:creator>dhanushkadangam</dc:creator>
      <dc:date>2016-02-29T11:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494256#M79419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I figured out the reason for DMA Error.&lt;/P&gt;&lt;P&gt;In linux kernel documentation &lt;A href="https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt"&gt;https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt&lt;/A&gt;, &lt;STRONG&gt;What memory is DMA'able?&lt;/STRONG&gt; section it says&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"If you acquired your memory via the page allocator (i.e. __get_free_page*()) or the generic memory allocators (i.e. kmalloc() or kmem_cache_alloc()) then you may DMA to/from that memory using the addresses returned from those routines.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This rule also means that you may use neither kernel image addresses (items in data/text/bss segments), nor module image addresses, nor stack addresses for DMA"&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 06:37:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494256#M79419</guid>
      <dc:creator>dhanushkadangam</dc:creator>
      <dc:date>2016-03-01T06:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494257#M79420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="a______"&gt;&amp;nbsp; Yes, it is needed to use t&lt;SPAN style="color: #000000; font-family: helvetica, arial, sans-serif; font-size: medium; font-style: normal; font-weight: normal; text-align: start; text-indent: 0px;"&gt;he&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;TT style="color: #790029; font-style: normal; font-weight: normal; text-align: start; text-indent: 0px;"&gt;GFP_DMA&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial, sans-serif; font-size: medium; font-style: normal; font-weight: normal; text-align: start; text-indent: 0px;"&gt;&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;flag of the &lt;/SPAN&gt;&lt;SPAN class="tm7"&gt;kmalloc, which &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial, sans-serif; font-size: medium; font-style: normal; font-weight: normal; text-align: start; text-indent: 0px;"&gt;is used to specify that the allocator &lt;BR /&gt;must satisfy the request from&lt;SPAN class="Apple-converted-space"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;TT style="color: #790029; font-style: normal; font-weight: normal; text-align: start; text-indent: 0px;"&gt;ZONE_DMA&lt;/TT&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial, sans-serif; font-size: medium; font-style: normal; font-weight: normal; text-align: start; text-indent: 0px;"&gt;. This flag is used by device drivers, which need DMA-able &lt;BR /&gt;memory for their devices.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Yuri&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 08:22:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494257#M79420</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2016-03-01T08:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494258#M79421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yuri,&lt;/P&gt;&lt;P&gt;Now I'm trying to use the secure-memory as the source and destination with CAAM async-block ciphers through Linux crypto-API. I obtain the source and destination slots from secure-memory using sm_keystore_slot_alloc as shown below in the code segment. Error checking has been omitted for brevity here, but I do check for errors in the real code.&lt;/P&gt;&lt;P&gt;The crypto operation completes successfully, but when I check the dst location, it's contents remain the same, as if no crypto operation occurred. Why is this happening?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; u8 __iomem *src, *dst;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; struct caam_drv_private_sm *kspriv = dev_get_drvdata(ksdev);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sm_establish_keystore(ksdev, 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sm_keystore_slot_alloc(ksdev, 1, slotsize, &amp;amp;keyslot1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; src = kspriv-&amp;gt;slot_get_address(ksdev, 1, keyslot1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sm_keystore_slot_alloc(ksdev, 1, slotsize, &amp;amp;keyslot2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dst = kspriv-&amp;gt;slot_get_address(ksdev, 1, keyslot2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; // use src and dst with CAAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 15:56:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494258#M79421</guid>
      <dc:creator>dhanushkadangam</dc:creator>
      <dc:date>2016-05-06T15:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494259#M79422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; perhaps we have the same cache coherence issue ? &lt;/P&gt;&lt;P&gt;Are there CAAM errors ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yuri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 07:31:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494259#M79422</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2016-05-18T07:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494260#M79423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yuri,&lt;/P&gt;&lt;P&gt;CAAM doesn't report any error. It says the operation is successful.&lt;/P&gt;&lt;P&gt;Can you please explain how cache coherency could come in here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2016 09:08:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494260#M79423</guid>
      <dc:creator>dhanushkadangam</dc:creator>
      <dc:date>2016-05-19T09:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: CAAM operation fails with DMA Error when using global buffers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494261#M79424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; As for coherency : all buffers should not be cached. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yuri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 02:10:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/CAAM-operation-fails-with-DMA-Error-when-using-global-buffers/m-p/494261#M79424</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2016-05-20T02:10:57Z</dc:date>
    </item>
  </channel>
</rss>

