diff mbox series

[v3,03/10] powerpc/pseries/vas: Save LPID in pseries_vas_window struct

Message ID df3c8452ec619744bdd5a0fde901645537c1b7b4.camel@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series powerpc/pseries/vas: NXGZIP support with DLPAR | expand

Commit Message

Haren Myneni Jan. 21, 2022, 7:55 p.m. UTC
The kernel sets the VAS window with partition PID when is opened in
the hypervisor. During DLPAR operation, windows can be closed and
reopened in the hypervisor when the credit is available. So saves
this PID in pseries_vas_window struct when the window is opened
initially and reuse it later during DLPAR operation.

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/vas.c | 7 ++++---
 arch/powerpc/platforms/pseries/vas.h | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Nicholas Piggin Feb. 14, 2022, 2:41 a.m. UTC | #1
Excerpts from Haren Myneni's message of January 22, 2022 5:55 am:
> 
> The kernel sets the VAS window with partition PID when is opened in
> the hypervisor. During DLPAR operation, windows can be closed and
> reopened in the hypervisor when the credit is available. So saves
> this PID in pseries_vas_window struct when the window is opened
> initially and reuse it later during DLPAR operation.

This probably shouldn't be called lpid, while you're changing it.
"partition PID" and "LPAR PID" is also confusing. I know the name
somewhat comes from the specifiction, but pid/PID would be fine,
it's clear we are talking about "this LPAR" when in pseries code.

> 
> Signed-off-by: Haren Myneni <haren@linux.ibm.com>
> ---
>  arch/powerpc/platforms/pseries/vas.c | 7 ++++---
>  arch/powerpc/platforms/pseries/vas.h | 1 +
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/vas.c
> b/arch/powerpc/platforms/pseries/vas.c
> index d2c8292bfb33..2ef56157634f 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -107,7 +107,6 @@ static int h_deallocate_vas_window(u64 winid)
>  static int h_modify_vas_window(struct pseries_vas_window *win)
>  {
>  	long rc;
> -	u32 lpid = mfspr(SPRN_PID);
>  
>  	/*
>  	 * AMR value is not supported in Linux VAS implementation.
> @@ -115,7 +114,7 @@ static int h_modify_vas_window(struct
> pseries_vas_window *win)
>  	 */
>  	do {
>  		rc = plpar_hcall_norets(H_MODIFY_VAS_WINDOW,
> -					win->vas_win.winid, lpid, 0,
> +					win->vas_win.winid, win->lpid,
> 0,
>  					VAS_MOD_WIN_FLAGS, 0);
>  
>  		rc = hcall_return_busy_check(rc);
> @@ -125,7 +124,7 @@ static int h_modify_vas_window(struct
> pseries_vas_window *win)
>  		return 0;
>  
>  	pr_err("H_MODIFY_VAS_WINDOW error: %ld, winid %u lpid %u\n",
> -			rc, win->vas_win.winid, lpid);
> +			rc, win->vas_win.winid, win->lpid);
>  	return -EIO;
>  }
>  
> @@ -338,6 +337,8 @@ static struct vas_window *vas_allocate_window(int
> vas_id, u64 flags,
>  		}
>  	}
>  
> +	txwin->lpid = mfspr(SPRN_PID);
> +
>  	/*
>  	 * Allocate / Deallocate window hcalls and setup / free IRQs
>  	 * have to be protected with mutex.
> diff --git a/arch/powerpc/platforms/pseries/vas.h
> b/arch/powerpc/platforms/pseries/vas.h
> index fa7ce74f1e49..0538760d13be 100644
> --- a/arch/powerpc/platforms/pseries/vas.h
> +++ b/arch/powerpc/platforms/pseries/vas.h
> @@ -115,6 +115,7 @@ struct pseries_vas_window {
>  	u64 domain[6];		/* Associativity domain Ids */
>  				/* this window is allocated */
>  	u64 util;
> +	u32 lpid;

Comment could be "PID associated with this window".

BTW, is the TID parameter deprecated? Doesn't seem that we use that.

Thanks,
Nick
Haren Myneni Feb. 16, 2022, 1:09 a.m. UTC | #2
On Mon, 2022-02-14 at 12:41 +1000, Nicholas Piggin wrote:
> Excerpts from Haren Myneni's message of January 22, 2022 5:55 am:
> > The kernel sets the VAS window with partition PID when is opened in
> > the hypervisor. During DLPAR operation, windows can be closed and
> > reopened in the hypervisor when the credit is available. So saves
> > this PID in pseries_vas_window struct when the window is opened
> > initially and reuse it later during DLPAR operation.
> 
> This probably shouldn't be called lpid, while you're changing it.
> "partition PID" and "LPAR PID" is also confusing. I know the name
> somewhat comes from the specifiction, but pid/PID would be fine,
> it's clear we are talking about "this LPAR" when in pseries code.
> 
> > Signed-off-by: Haren Myneni <haren@linux.ibm.com>
> > ---
> >  arch/powerpc/platforms/pseries/vas.c | 7 ++++---
> >  arch/powerpc/platforms/pseries/vas.h | 1 +
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/pseries/vas.c
> > b/arch/powerpc/platforms/pseries/vas.c
> > index d2c8292bfb33..2ef56157634f 100644
> > --- a/arch/powerpc/platforms/pseries/vas.c
> > +++ b/arch/powerpc/platforms/pseries/vas.c
> > @@ -107,7 +107,6 @@ static int h_deallocate_vas_window(u64 winid)
> >  static int h_modify_vas_window(struct pseries_vas_window *win)
> >  {
> >  	long rc;
> > -	u32 lpid = mfspr(SPRN_PID);
> >  
> >  	/*
> >  	 * AMR value is not supported in Linux VAS implementation.
> > @@ -115,7 +114,7 @@ static int h_modify_vas_window(struct
> > pseries_vas_window *win)
> >  	 */
> >  	do {
> >  		rc = plpar_hcall_norets(H_MODIFY_VAS_WINDOW,
> > -					win->vas_win.winid, lpid, 0,
> > +					win->vas_win.winid, win->lpid,
> > 0,
> >  					VAS_MOD_WIN_FLAGS, 0);
> >  
> >  		rc = hcall_return_busy_check(rc);
> > @@ -125,7 +124,7 @@ static int h_modify_vas_window(struct
> > pseries_vas_window *win)
> >  		return 0;
> >  
> >  	pr_err("H_MODIFY_VAS_WINDOW error: %ld, winid %u lpid %u\n",
> > -			rc, win->vas_win.winid, lpid);
> > +			rc, win->vas_win.winid, win->lpid);
> >  	return -EIO;
> >  }
> >  
> > @@ -338,6 +337,8 @@ static struct vas_window
> > *vas_allocate_window(int
> > vas_id, u64 flags,
> >  		}
> >  	}
> >  
> > +	txwin->lpid = mfspr(SPRN_PID);
> > +
> >  	/*
> >  	 * Allocate / Deallocate window hcalls and setup / free IRQs
> >  	 * have to be protected with mutex.
> > diff --git a/arch/powerpc/platforms/pseries/vas.h
> > b/arch/powerpc/platforms/pseries/vas.h
> > index fa7ce74f1e49..0538760d13be 100644
> > --- a/arch/powerpc/platforms/pseries/vas.h
> > +++ b/arch/powerpc/platforms/pseries/vas.h
> > @@ -115,6 +115,7 @@ struct pseries_vas_window {
> >  	u64 domain[6];		/* Associativity domain Ids */
> >  				/* this window is allocated */
> >  	u64 util;
> > +	u32 lpid;
> 
> Comment could be "PID associated with this window".   

yes, will add this comment.

> 
> BTW, is the TID parameter deprecated? Doesn't seem that we use that.

Right, tpid is deprecated on p10 and we are not using it.

Thanks
Haren

> 
> Thanks,
> Nick
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/pseries/vas.c
b/arch/powerpc/platforms/pseries/vas.c
index d2c8292bfb33..2ef56157634f 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -107,7 +107,6 @@  static int h_deallocate_vas_window(u64 winid)
 static int h_modify_vas_window(struct pseries_vas_window *win)
 {
 	long rc;
-	u32 lpid = mfspr(SPRN_PID);
 
 	/*
 	 * AMR value is not supported in Linux VAS implementation.
@@ -115,7 +114,7 @@  static int h_modify_vas_window(struct
pseries_vas_window *win)
 	 */
 	do {
 		rc = plpar_hcall_norets(H_MODIFY_VAS_WINDOW,
-					win->vas_win.winid, lpid, 0,
+					win->vas_win.winid, win->lpid,
0,
 					VAS_MOD_WIN_FLAGS, 0);
 
 		rc = hcall_return_busy_check(rc);
@@ -125,7 +124,7 @@  static int h_modify_vas_window(struct
pseries_vas_window *win)
 		return 0;
 
 	pr_err("H_MODIFY_VAS_WINDOW error: %ld, winid %u lpid %u\n",
-			rc, win->vas_win.winid, lpid);
+			rc, win->vas_win.winid, win->lpid);
 	return -EIO;
 }
 
@@ -338,6 +337,8 @@  static struct vas_window *vas_allocate_window(int
vas_id, u64 flags,
 		}
 	}
 
+	txwin->lpid = mfspr(SPRN_PID);
+
 	/*
 	 * Allocate / Deallocate window hcalls and setup / free IRQs
 	 * have to be protected with mutex.
diff --git a/arch/powerpc/platforms/pseries/vas.h
b/arch/powerpc/platforms/pseries/vas.h
index fa7ce74f1e49..0538760d13be 100644
--- a/arch/powerpc/platforms/pseries/vas.h
+++ b/arch/powerpc/platforms/pseries/vas.h
@@ -115,6 +115,7 @@  struct pseries_vas_window {
 	u64 domain[6];		/* Associativity domain Ids */
 				/* this window is allocated */
 	u64 util;
+	u32 lpid;
 
 	/* List of windows opened which is used for LPM */
 	struct list_head win_list;