This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3517 OCF Driver Problem

Other Parts Discussed in Thread: AM3517

I'm attempting to build the OCF drivers for the AM3517. I'm using the ti-sdk-am3517-evm-05.04.00.00 SDK. I'm looking at the instructions on the Crypto Wiki page here:

http://processors.wiki.ti.com/index.php/Cryptography_Users_Guide#Using_Cryptographic_Hardware_Accelerators

When I build the drivers with these commands:

make ti-ocf-crypto-module

make ti-ocf-crypto-module_install

the wiki seems to say that both cryptodev.ko and ocf_omap3_cryptok.ko should be added to the rootfs. There are no errors with my build/install but cryptodev.ko is not installed. Only ocf_omap3_cryptok.ko is added to the rootFS

Also, when you move on to the Build OCF for Sitara section, it's written for the 03.00.01.06 PSP which is not in the current release of the SDK. Has anyone gotten this working for the 05.04.00.00/04.02.00.07 SDK/PSP. If so, which releases of ocf-linux and crypto-tools did you use?


Thanks,

Jemiah

.

  • The commands that you mention in your post builds and installs only the ocf_omap3_cryptok.ko module not the OCF driver (cryptodev.ko).

    In SDK 5.04.00.00 the OCF crypto drivers are built into the kernel by default.  If you want to change this and build OCF as a module, you will need to re-configure the kernel using menuconfig.  Go to the OCF configuration and change cryptodev from built-in to module.  Then you will have to build the modules and finally install them into the root filesystem.  The following make commands should work although you may need to adjust the path to your root filesystem.

    make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- menuconfig
    make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- modules
    make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- INSTALL_MOD_PATH=/home/user/ti-sdk-am335x-evm-05.04.00.00/targetNFS modules_install

    The driver ocf_omap3_cryptok.ko will be under lib/modules/[version]/crypto/ocf

    The driver cryptodev.ko wil be under lib/modules/[version]kernel/crypto/ocf

    The version of OCF in SDK 5.04 is the ocf-linux-20120127.

    Hopes this helps.  Regards,

    Greg Turner

     

     

     

  • Thanks for the info Greg.  It looks like the wiki posting linked in the Sitara Linux Software Developer’s Guide is just out of date then. I checked in menuconfig after configuring the build for AM3517 (am3517_evm_defconfig) and the crypto options weren't set. I added the following options by gleaning the wiki:

    --- Hardware crypto devices
       <*> Support for OMAP SHA1/MD5 hw accelerator
       <*> Support for OMAP AES hw engine

    <*> OCF (Open Cryptograhic Framework)
       <*> OCF (Open Cryptograhic Framework)
       <*> cryptodev (user space support)
       <*> cryptosoft (software crypto engine)

    Which should build in support for the HW crypto module into the kernel.  I built the crypto-tools from ocf-linux-20120127 and installed them into the file-system. When I run the tests though it doesn't seem like the crypto hardware is being used. I'm inferring this from the poor performance:

    root@am3517-evm:~# cryptotest -z 1024
    0.547 sec, 2048 des crypts, 8 bytes, 29967 byte/sec, 0.2 Mb/sec
    0.563 sec, 2048 des crypts, 16 bytes, 58172 byte/sec, 0.4 Mb/sec
    0.592 sec, 2048 des crypts, 32 bytes, 110695 byte/sec, 0.8 Mb/sec
    0.647 sec, 2048 des crypts, 64 bytes, 202554 byte/sec, 1.5 Mb/sec
    0.763 sec, 2048 des crypts, 128 bytes, 343473 byte/sec, 2.6 Mb/sec
    0.988 sec, 2048 des crypts, 256 bytes, 530456 byte/sec, 4.0 Mb/sec
    1.450 sec, 2048 des crypts, 512 bytes, 723272 byte/sec, 5.5 Mb/sec
    2.354 sec, 2048 des crypts, 1024 bytes, 891072 byte/sec, 6.8 Mb/sec
    4.167 sec, 2048 des crypts, 2048 bytes, 1006488 byte/sec, 7.7 Mb/sec
    7.794 sec, 2048 des crypts, 4096 bytes, 1076222 byte/sec, 8.2 Mb/sec
    15.063 sec, 2048 des crypts, 8192 bytes, 1113790 byte/sec, 8.5 Mb/sec
    29.537 sec, 2048 des crypts, 16384 bytes, 1136003 byte/sec, 8.7 Mb/sec
    58.622 sec, 2048 des crypts, 32768 bytes, 1144773 byte/sec, 8.7 Mb/sec
    117.114 sec, 2048 des crypts, 65280 bytes, 1141564 byte/sec, 8.7 Mb/sec

    root@am3517-evm:~# openssl speed -evp aes-128-cbc -engine cryptodev
    engine "cryptodev" set.
    Doing aes-128-cbc for 3s on 16 size blocks: 10497 aes-128-cbc's in 0.05s
    Doing aes-128-cbc for 3s on 64 size blocks: 9370 aes-128-cbc's in 0.04s
    Doing aes-128-cbc for 3s on 256 size blocks: 7051 aes-128-cbc's in 0.07s
    Doing aes-128-cbc for 3s on 1024 size blocks: 3655 aes-128-cbc's in 0.05s
    Doing aes-128-cbc for 3s on 8192 size blocks: 663 aes-128-cbc's in 0.01s
    OpenSSL 1.0.0d 8 Feb 2011
    built on: Sun Mar 25 12:56:12 CDT 2012
    options:bn(64,32) rc4(ptr,int) des(idx,risc1,2,long) aes(partial) idea(int) blowfish(idx)
    compiler: arm-arago-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/home/hudson/amsdk
    The 'numbers' are in 1000s of bytes per second processed.
    type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
    aes-128-cbc 3359.04k 14992.00k 25786.51k 74854.40k 543129.60k

    I checked the kernel boot log. No errors that I can see. One thing I noticed was that without the cryptosoft module cryptotest  would do nothing at all. It really seems that the HW isn't running. Just as a sanity check I verified the processor has the HW. It's a AM3517AZCNC so that looks ok. Something must be missing from the config or the way I set it up. You said that the crypto componants were enabled by default but that wasn't the case on my setup. Do you have a  different config file for the AM3517 that has the correct options enabled?


    Thanks,

    Jemiah

    .

  • Greg,

      Looks like I found the problem. I switched to building and loading the OCF support and modules manually. I don't think the DMA option was being added when the ocf_omap3_cryptok.ko was being loaded. Following the Wiki, this was how I manually loaded ocf_omap3_cryptok.ko:

    insmod ocf_omap3_cryptok.ko ocf_omap3_crypto_dma=1


    With that change the performance got much better:

    root@am3517-evm:/lib/modules/2.6.37/crypto/ocf# time -v cryptotest -z 1024
    0.560 sec, 2048 des crypts, 8 bytes, 29247 byte/sec, 0.2 Mb/sec
    0.540 sec, 2048 des crypts, 16 bytes, 60729 byte/sec, 0.5 Mb/sec
    0.546 sec, 2048 des crypts, 32 bytes, 120119 byte/sec, 0.9 Mb/sec
    0.545 sec, 2048 des crypts, 64 bytes, 240305 byte/sec, 1.8 Mb/sec
    0.554 sec, 2048 des crypts, 128 bytes, 472832 byte/sec, 3.6 Mb/sec
    0.589 sec, 2048 des crypts, 256 bytes, 890563 byte/sec, 6.8 Mb/sec
    0.701 sec, 2048 des crypts, 512 bytes, 1496503 byte/sec, 11.4 Mb/sec
    0.906 sec, 2048 des crypts, 1024 bytes, 2315504 byte/sec, 17.7 Mb/sec
    1.166 sec, 2048 des crypts, 2048 bytes, 3597972 byte/sec, 27.5 Mb/sec
    1.946 sec, 2048 des crypts, 4096 bytes, 4309647 byte/sec, 32.9 Mb/sec
    3.164 sec, 2048 des crypts, 8192 bytes, 5303041 byte/sec, 40.5 Mb/sec
    5.655 sec, 2048 des crypts, 16384 bytes, 5933717 byte/sec, 45.3 Mb/sec
    10.373 sec, 2048 des crypts, 32768 bytes, 6469733 byte/sec, 49.4 Mb/sec
    20.564 sec, 2048 des crypts, 65280 bytes, 6501316 byte/sec, 49.6 Mb/sec

    Thanks

    .