From: Dragos Rosioru <dragos.rosi...@nxp.com> This patch aims to enable PM support in the DCP driver. The values for DCP Control and Channel Control registers had to be saved and restored due to the fact that the DCP block would remain in a low-power mode and have its clocks gated after suspend/resume cycles.
A simple test consisting of running tcrypt speed tests in background and attempting to put the system in a sleep state(both shallow and deep) was used. The test failed due to inability to freeze the kernel threads. Freezing of tasks failed after 20.015 seconds (1 tasks refusing to freeze, wq_busy=0) The solution for this issue was to use the kthread freezer by calling try_to_freeze() on the processing threads. Would this be considered a correct solution in this particular case or should another approach, that does not rely on kthread freezer, be taken? In the later case, what would be the suggested option? modprobe tcrypt mode=500 sec=1 & pm_suspend.sh 1 & [ 171.648351] tcrypt: test 1 (128 bit key, 64 byte blocks): 2485 operations in 1 seconds (159040 bytes) [ 172.651560] tcrypt: test 2 (128 bit key, 256 byte blocks): 1523 operations in 1 seconds (389888 bytes) ... PM_SUSPEND 0 TINFO : PM_SUSPEND: Test WAIT and STOP mode times: 0 freeze standby mem rtc_testapp_6 0 TINFO : Open RTC device successfully: /dev/rtc rtc_testapp_6 0 TINFO : [ 196.270268] tcrypt: test 5 (128 bit key, 4096 byte blocks): ALARM TEST: RTC_ALM_SET & RTC_ALM_[ 196.755624] PM: suspend entry (shallow) READ rtc_testapp_6 0 TINFO : Read date/time... rtc_testapp_6 0 TINFO : Current RTC date/time is 2-1-1970, 17:50:59. rtc_testapp_6 0 TINFO : Set the alarm to 30 seconds in the future... rtc_testapp_6 0 TINFO : Enable alarm interrupts rtc_testapp_6 0 TINFO : Waiting 30 seconds for alarm....... [ 196.824708] Filesystems sync: 0.054 seconds [ 197.066653] Freezing user space processes ... ... [ 209.401137] tcrypt: [ 209.401137] testing speed of async cbc(aes) (cbc-aes-dcp) encryption [ 209.411104] tcrypt: test 0 (128 bit key, 16 byte blocks): 3228 operations in 1 seconds (51648 bytes) [ 210.419875] tcrypt: test 1 (128 bit key, 64 byte blocks): 3232 operations in 1 seconds (206848 bytes) ... [ 216.480736] tcrypt: test 7 (192 bit key, 64 byte blocks): 110395 operations in 1 seconds (7065280 bytes) [ 217.489804] [ 217.491391] Freezing of tasks failed after 20.423 seconds (1 tasks refusing to freeze, wq_busy=0): [ 217.500725] task:modprobe state:R running task stack: 0 pid: 482 ppid: 477 flags:0x00000001 [ 217.511782] [<c0e44368>] (__schedule) from [<c0e44b38>] (preempt_schedule_common+0x28/0x44) [ 217.520458] [<c0e44b38>] (preempt_schedule_common) from [<c0e44b90>] (_cond_resched+0x3c/0x44) [ 217.529380] [<c0e44b90>] (_cond_resched) from [<bf0003ec>] (test_skcipher_speed+0x31c/0x590 [tcrypt]) [ 217.538881] [<bf0003ec>] (test_skcipher_speed [tcrypt]) from [<bf004460>] (do_test+0x1bbc/0x42cc [tcrypt]) [ 217.548918] [<bf004460>] (do_test [tcrypt]) from [<bf00d05c>] (tcrypt_mod_init+0x5c/0x1000 [tcrypt]) [ 217.558434] [<bf00d05c>] (tcrypt_mod_init [tcrypt]) from [<c01022c4>] (do_one_initcall+0x84/0x3c4) [ 217.567726] [<c01022c4>] (do_one_initcall) from [<c01e603c>] (do_init_module+0x5c/0x280) [ 217.576128] [<c01e603c>] (do_init_module) from [<c01e8d98>] (sys_finit_module+0xb4/0xf4) [ 217.584533] [<c01e8d98>] (sys_finit_module) from [<c0100080>] (ret_fast_syscall+0x0/0x2c) [ 217.593010] Exception stack(0xc5099fa8 to 0xc5099ff0) [ 217.598157] 9fa0: 00000000 00000000 00000003 00759210 00000000 00040000 [ 217.606604] 9fc0: 00000000 00000000 00000000 0000017b 00759240 00759630 0000000e 00000000 [ 217.615048] 9fe0: be8c68e0 be8c68d0 004bce0d b6f083d2 [ 217.620349] [ 217.621919] OOM killer enabled. [ 217.625126] Restarting tasks ... done. [ 217.860270] PM: suspend exit rtc_testapp_6 1 TFAIL : rtc_test_6.c:449: Suspend operation failed on mode standby, please check rtc_testapp_6 0 TINFO : Exit suspend operation.... ... rtc_testapp_6 0 TINFO : Open RTC device success[ 224.738516] PM: suspend entry (deep) fully: /dev/rtc rtc_testapp_6 0 TINFO : ALA[ 224.747606] Filesystems sync: 0.002 seconds RM TEST: RTC_ALM_SET & RTC_ALM_READ rtc_testapp_6 0 TINFO : Read date/time... rtc_testapp_6 0 TINFO : Current RTC date/time is 2-1-1970, 17:51:27. rtc_testapp_6 0 TINFO : Set the alarm to 30 seconds in the future... rtc_testapp_6 0 TINFO : Enable alarm interrupts rtc_testapp_6 0 TINFO : Waiting 30 seconds for alarm....... ... [ 247.142469] testing speed of async xts(aes) (xts(ecb-aes-dcp)) encryption [ 247.153739] tcrypt: test 0 (256 bit key, 16 byte blocks): 2899 operations in 1 seconds (46384 bytes) [ 248.158437] tcrypt: test 1 (256 bit key, 64 byte blocks): [ 248.905430] [ 248.912762] Freezing of tasks failed after 20.011 seconds (1 tasks refusing to freeze, wq_busy=0): [ 248.922195] task:modprobe state:D stack: 0 pid: 482 ppid: 477 flags:0x0000000 1 [ 248.930926] [<c0e44368>] (__schedule) from [<c0e449ec>] (schedule+0x90/0x118) [ 248.938189] [<c0e449ec>] (schedule) from [<c0e49ad8>] (schedule_timeout+0xcc/0x120) [ 248.946156] [<c0e49ad8>] (schedule_timeout) from [<c0e45a20>] (wait_for_completion+0x90/0xf8) [ 248.955006] [<c0e45a20>] (wait_for_completion) from [<bf006c58>] (crypto_wait_req+0x20/0x30 [tcrypt]) [ 248.964599] [<bf006c58>] (crypto_wait_req [tcrypt]) from [<bf0003d8>] (test_skcipher_speed+0x308/0x590 [tcrypt]) [ 248.975137] [<bf0003d8>] (test_skcipher_speed [tcrypt]) from [<bf0044d4>] (do_test+0x1c30/0x42cc [tcrypt]) [ 248.985152] [<bf0044d4>] (do_test [tcrypt]) from [<bf00d05c>] (tcrypt_mod_init+0x5c/0x1000 [tcrypt]) [ 248.994649] [<bf00d05c>] (tcrypt_mod_init [tcrypt]) from [<c01022c4>] (do_one_initcall+0x84/0x3c4) [ 249.003935] [<c01022c4>] (do_one_initcall) from [<c01e603c>] (do_init_module+0x5c/0x280) [ 249.012331] [<c01e603c>] (do_init_module) from [<c01e8d98>] (sys_finit_module+0xb4/0xf4) [ 249.020708] [<c01e8d98>] (sys_finit_module) from [<c0100080>] (ret_fast_syscall+0x0/0x2c) [ 249.029180] Exception stack(0xc5099fa8 to 0xc5099ff0) [ 249.034325] 9fa0: 00000000 00000000 00000003 00759210 00000000 00040000 [ 249.042767] 9fc0: 00000000 00000000 00000000 0000017b 00759240 00759630 0000000e 00000000 [ 249.051205] 9fe0: be8c68e0 be8c68d0 004bce0d b6f083d2 [ 249.056347] [ 249.057912] OOM killer enabled. [ 249.061582] Restarting tasks ... [ 249.149290] 2457 operations in 1 seconds (157248 bytes) [ 249.157967] tcrypt: test 2 (256 bit key, 256 byte blocks):[ 249.397200] done. [ 249.445234] PM: suspend exit rtc_testapp_6 1 TFAIL : rtc_test_6.c:449: Suspend operation failed on mode mem, please check Dragos Rosioru (1): crypto: dcp - add power management support drivers/crypto/mxs-dcp.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 2 deletions(-) -- 2.7.4