Re: [V3 PATCH 01/16] powerpc/powernv/vas: Rename register/unregister functions

2021-05-10 Thread Haren Myneni
On Mon, 2021-05-10 at 15:10 +1000, Nicholas Piggin wrote:
> Excerpts from Haren Myneni's message of April 18, 2021 7:00 am:
> > powerNV and pseries drivers register / unregister to the
> > corresponding
> > VAS code separately. So rename powerNV VAS API register/unregister
> > functions.
> 
> The pseries VAS driver will have different calls for registering a
> coprocessor driver, you mean?
> 
> It certainly looks the same 
> 
> (from patch 13)
>   ret = vas_register_api_pseries(THIS_MODULE, VAS_COP_TYPE_GZIP,
>  "nx-gzip");
> 
> So I guess it's just a matter of the driver being different enough
> that 
> there is no benefit to making this call common (and branching to
> pseries
> or powernv dynamically).

Thanks for your review and comments on all patches. 

Yes, we have separate drivers nx-common-powernv/nx-common-pseries for
powerNV and pseries. 
API registeration patch is:
- driver calls platform specific API
   vas_register_api_powernv/pseries
- Platform specific code calls common API with its vas_user_win_ops
   vas_register_coproc_api()

> 
> Reviewed-by: Nicholas Piggin 
> 
> > Signed-off-by: Haren Myneni 
> > ---
> >  arch/powerpc/include/asm/vas.h   |  6 +++---
> >  arch/powerpc/platforms/powernv/vas-api.c | 10 +-
> >  drivers/crypto/nx/nx-common-powernv.c|  6 +++---
> >  3 files changed, 11 insertions(+), 11 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/vas.h
> > b/arch/powerpc/include/asm/vas.h
> > index e33f80b0ea81..41f73fae7ab8 100644
> > --- a/arch/powerpc/include/asm/vas.h
> > +++ b/arch/powerpc/include/asm/vas.h
> > @@ -170,8 +170,8 @@ int vas_paste_crb(struct vas_window *win, int
> > offset, bool re);
> >   * Only NX GZIP coprocessor type is supported now, but this API
> > can be
> >   * used for others in future.
> >   */
> > -int vas_register_coproc_api(struct module *mod, enum vas_cop_type
> > cop_type,
> > -   const char *name);
> > -void vas_unregister_coproc_api(void);
> > +int vas_register_api_powernv(struct module *mod, enum vas_cop_type
> > cop_type,
> > +const char *name);
> > +void vas_unregister_api_powernv(void);
> >  
> >  #endif /* __ASM_POWERPC_VAS_H */
> > diff --git a/arch/powerpc/platforms/powernv/vas-api.c
> > b/arch/powerpc/platforms/powernv/vas-api.c
> > index 98ed5d8c5441..72d8ce39e56c 100644
> > --- a/arch/powerpc/platforms/powernv/vas-api.c
> > +++ b/arch/powerpc/platforms/powernv/vas-api.c
> > @@ -207,8 +207,8 @@ static struct file_operations coproc_fops = {
> >   * Supporting only nx-gzip coprocessor type now, but this API code
> >   * extended to other coprocessor types later.
> >   */
> > -int vas_register_coproc_api(struct module *mod, enum vas_cop_type
> > cop_type,
> > -   const char *name)
> > +int vas_register_api_powernv(struct module *mod, enum vas_cop_type
> > cop_type,
> > +const char *name)
> >  {
> > int rc = -EINVAL;
> > dev_t devno;
> > @@ -262,9 +262,9 @@ int vas_register_coproc_api(struct module *mod,
> > enum vas_cop_type cop_type,
> > unregister_chrdev_region(coproc_device.devt, 1);
> > return rc;
> >  }
> > -EXPORT_SYMBOL_GPL(vas_register_coproc_api);
> > +EXPORT_SYMBOL_GPL(vas_register_api_powernv);
> >  
> > -void vas_unregister_coproc_api(void)
> > +void vas_unregister_api_powernv(void)
> >  {
> > dev_t devno;
> >  
> > @@ -275,4 +275,4 @@ void vas_unregister_coproc_api(void)
> > class_destroy(coproc_device.class);
> > unregister_chrdev_region(coproc_device.devt, 1);
> >  }
> > -EXPORT_SYMBOL_GPL(vas_unregister_coproc_api);
> > +EXPORT_SYMBOL_GPL(vas_unregister_api_powernv);
> > diff --git a/drivers/crypto/nx/nx-common-powernv.c
> > b/drivers/crypto/nx/nx-common-powernv.c
> > index 13c65deda8e9..88d728415bb2 100644
> > --- a/drivers/crypto/nx/nx-common-powernv.c
> > +++ b/drivers/crypto/nx/nx-common-powernv.c
> > @@ -1090,8 +1090,8 @@ static __init int
> > nx_compress_powernv_init(void)
> >  * normal FIFO priority is assigned for userspace.
> >  * 842 compression is supported only in kernel.
> >  */
> > -   ret = vas_register_coproc_api(THIS_MODULE,
> > VAS_COP_TYPE_GZIP,
> > -   "nx-gzip");
> > +   ret = vas_register_api_powernv(THIS_MODULE,
> > VAS_COP_TYPE_GZIP,
> > +  "nx-gzip");
> >  
> > /*
> >  * GZIP is not supported in kernel right now.
> > @@ -1127,7 +1127,7 @@ static void __exit
> > nx_compress_powernv_exit(void)
> >  * use. So delete this API use for GZIP engine.
> >  */
> > if (!nx842_ct)
> > -   vas_unregister_coproc_api();
> > +   vas_unregister_api_powernv();
> >  
> > crypto_unregister_alg(_powernv_alg);
> >  
> > -- 
> > 2.18.2
> > 
> > 
> > 



Re: [V3 PATCH 01/16] powerpc/powernv/vas: Rename register/unregister functions

2021-05-09 Thread Nicholas Piggin
Excerpts from Haren Myneni's message of April 18, 2021 7:00 am:
> 
> powerNV and pseries drivers register / unregister to the corresponding
> VAS code separately. So rename powerNV VAS API register/unregister
> functions.

The pseries VAS driver will have different calls for registering a
coprocessor driver, you mean?

It certainly looks the same 

(from patch 13)
ret = vas_register_api_pseries(THIS_MODULE, VAS_COP_TYPE_GZIP,
   "nx-gzip");

So I guess it's just a matter of the driver being different enough that 
there is no benefit to making this call common (and branching to pseries
or powernv dynamically).

Reviewed-by: Nicholas Piggin 

> 
> Signed-off-by: Haren Myneni 
> ---
>  arch/powerpc/include/asm/vas.h   |  6 +++---
>  arch/powerpc/platforms/powernv/vas-api.c | 10 +-
>  drivers/crypto/nx/nx-common-powernv.c|  6 +++---
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h
> index e33f80b0ea81..41f73fae7ab8 100644
> --- a/arch/powerpc/include/asm/vas.h
> +++ b/arch/powerpc/include/asm/vas.h
> @@ -170,8 +170,8 @@ int vas_paste_crb(struct vas_window *win, int offset, 
> bool re);
>   * Only NX GZIP coprocessor type is supported now, but this API can be
>   * used for others in future.
>   */
> -int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
> - const char *name);
> -void vas_unregister_coproc_api(void);
> +int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_type,
> +  const char *name);
> +void vas_unregister_api_powernv(void);
>  
>  #endif /* __ASM_POWERPC_VAS_H */
> diff --git a/arch/powerpc/platforms/powernv/vas-api.c 
> b/arch/powerpc/platforms/powernv/vas-api.c
> index 98ed5d8c5441..72d8ce39e56c 100644
> --- a/arch/powerpc/platforms/powernv/vas-api.c
> +++ b/arch/powerpc/platforms/powernv/vas-api.c
> @@ -207,8 +207,8 @@ static struct file_operations coproc_fops = {
>   * Supporting only nx-gzip coprocessor type now, but this API code
>   * extended to other coprocessor types later.
>   */
> -int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
> - const char *name)
> +int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_type,
> +  const char *name)
>  {
>   int rc = -EINVAL;
>   dev_t devno;
> @@ -262,9 +262,9 @@ int vas_register_coproc_api(struct module *mod, enum 
> vas_cop_type cop_type,
>   unregister_chrdev_region(coproc_device.devt, 1);
>   return rc;
>  }
> -EXPORT_SYMBOL_GPL(vas_register_coproc_api);
> +EXPORT_SYMBOL_GPL(vas_register_api_powernv);
>  
> -void vas_unregister_coproc_api(void)
> +void vas_unregister_api_powernv(void)
>  {
>   dev_t devno;
>  
> @@ -275,4 +275,4 @@ void vas_unregister_coproc_api(void)
>   class_destroy(coproc_device.class);
>   unregister_chrdev_region(coproc_device.devt, 1);
>  }
> -EXPORT_SYMBOL_GPL(vas_unregister_coproc_api);
> +EXPORT_SYMBOL_GPL(vas_unregister_api_powernv);
> diff --git a/drivers/crypto/nx/nx-common-powernv.c 
> b/drivers/crypto/nx/nx-common-powernv.c
> index 13c65deda8e9..88d728415bb2 100644
> --- a/drivers/crypto/nx/nx-common-powernv.c
> +++ b/drivers/crypto/nx/nx-common-powernv.c
> @@ -1090,8 +1090,8 @@ static __init int nx_compress_powernv_init(void)
>* normal FIFO priority is assigned for userspace.
>* 842 compression is supported only in kernel.
>*/
> - ret = vas_register_coproc_api(THIS_MODULE, VAS_COP_TYPE_GZIP,
> - "nx-gzip");
> + ret = vas_register_api_powernv(THIS_MODULE, VAS_COP_TYPE_GZIP,
> +"nx-gzip");
>  
>   /*
>* GZIP is not supported in kernel right now.
> @@ -1127,7 +1127,7 @@ static void __exit nx_compress_powernv_exit(void)
>* use. So delete this API use for GZIP engine.
>*/
>   if (!nx842_ct)
> - vas_unregister_coproc_api();
> + vas_unregister_api_powernv();
>  
>   crypto_unregister_alg(_powernv_alg);
>  
> -- 
> 2.18.2
> 
> 
> 


[V3 PATCH 01/16] powerpc/powernv/vas: Rename register/unregister functions

2021-04-17 Thread Haren Myneni


powerNV and pseries drivers register / unregister to the corresponding
VAS code separately. So rename powerNV VAS API register/unregister
functions.

Signed-off-by: Haren Myneni 
---
 arch/powerpc/include/asm/vas.h   |  6 +++---
 arch/powerpc/platforms/powernv/vas-api.c | 10 +-
 drivers/crypto/nx/nx-common-powernv.c|  6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h
index e33f80b0ea81..41f73fae7ab8 100644
--- a/arch/powerpc/include/asm/vas.h
+++ b/arch/powerpc/include/asm/vas.h
@@ -170,8 +170,8 @@ int vas_paste_crb(struct vas_window *win, int offset, bool 
re);
  * Only NX GZIP coprocessor type is supported now, but this API can be
  * used for others in future.
  */
-int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
-   const char *name);
-void vas_unregister_coproc_api(void);
+int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_type,
+const char *name);
+void vas_unregister_api_powernv(void);
 
 #endif /* __ASM_POWERPC_VAS_H */
diff --git a/arch/powerpc/platforms/powernv/vas-api.c 
b/arch/powerpc/platforms/powernv/vas-api.c
index 98ed5d8c5441..72d8ce39e56c 100644
--- a/arch/powerpc/platforms/powernv/vas-api.c
+++ b/arch/powerpc/platforms/powernv/vas-api.c
@@ -207,8 +207,8 @@ static struct file_operations coproc_fops = {
  * Supporting only nx-gzip coprocessor type now, but this API code
  * extended to other coprocessor types later.
  */
-int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
-   const char *name)
+int vas_register_api_powernv(struct module *mod, enum vas_cop_type cop_type,
+const char *name)
 {
int rc = -EINVAL;
dev_t devno;
@@ -262,9 +262,9 @@ int vas_register_coproc_api(struct module *mod, enum 
vas_cop_type cop_type,
unregister_chrdev_region(coproc_device.devt, 1);
return rc;
 }
-EXPORT_SYMBOL_GPL(vas_register_coproc_api);
+EXPORT_SYMBOL_GPL(vas_register_api_powernv);
 
-void vas_unregister_coproc_api(void)
+void vas_unregister_api_powernv(void)
 {
dev_t devno;
 
@@ -275,4 +275,4 @@ void vas_unregister_coproc_api(void)
class_destroy(coproc_device.class);
unregister_chrdev_region(coproc_device.devt, 1);
 }
-EXPORT_SYMBOL_GPL(vas_unregister_coproc_api);
+EXPORT_SYMBOL_GPL(vas_unregister_api_powernv);
diff --git a/drivers/crypto/nx/nx-common-powernv.c 
b/drivers/crypto/nx/nx-common-powernv.c
index 13c65deda8e9..88d728415bb2 100644
--- a/drivers/crypto/nx/nx-common-powernv.c
+++ b/drivers/crypto/nx/nx-common-powernv.c
@@ -1090,8 +1090,8 @@ static __init int nx_compress_powernv_init(void)
 * normal FIFO priority is assigned for userspace.
 * 842 compression is supported only in kernel.
 */
-   ret = vas_register_coproc_api(THIS_MODULE, VAS_COP_TYPE_GZIP,
-   "nx-gzip");
+   ret = vas_register_api_powernv(THIS_MODULE, VAS_COP_TYPE_GZIP,
+  "nx-gzip");
 
/*
 * GZIP is not supported in kernel right now.
@@ -1127,7 +1127,7 @@ static void __exit nx_compress_powernv_exit(void)
 * use. So delete this API use for GZIP engine.
 */
if (!nx842_ct)
-   vas_unregister_coproc_api();
+   vas_unregister_api_powernv();
 
crypto_unregister_alg(_powernv_alg);
 
-- 
2.18.2