[PATCH v2 3/3] crypto: qce: fix version check

Jingyi Wang posted 3 patches 1 month, 2 weeks ago
[PATCH v2 3/3] crypto: qce: fix version check
Posted by Jingyi Wang 1 month, 2 weeks ago
From: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>

The previous version check made it difficult to support newer major
versions (e.g., v6.0) without adding extra checks/macros. Update the
logic to only reject v5.0 and allow future versions without additional
changes.

Signed-off-by: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
Signed-off-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
---
 drivers/crypto/qce/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index e95e84486d9a..b966f3365b7d 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -21,7 +21,6 @@
 #include "sha.h"
 #include "aead.h"
 
-#define QCE_MAJOR_VERSION5	0x05
 #define QCE_QUEUE_LENGTH	1
 
 #define QCE_DEFAULT_MEM_BANDWIDTH	393600
@@ -161,7 +160,7 @@ static int qce_check_version(struct qce_device *qce)
 	 * the driver does not support v5 with minor 0 because it has special
 	 * alignment requirements.
 	 */
-	if (major != QCE_MAJOR_VERSION5 || minor == 0)
+	if (major == 5 && minor == 0)
 		return -ENODEV;
 
 	qce->burst_size = QCE_BAM_BURST_SIZE;

-- 
2.25.1
Re: [PATCH v2 3/3] crypto: qce: fix version check
Posted by Bjorn Andersson 1 month, 2 weeks ago
On Wed, Oct 29, 2025 at 01:25:31AM -0700, Jingyi Wang wrote:
> From: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
> 
> The previous version check made it difficult to support newer major
> versions (e.g., v6.0) without adding extra checks/macros. Update the
> logic to only reject v5.0 and allow future versions without additional
> changes.
> 
> Signed-off-by: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
> Signed-off-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com>

Reviewed-by: Bjorn Andersson <andersson@kernel.org>

> ---
>  drivers/crypto/qce/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index e95e84486d9a..b966f3365b7d 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -21,7 +21,6 @@
>  #include "sha.h"
>  #include "aead.h"
>  
> -#define QCE_MAJOR_VERSION5	0x05
>  #define QCE_QUEUE_LENGTH	1
>  
>  #define QCE_DEFAULT_MEM_BANDWIDTH	393600
> @@ -161,7 +160,7 @@ static int qce_check_version(struct qce_device *qce)
>  	 * the driver does not support v5 with minor 0 because it has special
>  	 * alignment requirements.
>  	 */
> -	if (major != QCE_MAJOR_VERSION5 || minor == 0)
> +	if (major == 5 && minor == 0)
>  		return -ENODEV;
>  
>  	qce->burst_size = QCE_BAM_BURST_SIZE;
> 
> -- 
> 2.25.1
>
Re: [PATCH v2 3/3] crypto: qce: fix version check
Posted by Konrad Dybcio 1 month, 2 weeks ago
On 10/29/25 9:25 AM, Jingyi Wang wrote:
> From: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
> 
> The previous version check made it difficult to support newer major
> versions (e.g., v6.0) without adding extra checks/macros. Update the
> logic to only reject v5.0 and allow future versions without additional
> changes.
> 
> Signed-off-by: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
> Signed-off-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
> ---
>  drivers/crypto/qce/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index e95e84486d9a..b966f3365b7d 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -21,7 +21,6 @@
>  #include "sha.h"
>  #include "aead.h"
>  
> -#define QCE_MAJOR_VERSION5	0x05
>  #define QCE_QUEUE_LENGTH	1
>  
>  #define QCE_DEFAULT_MEM_BANDWIDTH	393600
> @@ -161,7 +160,7 @@ static int qce_check_version(struct qce_device *qce)
>  	 * the driver does not support v5 with minor 0 because it has special
>  	 * alignment requirements.
>  	 */
> -	if (major != QCE_MAJOR_VERSION5 || minor == 0)
> +	if (major == 5 && minor == 0)
>  		return -ENODEV;

This also allows major < 5, should we add a second check to reject that?

Konrad
Re: [PATCH v2 3/3] crypto: qce: fix version check
Posted by Bjorn Andersson 1 month, 2 weeks ago
On Wed, Oct 29, 2025 at 10:41:48AM +0100, Konrad Dybcio wrote:
> On 10/29/25 9:25 AM, Jingyi Wang wrote:
> > From: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
> > 
> > The previous version check made it difficult to support newer major
> > versions (e.g., v6.0) without adding extra checks/macros. Update the
> > logic to only reject v5.0 and allow future versions without additional
> > changes.
> > 
> > Signed-off-by: Gaurav Kashyap <gaurav.kashyap@oss.qualcomm.com>
> > Signed-off-by: Jingyi Wang <jingyi.wang@oss.qualcomm.com>
> > ---
> >  drivers/crypto/qce/core.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> > index e95e84486d9a..b966f3365b7d 100644
> > --- a/drivers/crypto/qce/core.c
> > +++ b/drivers/crypto/qce/core.c
> > @@ -21,7 +21,6 @@
> >  #include "sha.h"
> >  #include "aead.h"
> >  
> > -#define QCE_MAJOR_VERSION5	0x05
> >  #define QCE_QUEUE_LENGTH	1
> >  
> >  #define QCE_DEFAULT_MEM_BANDWIDTH	393600
> > @@ -161,7 +160,7 @@ static int qce_check_version(struct qce_device *qce)
> >  	 * the driver does not support v5 with minor 0 because it has special
> >  	 * alignment requirements.
> >  	 */
> > -	if (major != QCE_MAJOR_VERSION5 || minor == 0)
> > +	if (major == 5 && minor == 0)
> >  		return -ENODEV;
> 
> This also allows major < 5, should we add a second check to reject that?
> 

The comment says we don't support v5.0, now the code says the same.

I think it's okay to leave handling of previous versions as undefined.
Given the current way this is expressed, there's can't be any existing
users...

Regards,
Bjorn

> Konrad