[PATCH] crypto: hisilicon/sec2 - lower priority for hisilicon crypto implementations

Chenghai Huang posted 1 patch 1 month ago
drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] crypto: hisilicon/sec2 - lower priority for hisilicon crypto implementations
Posted by Chenghai Huang 1 month ago
From: lizhi <lizhi206@huawei.com>

Lower the priority of HiSilicon's crypto implementations to allow more
suitable alternatives to be selected. For example, certain kernel
use-cases do not benefit from HiSilicon's symmetric crypto algorithms.
This change ensures that more appropriate options are chosen first while
retaining HiSilicon's implementations as alternatives.

Signed-off-by: lizhi <lizhi206@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
 drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index 2471a4dd0b50..77e0e03cbcab 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -20,7 +20,7 @@
 #include "sec.h"
 #include "sec_crypto.h"
 
-#define SEC_PRIORITY		4001
+#define SEC_PRIORITY		80
 #define SEC_XTS_MIN_KEY_SIZE	(2 * AES_MIN_KEY_SIZE)
 #define SEC_XTS_MID_KEY_SIZE	(3 * AES_MIN_KEY_SIZE)
 #define SEC_XTS_MAX_KEY_SIZE	(2 * AES_MAX_KEY_SIZE)
-- 
2.33.0
Re: [PATCH] crypto: hisilicon/sec2 - lower priority for hisilicon crypto implementations
Posted by Herbert Xu 3 weeks ago
On Mon, May 11, 2026 at 08:49:27AM +0800, Chenghai Huang wrote:
> From: lizhi <lizhi206@huawei.com>
> 
> Lower the priority of HiSilicon's crypto implementations to allow more
> suitable alternatives to be selected. For example, certain kernel
> use-cases do not benefit from HiSilicon's symmetric crypto algorithms.
> This change ensures that more appropriate options are chosen first while
> retaining HiSilicon's implementations as alternatives.
> 
> Signed-off-by: lizhi <lizhi206@huawei.com>
> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> ---
>  drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: [PATCH] crypto: hisilicon/sec2 - lower priority for hisilicon crypto implementations
Posted by liulongfang 3 weeks, 3 days ago
On 2026/5/11 8:49, Chenghai Huang wrote:
> From: lizhi <lizhi206@huawei.com>
> 
> Lower the priority of HiSilicon's crypto implementations to allow more
> suitable alternatives to be selected. For example, certain kernel
> use-cases do not benefit from HiSilicon's symmetric crypto algorithms.
> This change ensures that more appropriate options are chosen first while
> retaining HiSilicon's implementations as alternatives.
> 
> Signed-off-by: lizhi <lizhi206@huawei.com>
> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> ---
>  drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
> index 2471a4dd0b50..77e0e03cbcab 100644
> --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
> +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
> @@ -20,7 +20,7 @@
>  #include "sec.h"
>  #include "sec_crypto.h"
>  
> -#define SEC_PRIORITY		4001
> +#define SEC_PRIORITY		80
>  #define SEC_XTS_MIN_KEY_SIZE	(2 * AES_MIN_KEY_SIZE)
>  #define SEC_XTS_MID_KEY_SIZE	(3 * AES_MIN_KEY_SIZE)
>  #define SEC_XTS_MAX_KEY_SIZE	(2 * AES_MAX_KEY_SIZE)
> 

Reviewed-by: Longfang Liu <liulongfang@huawei.com>

Thanks

Longfang.
Re: [PATCH] crypto: hisilicon/sec2 - lower priority for hisilicon crypto implementations
Posted by Eric Biggers 3 weeks, 3 days ago
On Wed, May 20, 2026 at 09:22:49AM +0800, liulongfang wrote:
> On 2026/5/11 8:49, Chenghai Huang wrote:
> > From: lizhi <lizhi206@huawei.com>
> > 
> > Lower the priority of HiSilicon's crypto implementations to allow more
> > suitable alternatives to be selected. For example, certain kernel
> > use-cases do not benefit from HiSilicon's symmetric crypto algorithms.
> > This change ensures that more appropriate options are chosen first while
> > retaining HiSilicon's implementations as alternatives.
> > 
> > Signed-off-by: lizhi <lizhi206@huawei.com>
> > Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
> > ---
> >  drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
> > index 2471a4dd0b50..77e0e03cbcab 100644
> > --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
> > +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
> > @@ -20,7 +20,7 @@
> >  #include "sec.h"
> >  #include "sec_crypto.h"
> >  
> > -#define SEC_PRIORITY		4001
> > +#define SEC_PRIORITY		80
> >  #define SEC_XTS_MIN_KEY_SIZE	(2 * AES_MIN_KEY_SIZE)
> >  #define SEC_XTS_MID_KEY_SIZE	(3 * AES_MIN_KEY_SIZE)
> >  #define SEC_XTS_MAX_KEY_SIZE	(2 * AES_MAX_KEY_SIZE)
> > 
> 
> Reviewed-by: Longfang Liu <liulongfang@huawei.com>

Makes sense, but perhaps this driver should just be removed entirely?

- Eric
Re: [PATCH] crypto: hisilicon/sec2 - lower priority for hisilicon crypto implementations
Posted by huangchenghai 3 weeks, 2 days ago
在 2026/5/20 9:32, Eric Biggers 写道:
> On Wed, May 20, 2026 at 09:22:49AM +0800, liulongfang wrote:
>> On 2026/5/11 8:49, Chenghai Huang wrote:
>>> From: lizhi <lizhi206@huawei.com>
>>>
>>> Lower the priority of HiSilicon's crypto implementations to allow more
>>> suitable alternatives to be selected. For example, certain kernel
>>> use-cases do not benefit from HiSilicon's symmetric crypto algorithms.
>>> This change ensures that more appropriate options are chosen first while
>>> retaining HiSilicon's implementations as alternatives.
>>>
>>> Signed-off-by: lizhi <lizhi206@huawei.com>
>>> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
>>> ---
>>>   drivers/crypto/hisilicon/sec2/sec_crypto.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
>>> index 2471a4dd0b50..77e0e03cbcab 100644
>>> --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
>>> +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
>>> @@ -20,7 +20,7 @@
>>>   #include "sec.h"
>>>   #include "sec_crypto.h"
>>>   
>>> -#define SEC_PRIORITY		4001
>>> +#define SEC_PRIORITY		80
>>>   #define SEC_XTS_MIN_KEY_SIZE	(2 * AES_MIN_KEY_SIZE)
>>>   #define SEC_XTS_MID_KEY_SIZE	(3 * AES_MIN_KEY_SIZE)
>>>   #define SEC_XTS_MAX_KEY_SIZE	(2 * AES_MAX_KEY_SIZE)
>>>
>> Reviewed-by: Longfang Liu <liulongfang@huawei.com>
> Makes sense, but perhaps this driver should just be removed entirely?
>
> - Eric
>
Hi Eric,

Thanks for the review.
We still have use cases to keep the driver.

1.Lowering the priority frees up hardware acceleration resources for 
targeted commercial use cases like storage encryption.
2.On old version of Kunpeng storage server, crypto instruction 
extensions may not be available, or the supported algorithm sets are 
limited. In these environments, users still use the HiSilicon hardware 
accelerator for encryption. Completely removing the driver would break 
support for those deployments.
3.Make the driver an optional backup, like QAT.

Best regards,
Chenghai