Re: [PATCH v3 01/10] powerpc/pseries/vas: Use common names in VAS capability structure

2022-02-15 Thread Haren Myneni
On Mon, 2022-02-14 at 12:14 +1000, Nicholas Piggin wrote:
> Excerpts from Haren Myneni's message of January 22, 2022 5:54 am:
> > target/used/avail_creds provides credits usage to user space via
> > sysfs and the same interface can be used on PowerNV in future.
> > Remove "lpar" from these names so that applicable on both PowerVM
> > and PowerNV.
> 
> But not in this series? This is just to save you having to do more
> renaming later?

Thanks for your review. 
Yes, Removing _lpar_ in struct elements to make it clear so that can
easily add in sysfs patch.  

> 
> Reviewed-by: Nicholas Piggin 
> 
> > Signed-off-by: Haren Myneni 
> > ---
> >  arch/powerpc/platforms/pseries/vas.c | 10 +-
> >  arch/powerpc/platforms/pseries/vas.h |  6 +++---
> >  2 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/pseries/vas.c
> > b/arch/powerpc/platforms/pseries/vas.c
> > index d243ddc58827..c0737379cc7b 100644
> > --- a/arch/powerpc/platforms/pseries/vas.c
> > +++ b/arch/powerpc/platforms/pseries/vas.c
> > @@ -310,8 +310,8 @@ static struct vas_window
> > *vas_allocate_window(int vas_id, u64 flags,
> >  
> > cop_feat_caps = >caps;
> >  
> > -   if (atomic_inc_return(_feat_caps->used_lpar_creds) >
> > -   atomic_read(_feat_caps->target_lpar_creds)) 
> > {
> > +   if (atomic_inc_return(_feat_caps->used_creds) >
> > +   atomic_read(_feat_caps->target_creds)) {
> > pr_err("Credits are not available to allocate
> > window\n");
> > rc = -EINVAL;
> > goto out;
> > @@ -385,7 +385,7 @@ static struct vas_window
> > *vas_allocate_window(int vas_id, u64 flags,
> > free_irq_setup(txwin);
> > h_deallocate_vas_window(txwin->vas_win.winid);
> >  out:
> > -   atomic_dec(_feat_caps->used_lpar_creds);
> > +   atomic_dec(_feat_caps->used_creds);
> > kfree(txwin);
> > return ERR_PTR(rc);
> >  }
> > @@ -445,7 +445,7 @@ static int vas_deallocate_window(struct
> > vas_window *vwin)
> > }
> >  
> > list_del(>win_list);
> > -   atomic_dec(>used_lpar_creds);
> > +   atomic_dec(>used_creds);
> > mutex_unlock(_pseries_mutex);
> >  
> > put_vas_user_win_ref(>task_ref);
> > @@ -521,7 +521,7 @@ static int __init get_vas_capabilities(u8 feat,
> > enum vas_cop_feat_type type,
> > }
> > caps->max_lpar_creds = be16_to_cpu(hv_caps->max_lpar_creds);
> > caps->max_win_creds = be16_to_cpu(hv_caps->max_win_creds);
> > -   atomic_set(>target_lpar_creds,
> > +   atomic_set(>target_creds,
> >be16_to_cpu(hv_caps->target_lpar_creds));
> > if (feat == VAS_GZIP_DEF_FEAT) {
> > caps->def_lpar_creds = be16_to_cpu(hv_caps-
> > >def_lpar_creds);
> > diff --git a/arch/powerpc/platforms/pseries/vas.h
> > b/arch/powerpc/platforms/pseries/vas.h
> > index 4ecb3fcabd10..fa7ce74f1e49 100644
> > --- a/arch/powerpc/platforms/pseries/vas.h
> > +++ b/arch/powerpc/platforms/pseries/vas.h
> > @@ -72,9 +72,9 @@ struct vas_cop_feat_caps {
> > };
> > /* Total LPAR available credits. Can be different from max LPAR
> > */
> > /* credits due to DLPAR operation */
> > -   atomic_ttarget_lpar_creds;
> > -   atomic_tused_lpar_creds; /* Used credits so far */
> > -   u16 avail_lpar_creds; /* Remaining available credits */
> > +   atomic_ttarget_creds;
> > +   atomic_tused_creds; /* Used credits so far */
> > +   u16 avail_creds;/* Remaining available credits */
> >  };
> >  
> >  /*
> > -- 
> > 2.27.0
> > 
> > 
> > 



Re: [PATCH v3 01/10] powerpc/pseries/vas: Use common names in VAS capability structure

2022-02-13 Thread Nicholas Piggin
Excerpts from Haren Myneni's message of January 22, 2022 5:54 am:
> 
> target/used/avail_creds provides credits usage to user space via
> sysfs and the same interface can be used on PowerNV in future.
> Remove "lpar" from these names so that applicable on both PowerVM
> and PowerNV.

But not in this series? This is just to save you having to do more
renaming later?

Reviewed-by: Nicholas Piggin 

> 
> Signed-off-by: Haren Myneni 
> ---
>  arch/powerpc/platforms/pseries/vas.c | 10 +-
>  arch/powerpc/platforms/pseries/vas.h |  6 +++---
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/vas.c 
> b/arch/powerpc/platforms/pseries/vas.c
> index d243ddc58827..c0737379cc7b 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -310,8 +310,8 @@ static struct vas_window *vas_allocate_window(int vas_id, 
> u64 flags,
>  
>   cop_feat_caps = >caps;
>  
> - if (atomic_inc_return(_feat_caps->used_lpar_creds) >
> - atomic_read(_feat_caps->target_lpar_creds)) {
> + if (atomic_inc_return(_feat_caps->used_creds) >
> + atomic_read(_feat_caps->target_creds)) {
>   pr_err("Credits are not available to allocate window\n");
>   rc = -EINVAL;
>   goto out;
> @@ -385,7 +385,7 @@ static struct vas_window *vas_allocate_window(int vas_id, 
> u64 flags,
>   free_irq_setup(txwin);
>   h_deallocate_vas_window(txwin->vas_win.winid);
>  out:
> - atomic_dec(_feat_caps->used_lpar_creds);
> + atomic_dec(_feat_caps->used_creds);
>   kfree(txwin);
>   return ERR_PTR(rc);
>  }
> @@ -445,7 +445,7 @@ static int vas_deallocate_window(struct vas_window *vwin)
>   }
>  
>   list_del(>win_list);
> - atomic_dec(>used_lpar_creds);
> + atomic_dec(>used_creds);
>   mutex_unlock(_pseries_mutex);
>  
>   put_vas_user_win_ref(>task_ref);
> @@ -521,7 +521,7 @@ static int __init get_vas_capabilities(u8 feat, enum 
> vas_cop_feat_type type,
>   }
>   caps->max_lpar_creds = be16_to_cpu(hv_caps->max_lpar_creds);
>   caps->max_win_creds = be16_to_cpu(hv_caps->max_win_creds);
> - atomic_set(>target_lpar_creds,
> + atomic_set(>target_creds,
>  be16_to_cpu(hv_caps->target_lpar_creds));
>   if (feat == VAS_GZIP_DEF_FEAT) {
>   caps->def_lpar_creds = be16_to_cpu(hv_caps->def_lpar_creds);
> diff --git a/arch/powerpc/platforms/pseries/vas.h 
> b/arch/powerpc/platforms/pseries/vas.h
> index 4ecb3fcabd10..fa7ce74f1e49 100644
> --- a/arch/powerpc/platforms/pseries/vas.h
> +++ b/arch/powerpc/platforms/pseries/vas.h
> @@ -72,9 +72,9 @@ struct vas_cop_feat_caps {
>   };
>   /* Total LPAR available credits. Can be different from max LPAR */
>   /* credits due to DLPAR operation */
> - atomic_ttarget_lpar_creds;
> - atomic_tused_lpar_creds; /* Used credits so far */
> - u16 avail_lpar_creds; /* Remaining available credits */
> + atomic_ttarget_creds;
> + atomic_tused_creds; /* Used credits so far */
> + u16 avail_creds;/* Remaining available credits */
>  };
>  
>  /*
> -- 
> 2.27.0
> 
> 
> 


[PATCH v3 01/10] powerpc/pseries/vas: Use common names in VAS capability structure

2022-01-21 Thread Haren Myneni


target/used/avail_creds provides credits usage to user space via
sysfs and the same interface can be used on PowerNV in future.
Remove "lpar" from these names so that applicable on both PowerVM
and PowerNV.

Signed-off-by: Haren Myneni 
---
 arch/powerpc/platforms/pseries/vas.c | 10 +-
 arch/powerpc/platforms/pseries/vas.h |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vas.c 
b/arch/powerpc/platforms/pseries/vas.c
index d243ddc58827..c0737379cc7b 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -310,8 +310,8 @@ static struct vas_window *vas_allocate_window(int vas_id, 
u64 flags,
 
cop_feat_caps = >caps;
 
-   if (atomic_inc_return(_feat_caps->used_lpar_creds) >
-   atomic_read(_feat_caps->target_lpar_creds)) {
+   if (atomic_inc_return(_feat_caps->used_creds) >
+   atomic_read(_feat_caps->target_creds)) {
pr_err("Credits are not available to allocate window\n");
rc = -EINVAL;
goto out;
@@ -385,7 +385,7 @@ static struct vas_window *vas_allocate_window(int vas_id, 
u64 flags,
free_irq_setup(txwin);
h_deallocate_vas_window(txwin->vas_win.winid);
 out:
-   atomic_dec(_feat_caps->used_lpar_creds);
+   atomic_dec(_feat_caps->used_creds);
kfree(txwin);
return ERR_PTR(rc);
 }
@@ -445,7 +445,7 @@ static int vas_deallocate_window(struct vas_window *vwin)
}
 
list_del(>win_list);
-   atomic_dec(>used_lpar_creds);
+   atomic_dec(>used_creds);
mutex_unlock(_pseries_mutex);
 
put_vas_user_win_ref(>task_ref);
@@ -521,7 +521,7 @@ static int __init get_vas_capabilities(u8 feat, enum 
vas_cop_feat_type type,
}
caps->max_lpar_creds = be16_to_cpu(hv_caps->max_lpar_creds);
caps->max_win_creds = be16_to_cpu(hv_caps->max_win_creds);
-   atomic_set(>target_lpar_creds,
+   atomic_set(>target_creds,
   be16_to_cpu(hv_caps->target_lpar_creds));
if (feat == VAS_GZIP_DEF_FEAT) {
caps->def_lpar_creds = be16_to_cpu(hv_caps->def_lpar_creds);
diff --git a/arch/powerpc/platforms/pseries/vas.h 
b/arch/powerpc/platforms/pseries/vas.h
index 4ecb3fcabd10..fa7ce74f1e49 100644
--- a/arch/powerpc/platforms/pseries/vas.h
+++ b/arch/powerpc/platforms/pseries/vas.h
@@ -72,9 +72,9 @@ struct vas_cop_feat_caps {
};
/* Total LPAR available credits. Can be different from max LPAR */
/* credits due to DLPAR operation */
-   atomic_ttarget_lpar_creds;
-   atomic_tused_lpar_creds; /* Used credits so far */
-   u16 avail_lpar_creds; /* Remaining available credits */
+   atomic_ttarget_creds;
+   atomic_tused_creds; /* Used credits so far */
+   u16 avail_creds;/* Remaining available credits */
 };
 
 /*
-- 
2.27.0