Hello,
My team is developing product based on on TI AM623 HS (with TI dev keys) processor on custom PCB.
Versions used:
Linux: 6.12.23
U-boot: 2025.04
OP-TEE: 4.6.0
ATF: 2.12
TI Linux firmware: 11.00.11
Important part of it is eMMC partition encryption and we use dm-crypt for it. Without sa2ul driver dm-crypt works as expected. However, when SA2UL driver is enabled data integrity is compromised. Files are not encrypted/decrypted correctly and dmesg is flooded with these errors:
[ 255.690867] ------------[ cut here ]------------
[ 255.690871] Failed to get suitable pool for 485c0000.dma-controller
[ 255.690887] WARNING: CPU: 3 PID: 50 at kernel/dma/pool.c:279 dma_alloc_from_pool+0x10c/0x1b0
[ 255.690903] Modules linked in: crct10dif_ce tidss k3_j72xx_bandgap rti_wdt drm_display_helper drm_dma_helper drm_kms_helper rtc_pcf8563 ti_ads1015 drm industrialio_triggered_buffer kfifo_buf at24 backlight cfg80211 fuse
[ 255.690954] CPU: 3 UID: 0 PID: 50 Comm: kworker/u16:2 Tainted: G W 6.12.23 #1
[ 255.690964] Tainted: [W]=WARN
[ 255.690968] Hardware name: Impro Technologies EC4 (DT)
[ 255.690972] Workqueue: kcryptd-253:0-1 kcryptd_crypt
[ 255.690982] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 255.690991] pc : dma_alloc_from_pool+0x10c/0x1b0
[ 255.691002] lr : dma_alloc_from_pool+0x10c/0x1b0
[ 255.691012] sp : ffff800081b438d0
[ 255.691015] x29: ffff800081b438d0 x28: ffff800081b43940 x27: ffff8000811cf000
[ 255.691030] x26: ffff800080136710 x25: ffff800081580000 x24: fffffdffc0000000
[ 255.691044] x23: 0000000000001000 x22: ffff8000811d7270 x21: 0000000000001000
[ 255.691058] x20: 0000000000000000 x19: ffff0000000a7900 x18: fffffffffffeb040
[ 255.691072] x17: 6567617020636e79 x16: 73612074736f6c20 x15: 0000000000000002
[ 255.691086] x14: ffff800081426250 x13: 20726f66206c6f6f x12: 7020656c62617469
[ 255.691100] x11: ffff800081426250 x10: 00000000000002a3 x9 : ffff80008147e250
[ 255.691114] x8 : 0000000000017fe8 x7 : 00000000fffff000 x6 : ffff80008147e250
[ 255.691128] x5 : ffff00003fd9d308 x4 : 0000000000000000 x3 : 0000000000000027
[ 255.691141] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000002ed8000
[ 255.691154] Call trace:
[ 255.691157] dma_alloc_from_pool+0x10c/0x1b0
[ 255.691169] dma_direct_alloc+0x210/0x3a0
[ 255.691177] dma_alloc_attrs+0x90/0x120
[ 255.691186] dma_pool_alloc+0xfc/0x220
[ 255.691198] udma_prep_slave_sg+0x658/0xaf0
[ 255.691207] sa_run+0x578/0x700
[ 255.691215] sa_cipher_run+0x13c/0x160
[ 255.691223] sa_encrypt+0x18/0x30
[ 255.691231] crypto_skcipher_encrypt+0x3c/0x60
[ 255.691239] crypt_convert.isra.0+0x7a4/0xd50
[ 255.691249] kcryptd_crypt_write_convert+0xcc/0x1e0
[ 255.691258] kcryptd_crypt+0x30/0x40
[ 255.691267] process_one_work+0x148/0x290
[ 255.691275] worker_thread+0x2c4/0x3f0
[ 255.691283] kthread+0x110/0x120
[ 255.691293] ret_from_fork+0x10/0x20
[ 255.691303] ---[ end trace 0000000000000000 ]---
[ 255.691310] ti-udma 485c0000.dma-controller: descriptor0 allocation failed
[ 255.691317] saul-crypto 40900000.crypto: OUT prep_slave_sg() failed
[ 255.691329] Buffer I/O error on dev dm-0, logical block 798, lost async page write
Doing my investigation, I was able to partially “fix” it by modifying device-tree, adding:
&crypto {
dmas = <&main_pktdma 0xf501 15>, <&main_pktdma 0x7506 15>,
<&main_pktdma 0x7507 15>;
};
this made error disappear, but data is still corrupted.
As a test, there is 10M of zeroes, written to mapper, rebooted and read read back, which has suspicious patterns:
# dd if=/dev/mapper/cmmcblk0p9 bs=1M count=10 | hexdump
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
010ce00 5515 3dd3 a154 6bb2 69b9 da34 e6a1 6591
010ce10 5f7c 3dd3 a154 6bb2 69b9 da34 e6a1 6591
*
010d000 0000 0000 0000 0000 0000 0000 0000 0000
*
03a3e80 c1b9 7f47 fe66 181a ae9d a133 bda8 76bd
03a3e90 5f7c 3dd3 a154 6bb2 69b9 da34 e6a1 6591
*
03a4000 0000 0000 0000 0000 0000 0000 0000 0000
*
041fe00 01f1 0000 0000 0000 0000 0000 0000 0000
041fe10 0000 0000 0000 0000 0000 0000 0000 0000
*
0420e00 0008 0000 0000 0000 0000 0000 0000 0000
0420e10 0000 0000 0000 0000 0000 0000 0000 0000
*
0421c00 01f1 0000 0000 0000 0000 0000 0000 0000
0421c10 0000 0000 0000 0000 0000 0000 0000 0000
*
0421e00 0008 0000 0000 0000 0000 0000 0000 0000
0421e10 0000 0000 0000 0000 0000 0000 0000 0000
*
046e800 000c 0000 0000 0000 0000 0000 0000 0000
046e810 0000 0000 0000 0000 0000 0000 0000 0000
*
046f000 000c 0000 0000 0000 0000 0000 0000 0000
046f010 0000 0000 0000 0000 0000 0000 0000 0000
*
0560c00 0017 0000 0000 0000 0000 0000 0000 0000
0560c10 0000 0000 0000 0000 0000 0000 0000 0000
*
0562200 0017 0000 0000 0000 0000 0000 0000 0000
0562210 0000 0000 0000 0000 0000 0000 0000 0000
*
0676c00 0074 0000 0000 0000 0000 0000 0000 0000
0676c10 0000 0000 0000 0000 0000 0000 0000 0000
*
0678400 0074 0000 0000 0000 0000 0000 0000 0000
0678410 0000 0000 0000 0000 0000 0000 0000 0000
*
07cbc00 0036 0000 0000 0000 0000 0000 0000 0000
07cbc10 0000 0000 0000 0000 0000 0000 0000 0000
*
07cd000 0036 0000 0000 0000 0000 0000 0000 0000
07cd010 0000 0000 0000 0000 0000 0000 0000 0000
*
0811c00 0016 0000 0000 0000 0000 0000 0000 0000
0811c10 0000 0000 0000 0000 0000 0000 0000 0000
*
0813000 0016 0000 0000 0000 0000 0000 0000 0000
0813010 0000 0000 0000 0000 0000 0000 0000 0000
*
084de00 0014 0000 0000 0000 0000 0000 0000 0000
084de10 0000 0000 0000 0000 0000 0000 0000 0000
*
084f600 0014 0000 0000 0000 0000 0000 0000 0000
084f610 0000 0000 0000 0000 0000 0000 0000 0000
*
089f400 01f9 0000 0000 0000 0000 0000 0000 0000
089f410 0000 0000 0000 0000 0000 0000 0000 0000
*
08a0600 01f9 0000 0000 0000 0000 0000 0000 0000
08a0610 0000 0000 0000 0000 0000 0000 0000 0000
*
08da600 0031 0000 0000 0000 0000 0000 0000 0000
08da610 0000 0000 0000 0000 0000 0000 0000 0000
*
08dc400 0031 0000 0000 0000 0000 0000 0000 0000
08dc410 0000 0000 0000 0000 0000 0000 0000 0000
*
0a00000
10+0 records in
10+0 records out
What I did so far:
- added/removed memory regions mentioned in k3-am62x-sk-common.dts,
- performed tests mentioned here: SA2UL_OMAP and outputs seems OK.
- ported most recent kernel changes in sa2ul.c to my BSP,
- used different HW samples,
- verified device-tree and kernel config,
- reverted versions of mentioned software to ones described in Linux SDK for AM62x version 10
Is this some known problem? Do you have any suggestions? Unfortunetely I did not find anything similar on your forum.