public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Improving calls to kvmppc_hv_entry
@ 2023-02-20  5:23 Kautuk Consul
  2023-02-20  5:23 ` [PATCH 1/2] arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope Kautuk Consul
  2023-02-20  5:23 ` [PATCH 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument Kautuk Consul
  0 siblings, 2 replies; 5+ messages in thread
From: Kautuk Consul @ 2023-02-20  5:23 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Naveen N. Rao, Fabiano Rosas, Alexey Kardashevskiy,
	Sathvika Vasireddy
  Cc: linuxppc-dev, linux-kernel, Kautuk Consul

- remove .global scope of kvmppc_hv_entry
- remove r4 argument to kvmppc_hv_entry as it is not required

Kautuk Consul (2):
  arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope
  arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument

 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope
  2023-02-20  5:23 [PATCH 0/2] Improving calls to kvmppc_hv_entry Kautuk Consul
@ 2023-02-20  5:23 ` Kautuk Consul
  2023-02-20  7:05   ` Sathvika Vasireddy
  2023-02-20  5:23 ` [PATCH 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument Kautuk Consul
  1 sibling, 1 reply; 5+ messages in thread
From: Kautuk Consul @ 2023-02-20  5:23 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Naveen N. Rao, Fabiano Rosas, Alexey Kardashevskiy,
	Sathvika Vasireddy
  Cc: linuxppc-dev, linux-kernel, Kautuk Consul

kvmppc_hv_entry isn't called from anywhere other than
book3s_hv_rmhandlers.S itself. Removing .global scope for
this function.

Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index acf80915f406..7e063fde7adc 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -502,7 +502,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
  *                                                                            *
  *****************************************************************************/
 
-.global kvmppc_hv_entry
 kvmppc_hv_entry:
 
 	/* Required state:
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument
  2023-02-20  5:23 [PATCH 0/2] Improving calls to kvmppc_hv_entry Kautuk Consul
  2023-02-20  5:23 ` [PATCH 1/2] arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope Kautuk Consul
@ 2023-02-20  5:23 ` Kautuk Consul
  2023-03-06 12:24   ` Kautuk Consul
  1 sibling, 1 reply; 5+ messages in thread
From: Kautuk Consul @ 2023-02-20  5:23 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Naveen N. Rao, Fabiano Rosas, Alexey Kardashevskiy,
	Sathvika Vasireddy
  Cc: linuxppc-dev, linux-kernel, Kautuk Consul

kvmppc_hv_entry is called from only 2 locations within
book3s_hv_rmhandlers.S. Both of those locations set r4
as HSTATE_KVM_VCPU(r13) before calling kvmppc_hv_entry.
So, shift the r4 load instruction to kvmppc_hv_entry and
thus modify the calling convention of this function.

Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 7e063fde7adc..922667b09168 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -85,7 +85,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline)
 	RFI_TO_KERNEL
 
 kvmppc_call_hv_entry:
-	ld	r4, HSTATE_KVM_VCPU(r13)
+	/* Enter guest. */
 	bl	kvmppc_hv_entry
 
 	/* Back from guest - restore host state and return to caller */
@@ -352,9 +352,7 @@ kvm_secondary_got_guest:
 	mtspr	SPRN_LDBAR, r0
 	isync
 63:
-	/* Order load of vcpu after load of vcore */
-	lwsync
-	ld	r4, HSTATE_KVM_VCPU(r13)
+	/* Enter guest. */
 	bl	kvmppc_hv_entry
 
 	/* Back from the guest, go back to nap */
@@ -506,7 +504,6 @@ kvmppc_hv_entry:
 
 	/* Required state:
 	 *
-	 * R4 = vcpu pointer (or NULL)
 	 * MSR = ~IR|DR
 	 * R13 = PACA
 	 * R1 = host R1
@@ -524,6 +521,8 @@ kvmppc_hv_entry:
 	li	r6, KVM_GUEST_MODE_HOST_HV
 	stb	r6, HSTATE_IN_GUEST(r13)
 
+	ld	r4, HSTATE_KVM_VCPU(r13)
+
 #ifdef CONFIG_KVM_BOOK3S_HV_P8_TIMING
 	/* Store initial timestamp */
 	cmpdi	r4, 0
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope
  2023-02-20  5:23 ` [PATCH 1/2] arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope Kautuk Consul
@ 2023-02-20  7:05   ` Sathvika Vasireddy
  0 siblings, 0 replies; 5+ messages in thread
From: Sathvika Vasireddy @ 2023-02-20  7:05 UTC (permalink / raw)
  To: Kautuk Consul
  Cc: linuxppc-dev, linux-kernel, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Naveen N. Rao, Fabiano Rosas,
	Alexey Kardashevskiy, Sathvika Vasireddy

Hi Kautuk,

On 20/02/23 10:53, Kautuk Consul wrote:
> kvmppc_hv_entry isn't called from anywhere other than
> book3s_hv_rmhandlers.S itself. Removing .global scope for
> this function.
>
> Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
> ---
>   arch/powerpc/kvm/book3s_hv_rmhandlers.S | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> index acf80915f406..7e063fde7adc 100644
> --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> @@ -502,7 +502,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
>    *                                                                            *
>    *****************************************************************************/
>   
> -.global kvmppc_hv_entry
>   kvmppc_hv_entry:
>   
>   	/* Required state:
I see the following objtool warning with this patch applied.
arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x48: 
unannotated intra-function call

Annotating kvmppc_hv_entry symbol with SYM_FUNC_START_LOCAL and 
SYM_FUNC_END macros should help fix this warning.

Thanks,
Sathvika



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument
  2023-02-20  5:23 ` [PATCH 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument Kautuk Consul
@ 2023-03-06 12:24   ` Kautuk Consul
  0 siblings, 0 replies; 5+ messages in thread
From: Kautuk Consul @ 2023-03-06 12:24 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Naveen N. Rao, Fabiano Rosas, Alexey Kardashevskiy,
	Sathvika Vasireddy
  Cc: linuxppc-dev, linux-kernel

Hi,

On 2023-02-20 10:53:55, Kautuk Consul wrote:
> kvmppc_hv_entry is called from only 2 locations within
> book3s_hv_rmhandlers.S. Both of those locations set r4
> as HSTATE_KVM_VCPU(r13) before calling kvmppc_hv_entry.
> So, shift the r4 load instruction to kvmppc_hv_entry and
> thus modify the calling convention of this function.
> 

I am posting v2 of this patch-set now.
I have tested this on POWER8 and it works fine.
Can anyone review the v2 for this patch ? 
I didn't receive any review comments for this patch.

> Signed-off-by: Kautuk Consul <kconsul@linux.vnet.ibm.com>
> ---
>  arch/powerpc/kvm/book3s_hv_rmhandlers.S | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> index 7e063fde7adc..922667b09168 100644
> --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> @@ -85,7 +85,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline)
>  	RFI_TO_KERNEL
> 
>  kvmppc_call_hv_entry:
> -	ld	r4, HSTATE_KVM_VCPU(r13)
> +	/* Enter guest. */
>  	bl	kvmppc_hv_entry
> 
>  	/* Back from guest - restore host state and return to caller */
> @@ -352,9 +352,7 @@ kvm_secondary_got_guest:
>  	mtspr	SPRN_LDBAR, r0
>  	isync
>  63:
> -	/* Order load of vcpu after load of vcore */
> -	lwsync
> -	ld	r4, HSTATE_KVM_VCPU(r13)
> +	/* Enter guest. */
>  	bl	kvmppc_hv_entry
> 
>  	/* Back from the guest, go back to nap */
> @@ -506,7 +504,6 @@ kvmppc_hv_entry:
> 
>  	/* Required state:
>  	 *
> -	 * R4 = vcpu pointer (or NULL)
>  	 * MSR = ~IR|DR
>  	 * R13 = PACA
>  	 * R1 = host R1
> @@ -524,6 +521,8 @@ kvmppc_hv_entry:
>  	li	r6, KVM_GUEST_MODE_HOST_HV
>  	stb	r6, HSTATE_IN_GUEST(r13)
> 
> +	ld	r4, HSTATE_KVM_VCPU(r13)
> +
>  #ifdef CONFIG_KVM_BOOK3S_HV_P8_TIMING
>  	/* Store initial timestamp */
>  	cmpdi	r4, 0
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-06 12:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-20  5:23 [PATCH 0/2] Improving calls to kvmppc_hv_entry Kautuk Consul
2023-02-20  5:23 ` [PATCH 1/2] arch/powerpc/kvm: kvmppc_hv_entry: remove .global scope Kautuk Consul
2023-02-20  7:05   ` Sathvika Vasireddy
2023-02-20  5:23 ` [PATCH 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4 argument Kautuk Consul
2023-03-06 12:24   ` Kautuk Consul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox