Crypto Acceleration / driver Bug ?

Hello all,

I'm trying to use the Crypto acceleration on the BeagleBoard-XM as
described in the Omap3 crypto wiki :

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

Compiled and installed the drivers (kernel 2.6.32-psp with ocf
support) and openssl, the benchmarks described in the wiki will work
just fine,

however I noticed that performing a hash(md5/sha1) using cryptodev
causes a kernel crash when the input file is bigger than a certain
size (around 62kbytes) !

this limit is strange ! I suspect that the input file is loaded in the
internal RAM using dma (64kb) and processed in one chunk.

I enabled debugging outputs in "ocf_omap3_cryptok"

here are the traces :

1) using input file 61k : (everything is OK)

root@beagleboard:~# openssl dgst 61k
[ 204.546112] ocf_omap3_crypto_newsession()
[ 204.550262] keylen: 8, mode: 2
[ 204.554595] ocf_omap3_crypto_freesession()
[ 204.558837] ocf_omap3_crypto_newsession()
[ 204.564025] keylen: 24, mode: 3
[ 204.568695] ocf_omap3_crypto_freesession()
[ 204.572875] ocf_omap3_crypto_newsession()
[ 204.578094] keylen: 16, mode: 1
[ 204.581329] ocf_omap3_crypto_freesession()
[ 204.587005] ocf_omap3_crypto_newsession()
[ 204.591888] keylen: 24, mode: 1
[ 204.595123] ocf_omap3_crypto_freesession()
[ 204.600433] ocf_omap3_crypto_newsession()
[ 204.604522] keylen: 32, mode: 1
[ 204.608825] ocf_omap3_crypto_freesession()
[ 204.613281] ocf_omap3_crypto_newsession()
[ 204.618560] ocf_omap3_crypto_freesession()
[ 204.623596] ocf_omap3_crypto_newsession()
[ 204.627716] ocf_omap3_crypto_freesession()
[ 204.643920] ocf_omap3_crypto_newsession()
[ 204.651641] ocf_omap3_crypto_process()
[ 204.656372] flags: 0
[ 204.658966] DMA processing hash, id: 2, len: 62464
[ 204.665008] omap3_crypto_sha2md5_do: buf_len: 62464, len: 62464 l:
62400
[ 204.672637] Starting MD5: 001e7808 0000f3c0
[ 204.680053] saving DIGCNT: 0000f3c0
[ 204.683654] sha1 hash output = (7e122940 441874bf ee7f8038 d9c6bab7
00000000)
[ 204.692260] ocf_omap3_crypto_freesession()
MD5(61k)= 73ed93c398d195567d8118[ 204.698455]
ocf_omap3_crypto_newsession()
0e3fde4c18
[ 204.708007] ocf_omap3_crypto_freesession()

2) using input file 62k : (kernel crash wit a nice Oops)
root@beagleboard:~# openssl dgst 62k
[ 210.979309] ocf_omap3_crypto_newsession()
[ 210.984313] keylen: 8, mode: 2
[ 210.987487] ocf_omap3_crypto_freesession()
[ 210.992767] ocf_omap3_crypto_newsession()
[ 210.997680] keylen: 24, mode: 3
[ 211.000915] ocf_omap3_crypto_freesession()
[ 211.006195] ocf_omap3_crypto_newsession()
[ 211.010284] keylen: 16, mode: 1
[ 211.014770] ocf_omap3_crypto_freesession()
[ 211.019012] ocf_omap3_crypto_newsession()
[ 211.024780] keylen: 24, mode: 1
[ 211.028808] ocf_omap3_crypto_freesession()
[ 211.033020] ocf_omap3_crypto_newsession()
[ 211.038208] keylen: 32, mode: 1
[ 211.041442] ocf_omap3_crypto_freesession()
[ 211.046966] ocf_omap3_crypto_newsession()
[ 211.051910] ocf_omap3_crypto_freesession()
[ 211.056121] ocf_omap3_crypto_newsession()
[ 211.062408] ocf_omap3_crypto_freesession()
[ 211.086059] ocf_omap3_crypto_newsession()
[ 211.103973] ocf_omap3_crypto_process()
[ 211.108703] flags: 0
[ 211.111297] DMA processing hash, id: 2, len: 63488
[ 211.117340] omap3_crypto_sha2md5_do: buf_len: 63488, len: 63488 l:
63424
[ 211.124938] Starting MD5: 001ef808 0000f7c0
[ 211.131744] Unable to handle kernel paging request at virtual
address 288423c4
[ 211.139038] pgd = c0004000
[ 211.141784] [288423c4] *pgd=00000000
[ 211.145416] Internal error: Oops: 80000005 [#1] PREEMPT
[ 211.150695] last sysfs file: /sys/module/ocf/initstate
[ 211.155853] Modules linked in: ocf_omap3_cryptok cryptodev(P)
ocf(P) rfcomm ipv6 hidp l2cap minix btusb bluetooth 8192cu rfkill
mt9t112
[ 211.168304] CPU: 0 Tainted: P (2.6.32 #1)
[ 211.173583] PC is at 0x288423c4
[ 211.176757] LR is at 0xfe40f8bc
[ 211.179931] pc : [<288423c4>] lr : [<fe40f8bc>] psr: 600000d3
[ 211.179962] sp : c0627f90 ip : 4f244e60 fp : 00000000
[ 211.191528] r10: 024701f7 r9 : c005f624 r8 : c0388a94
[ 211.196777] r7 : c004c46c r6 : 0000001f r5 : 413fc082 r4 :
c0672ddc
[ 211.203369] r3 : c0672dd8 r2 : c0672cf8 r1 : 00000003 r0 :
00000003
[ 211.209930] Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM
Segment kernel
[ 211.217498] Control: 10c5387d Table: 9fbc4019 DAC: 00000017
[ 211.223297] Process swapper (pid: 0, stack limit = 0xc06262f0)
[ 211.229156] Stack: (0xc0627f90 to 0xc0628000)
[ 211.233581] 7f80: c062c9f0
c0629fe0 c062c920 c06c64f4
[ 211.241821] 7fa0: 8002f440 c0387660 c067230c c0626000 c0629fe0
c0629e84 c067230c c003cfa4
[ 211.250091] 7fc0: 00000000 c06b94e0 c06722d0 c0031010 c0629e78
c0008984 c0008498 00000000
[ 211.258331] 7fe0: 00000000 c0031010 10c53c7d c0672360 c0031414
80008034 00000000 00000000
[ 211.266601] Code: bad PC value
[ 211.271087] ---[ end trace cb6f63cdbbc66001 ]---
[ 211.275787] Kernel panic - not syncing: Attempted to kill the idle
task!

Any hints ?

Ayoub Zaki

http://embeddedgeeks.wordpress.

the exact limit size is 62640 bytes.

when disabling dma

$ modprobe ocf_omap3_cryptok ocf_omap3_crypto_dma=0

hashing works for any input file size !

I'll have to compare the performance between dma and not dma modes
until this issue is fixed.

Ayoub Zaki
http://embeddedgeeks.wordpress.com