Re: [PATCH] crypto: hisilicon/hpre - fix unmapping invalid dma address

2021-04-19 Thread Hui Tang
On 2021/4/16 19:26, Herbert Xu wrote: On Sat, Apr 10, 2021 at 05:49:17PM +0800, Hui Tang wrote: Currently, an invalid dma address may be unmapped when calling 'xx_data_clr_all' in error path, so check dma address of sqe in/out whether it has been mapped before calling 'dma_free_coherent

[PATCH v3] crypto: hisilicon/hpre - delete redundant log and return in advance

2021-04-10 Thread Hui Tang
'hpre_cfg_by_dsm' has checked and printed error path internally. It is not necessary to do it here, so remove it. It should return error immediately when return value of 'hpre_cfg_by_dsm' is non-zero, and no need to execute the remaining sentences. Signed-off-by: Hui Tang --- v1 ->

[PATCH] crypto: hisilicon/hpre - fix unmapping invalid dma address

2021-04-10 Thread Hui Tang
-> hpre_curve25519_src_init -> hpre_curve25519_hw_data_clr_all Fixes: a9214b0b6ed2(crypto: hisilicon - fix the check on dma address) Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/

[PATCH 3/3] crypto: hisilicon/hpre - add debug log

2021-04-10 Thread Hui Tang
When the received sqe is abnormal, the error message in the sqe written back by the hardware is printed to help to analyze the abnormal causes. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git

[PATCH 2/3] crypto: hisilicon/hpre - use the correct variable type

2021-04-10 Thread Hui Tang
The return value of 'le32_to_cpu' is unsigned, so change the variable type from 'int' to 'unsigned int'. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b

[PATCH 0/3] crypto: hisilicon/hpre - add debug log

2021-04-10 Thread Hui Tang
This patchset adds the debug log and cleanup code style. Hui Tang (3): crypto: hisilicon/hpre - delete the rudundant space after return crypto: hisilicon/hpre - use the correct variable type crypto: hisilicon/hpre - add debug log drivers/crypto/hisilicon/hpre/hpre_crypto.c | 11

[PATCH 1/3] crypto: hisilicon/hpre - delete the rudundant space after return

2021-04-10 Thread Hui Tang
There are two spaces after return, just keep one. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 +- drivers/crypto/hisilicon/hpre/hpre_main.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b

Re: [PATCH v2] crypto: hisilicon/hpre - delete redundant log

2021-04-09 Thread Hui Tang
On 2021/4/9 15:33, Herbert Xu wrote: On Fri, Apr 02, 2021 at 07:24:29PM +0800, Hui Tang wrote: 'hpre_cfg_by_dsm' has checked and printed error path internally. It is not necessary to do it here, so remove it. Signed-off-by: Hui Tang v1 -> v2: - Return immediately when return va

[PATCH v2] crypto: hisilicon/hpre - delete redundant log

2021-04-02 Thread Hui Tang
'hpre_cfg_by_dsm' has checked and printed error path internally. It is not necessary to do it here, so remove it. Signed-off-by: Hui Tang v1 -> v2: - Return immediately when return value of 'hpre_cfg_by_dsm' is non-zero. --- drivers/crypto/hisilicon/hpre/hpre_main.c | 2 +- 1 file changed

[PATCH] crypto: hisilicon - check if debugfs opened

2021-03-27 Thread Hui Tang
'xx_debugfs_init' check if debugfs opened. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 5 - drivers/crypto/hisilicon/qm.c | 3 +++ drivers/crypto/hisilicon/sec2/sec_main.c | 5 - drivers/crypto/hisilicon/zip/zip_main.c | 3 +++ 4 files changed

[PATCH] crypto: hisilicon/hpre - delete redundant log

2021-03-27 Thread Hui Tang
'hpre_cfg_by_dsm' has checked and printed error path, so it is not necessary at all. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto

[PATCH] crypto: hisilicon - delete redundant '\n'

2021-03-27 Thread Hui Tang
It has newline already by sysfs, so delete redundant '\n' Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 4 ++-- drivers/crypto/hisilicon/sec2/sec_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b

[PATCH] crypto: hisilicon/hpre - fix a typo and delete redundant blank line

2021-03-27 Thread Hui Tang
s/shoul/should/ Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index f2605c4..8aae921 100644 --- a/drivers/crypto

[PATCH] crypto: hisilicon/hpre - fix PASID setting on kunpeng 920

2021-03-27 Thread Hui Tang
We must confirm the PASID is disabled before using no-sva mode. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 43 +-- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto

[PATCH] crypto: hisilicon/hpre - fix Kconfig

2021-03-19 Thread Hui Tang
hpre select 'CRYPTO_ECDH' and 'CRYPTO_CURVE25519'. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/Kconfig b/drivers/crypto/hisilicon/Kconfig index c45adb1..e572f99 100644 --- a/drivers

[PATCH] crypto: hisilicon/hpre - fix "hpre_ctx_init" resource leak

2021-03-19 Thread Hui Tang
When calling "hpre_ctx_set" fails, stop and put qp, otherwise will leak qp resource. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c

[PATCH] crypto: hisilicon - fix the check on dma address

2021-03-19 Thread Hui Tang
System may be able to get physical address of zero if not reserved by firmware. The dma address obtained by 'dma_alloc_coherent' is valid, since already checking cpu va before, so do not check again. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 12

[PATCH 0/2] crypto: hisilicon/hpre - remove 'CONFIG_CRYPTO_DH'

2021-03-19 Thread Hui Tang
Remove 'CONFIG_CRYPTO_DH' and optimise 'hpre_algs_register' error path. Hui Tang (2): crypto: hisilicon/hpre - delete wrap of 'CONFIG_CRYPTO_DH' crypto: hisilicon/hpre - optimise 'hpre_algs_register' error path drivers/crypto/hisilicon/hpre/hpre_crypto.c | 30

[PATCH 2/2] crypto: hisilicon/hpre - optimise 'hpre_algs_register' error path

2021-03-19 Thread Hui Tang
There is redundant code especially when registing new algorithms in the future. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers

[PATCH 1/2] crypto: hisilicon/hpre - delete wrap of 'CONFIG_CRYPTO_DH'

2021-03-19 Thread Hui Tang
'CRYPTO_DH' has selected in 'Kconfig', so delete 'CONFIG_CRYPTO_DH'. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon

[PATCH v2 0/2] crypto: qat - fixes related to 'dma_map_single'

2021-03-04 Thread Hui Tang
This patchset fix bugs related to 'dma_map_single' use: Hui Tang (2): crypto: qat - fix 'dma_unmap_single' invalid address crypto: qat - fix use of 'dma_map_single' v1 -> v2: 1.fix build warning reported by kernel test rebot 2.add patch #1 drivers/crypto/qat/qat_com

[PATCH v2 2/2] crypto: qat - fix use of 'dma_map_single'

2021-03-04 Thread Hui Tang
DMA_TO_DEVICE synchronisation must be done after the last modification of the memory region by the software and before it is handed off to the device. Signed-off-by: Hui Tang Reported-by: kernel test robot Reported-by: Dan Carpenter --- drivers/crypto/qat/qat_common/qat_algs.c | 27

[PATCH v2 1/2] crypto: qat - fix unmap invalid dma address

2021-03-04 Thread Hui Tang
'dma_mapping_error' return a negative value if 'dma_addr' is equal to 'DMA_MAPPING_ERROR' not zero, so fix initialization of 'dma_addr'. Signed-off-by: Hui Tang --- drivers/crypto/qat/qat_common/qat_algs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers

[PATCH] video: fbdev: fix use of 'dma_map_single'

2021-02-28 Thread Hui Tang
DMA_TO_DEVICE synchronisation must be done after the last modification of the memory region by the software and before it is handed off to the device. Signed-off-by: Hui Tang --- drivers/video/fbdev/grvga.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video

[PATCH] crypto: qat - fix use of 'dma_map_single'

2021-02-28 Thread Hui Tang
DMA_TO_DEVICE synchronisation must be done after the last modification of the memory region by the software and before it is handed off to the device. Signed-off-by: Hui Tang --- drivers/crypto/qat/qat_common/qat_algs.c | 23 --- 1 file changed, 12 insertions(+), 11

[PATCH] crypto: hisilicon/hpre - enable Elliptic curve cryptography

2021-02-04 Thread Hui Tang
Enable x25519/x448/ecdh/ecdsa/sm2 algorithm on Kunpeng 930. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c

[PATCH 0/4] crypto: hisilicon - some updates to adapt Kunpeng930

2021-02-04 Thread Hui Tang
1.Update clusters number for both Kunpeng920 and Kunpeng930. 2.Some bugfixs only on Kunpeng920, so added hardware version wrap. 3.Fix use of 'dma_map_single'. 4.Fix PASID on Kunpeng930. Hui Tang (2): crypto: hisilicon/hpre - adapt the number of clusters crypto: hisilicon/hpre - tiny fix

[PATCH 3/4] crypto: hisilicon/qm - fix use of 'dma_map_single'

2021-02-04 Thread Hui Tang
From: Weili Qian Calling 'dma_map_single' after the data is written to ensure that the cpu cache and dma cache are consistent. Signed-off-by: Weili Qian Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/qm.c | 50 +++ 1 file changed, 27 insertions

[PATCH 2/4] crypto: hisilicon/hpre - tiny fix

2021-02-04 Thread Hui Tang
Update since some special settings only for Kunpeng920. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c

[PATCH 1/4] crypto: hisilicon/hpre - adapt the number of clusters

2021-02-04 Thread Hui Tang
HPRE of Kunpeng 930 is updated on cluster numbers, so we try to update this driver to make it running okay on Kunpeng920/Kunpeng930 chips. Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre.h | 8 ++-- drivers/crypto/hisilicon/hpre/hpre_main.c | 71

[PATCH 4/4] crypto: hisilicon - PASID fixed on Kunpeng 930

2021-02-04 Thread Hui Tang
From: Weili Qian Enable PASID by setting 'sqc' and 'cqc' pasid bits per queue in Kunpeng 930. For Kunpeng 920, PASID is effective for all queues once set in SVA scenarios. Signed-off-by: Weili Qian Signed-off-by: Hui Tang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 18

[PATCH] crypto: hisilicon/hpre - add ecc algorithm inqury for uacce device

2021-01-18 Thread Hui Tang
Uacce SysFS support more algorithms inqury such as 'ecdh/ecdsa/sm2/x25519/x448' Signed-off-by: Hui Tang Reviewed-by: Zaibo Xu --- drivers/crypto/hisilicon/hpre/hpre_main.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b

[PATCH] crypto: hisilicon/hpre - add two RAS correctable errors processing

2021-01-18 Thread Hui Tang
1.One CE error is detecting timeout of generating a random number. 2.Another is detecting timeout of SVA prefetching address. Signed-off-by: Hui Tang Reviewed-by: Zaibo Xu --- drivers/crypto/hisilicon/hpre/hpre_main.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git

[PATCH] crypto: hisilicon/hpre - delete ECC 1bit error reported threshold

2021-01-18 Thread Hui Tang
Delete 'HPRE_RAS_ECC1BIT_TH' register setting of hpre, since register 'QM_RAS_CE_THRESHOLD' of qm has done this work. Signed-off-by: Hui Tang Reviewed-by: Zaibo Xu --- drivers/crypto/hisilicon/hpre/hpre_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre