Commit Graph

18 Commits

Author SHA1 Message Date
Mingyen Hung d704a5e10d crypto: set dma_bus64 when dts is specified [1/1]
PD#SWPL-179066

Problem:
aml-crypto-dma insmod error

Solution:
1. Default configure for dma_bus64 is 32 bits,
set it to 64 bits if dts is specified.

Verify:
c3

Change-Id: I6265a9a60cac2dfe7bf3124ac2b69277268e5f31
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-07-25 20:34:22 -07:00
Mingyen Hung cedbad723b crypto: return error to up level [1/1]
PD#SWPL-177838

Problem:
Need to return error to up level

Solution:
1. Don't wait owner bit if error returned by crypto DMA
2. Check bit 1 of status reg for error
3. Flexible REE thread setting when apply SMCC call to set
dma_bus64

Verify:
s6 + bl201

Change-Id: If10ff026660174540de90e3ea787a5e42f273949
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-07-19 03:55:34 -07:00
Mingyen Hung b1dea7d928 crypto: support dma_bus64 [1/1]
PD#SWPL-172985

Problem:
Need to support 64 bits addressing

Solution:
1. Add dma_dsc_64 and dma_sg_dsc_64
2. dma_set_mask is set to 64
3. dma_set_coherent_mask is set to 40
4. SMCC call to set dma bus64 in bl31

Verify:
s6 + bl201

Change-Id: I0119e938d75671e47cbaadcfbfb8c3e87df01a66
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-07-11 22:05:48 -07:00
Mingyen Hung 1f42c6fdc3 Crypto: Ctr result is wrong [1/1]
PD#SWPL-174516

Problem:
Ctr result is wrong

Solution:
1. Lock whole loop of data processing
2. Revert re-using key/iv descriptors

Verify:
s4d + ap232 + yocto

Change-Id: I4e99dcf20284dfca3c6a1e50919eb6affcd041b1
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-07-03 23:11:19 -07:00
Matthew Shyu 3313854231 crypto: fix driver stuck when invalid key set [1/1]
PD#SWPL-172313

Problem:
When invalid key set, the driver stuck at waiting for owner bit.

Solution:
If the DMA meets error during processing, it will skip setting owner
bit.  Therefore, we should only wait for owner bit if everything is
good.

Verify:
S4D

Change-Id: Ic41998f568e78759e65a1c034ef30ae1eebd132a
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
2024-06-13 00:58:33 -07:00
Mingyen Hung cd43c1d4b7 Crypto: Fix wrong output and hang issue [1/1]
PD#SWPL-162511

Problem:
When running test bin with multithreading:
1. Testing hangs
2. Crypto result is incorrect

Solution:
1. Replacing thread manipulation with completion.
2. Rerun descriptors of key/iv setup since context of
crypto hw might be changed by other threads.

Verify:
s4d + ap232 + yocto

Change-Id: I477e7bda6f6c9dfb81fb58a361e0926b87698196
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-06-06 08:03:27 -07:00
Mingyen Hung 08e97d0aa4 crypto: bringup crypto driver for s7d [1/1]
PD#SWPL-163070

Problem:
Need to verify crypto driver on s7d

Solution:
1. Replacing kmalloc() with dma_alloc_coherent()
due to weird data abort.
2. digest_sz is specified in dts for s7d

Verify:
s7d + bm201

Change-Id: Ibeb09de26f8b6c825117e0791a3e51f74a8529df
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-04-21 22:34:45 -07:00
Matthew Shyu c566c0b12d sha3: add aml-sha-3 driver [1/1]
PD#SWPL-147293

Problem:
New SHA-3 module in S7D

Solution:
1. Add SHA-3 driver
2. Change SHA-2 ctx size to 40

Verify:
Z1

Change-Id: I515813081c73c07aee7683d2a986a4d42b880ba1
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
2024-04-17 19:31:20 +08:00
Mingyen Hung 6261750d06 Crypto: wait completion of Crypto DMA [1/1]
PD#SWPL-150680

Problem:
Wrong encryption results for AES128/CTR when using
/dev/aml_crypto

Solution:
Polling owner bit to make sure operation of Crypto
DMA is complete.

Verify:
s4d + ap232 + yocto

Change-Id: I8889dcf9cf452e4ca6b04a502c2ec7c1bb0bac8e
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2024-03-29 04:33:19 -07:00
Matthew Shyu 6c2efb16da crypto: fix race condition in aml crypto device [1/1]
PD#SWPL-138376

Problem:
When there are multiple process accessing crypto device at the same
time, some of the request might be dropped and causing process failed to
exit.

Solution:
Move mutex lock to properly protect HW operation

Verify:
S905C3

Change-Id: Ie12b1f46e87dcbbaf5df4f780711dcebc9c87e75
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
2023-10-13 02:14:07 -07:00
Matthew Shyu 488c926ef0 crypto: add sm4 support to aml-crypto-device on S5 [1/1]
PD#SWPL-140403

Problem:
Missing SM4 support in aml-crypto-device on S5

Solution:
Add SM4 support to aml-crypto-device

Verify:
S5

Change-Id: I0933bbcefa46daa5b00bd41d1e68fc9441bd3185
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
2023-09-19 00:08:45 -07:00
Doosan Baek a88ffafa68 KL/KT: Add a new seckey driver [1/1]
PD#SWPL-124965

Problem:
Need key ladder/table driver for kernel5.15
The KT driver needs to be separated from the descrambler.
New APIs are needed for the KT driver.

Solution:
Create a seckey driver.

Verify:
S5 KT/KL with DMA
T3 METACAS with Descramble
T5W

Change-Id: Id058e64f99918b66e79d24647880f999f55ca13a
Signed-off-by: Doosan Baek <doosan.baek@amlogic.com>
2023-05-31 20:54:04 -07:00
Mingyen Hung b98e17e279 Crypto: Bringup crypto driver for S5 [1/1]
PD#SWPL-108768

Problem:
Need to bringup amlogic crypto driver for s5,
kernel 5.15.

Solution:
1. Porting sm4 driver from 5.4

Verify:
1. On ax201
2. Pass crypto-test.sh s5

Change-Id: I7d9657e93d174457bf6b28ece58174ce25030b92
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2023-04-15 08:55:56 +08:00
Matthew Shyu eed49de68f crypto: enable aml crypto dts on t5m [1/1]
PD#SWPL-104759

Problem:
Bringup aml crypto on t5m

Solution:
Enable aml crypto dts on t5m

Verify:
T5M

Change-Id: I605aef6f6020924881ee2b5801beb8297611dd70
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
2022-12-30 17:18:41 +08:00
Mingyen Hung 60f55d8405 Crypto: compilation for lack of CONFIG_CRYPTO_DES [1/1]
PD#SWPL-96209

Problem:
Compilation error when CONFIG_CRYPTO_DES is disabled

Solution:
1. Strip out symbol issue by aml-crypto-dma and
that is from crypto des framework.

Verify:
1. On AN400

Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
Change-Id: I06e894ae10e55ab86c40ee7b2ebe2013c5412149
2022-10-06 19:38:06 -07:00
pengzhao.liu b946ffb848 typo: clear typo problem [1/1]
PD#SWPL-89627

Problem:
clear typo problem

Solution:
clear typo problem

Verify:
s4d

Signed-off-by: pengzhao.liu <pengzhao.liu@amlogic.com>
Change-Id: I9121c9d4b54df9b9a7c244182693e0fd616f5a9e
2022-09-07 20:06:45 +08:00
qinglin.li e396a77753 printk: printk optimization [1/1]
PD#SWPL-70486

Problem:
printk optimization

Solution:
printk optimization

Verify:
c2

Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
Change-Id: I02c3f778e95d7a95d9699b7c2b65be12caa3bb71
2022-03-22 01:34:59 -07:00
Mingyen Hung 1e8b4c307a crypto: bringup amlogic crypto driver [1/1]
PD#SWPL-71764

Problem:
Need to bringup amlogic crypto driver for
kernel 5.15.

Solution:
1. Bringup amlogic crypto driver
2. Enable SHA1, DES, and ECB if they are
disabled by default.
3. Merged from 5.4 and 5.10

Verify:
1. Built-in driver on C2_AF400
2. GKI driver on S4D AP_222

Change-Id: I62487e615930070233c3a6b4a41b66edddf6f783
Signed-off-by: Mingyen Hung <mingyen.hung@amlogic.com>
2022-03-03 04:13:47 -07:00