diff mbox

[1/6] KVM: PPC: booke: use vcpu reference from thread_struct

Message ID 1345557120-16197-2-git-send-email-Bharat.Bhushan@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bharat Bhushan Aug. 21, 2012, 1:51 p.m. UTC
Like other places, use thread_struct to get vcpu reference.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
 arch/powerpc/kernel/asm-offsets.c   |    2 +-
 arch/powerpc/kvm/booke_interrupts.S |    6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Alexander Graf Sept. 24, 2012, 4:27 p.m. UTC | #1
On 21.08.2012, at 15:51, Bharat Bhushan wrote:

> Like other places, use thread_struct to get vcpu reference.

Please remove the definition of SPRN_SPRG_R/WVCPU as well.


Alex

> 
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> ---
> arch/powerpc/kernel/asm-offsets.c   |    2 +-
> arch/powerpc/kvm/booke_interrupts.S |    6 ++----
> 2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
> index 85b05c4..fbb999c 100644
> --- a/arch/powerpc/kernel/asm-offsets.c
> +++ b/arch/powerpc/kernel/asm-offsets.c
> @@ -116,7 +116,7 @@ int main(void)
> #ifdef CONFIG_KVM_BOOK3S_32_HANDLER
> 	DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct, kvm_shadow_vcpu));
> #endif
> -#ifdef CONFIG_KVM_BOOKE_HV
> +#if defined(CONFIG_KVM) && defined(CONFIG_BOOKE)
> 	DEFINE(THREAD_KVM_VCPU, offsetof(struct thread_struct, kvm_vcpu));
> #endif
> 
> diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
> index bb46b32..ca16d57 100644
> --- a/arch/powerpc/kvm/booke_interrupts.S
> +++ b/arch/powerpc/kvm/booke_interrupts.S
> @@ -56,7 +56,8 @@
> _GLOBAL(kvmppc_handler_\ivor_nr)
> 	/* Get pointer to vcpu and record exit number. */
> 	mtspr	\scratch , r4
> -	mfspr	r4, SPRN_SPRG_RVCPU
> +	mfspr   r4, SPRN_SPRG_THREAD
> +	lwz     r4, THREAD_KVM_VCPU(r4)
> 	stw	r3, VCPU_GPR(R3)(r4)
> 	stw	r5, VCPU_GPR(R5)(r4)
> 	stw	r6, VCPU_GPR(R6)(r4)
> @@ -402,9 +403,6 @@ lightweight_exit:
> 	lwz	r8, kvmppc_booke_handlers@l(r8)
> 	mtspr	SPRN_IVPR, r8
> 
> -	/* Save vcpu pointer for the exception handlers. */
> -	mtspr	SPRN_SPRG_WVCPU, r4
> -
> 	lwz	r5, VCPU_SHARED(r4)
> 
> 	/* Can't switch the stack pointer until after IVPR is switched,
> -- 
> 1.7.0.4
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bharat Bhushan Oct. 4, 2012, 6:50 a.m. UTC | #2
> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Monday, September 24, 2012 9:58 PM
> To: Bhushan Bharat-R65777
> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Bhushan Bharat-R65777
> Subject: Re: [PATCH 1/6] KVM: PPC: booke: use vcpu reference from thread_struct
> 
> 
> On 21.08.2012, at 15:51, Bharat Bhushan wrote:
> 
> > Like other places, use thread_struct to get vcpu reference.
> 
> Please remove the definition of SPRN_SPRG_R/WVCPU as well.

Ok

Thanks
-Bharat

> 
> 
> Alex
> 
> >
> > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> > ---
> > arch/powerpc/kernel/asm-offsets.c   |    2 +-
> > arch/powerpc/kvm/booke_interrupts.S |    6 ++----
> > 2 files changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/asm-offsets.c
> > b/arch/powerpc/kernel/asm-offsets.c
> > index 85b05c4..fbb999c 100644
> > --- a/arch/powerpc/kernel/asm-offsets.c
> > +++ b/arch/powerpc/kernel/asm-offsets.c
> > @@ -116,7 +116,7 @@ int main(void)
> > #ifdef CONFIG_KVM_BOOK3S_32_HANDLER
> > 	DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct,
> > kvm_shadow_vcpu)); #endif -#ifdef CONFIG_KVM_BOOKE_HV
> > +#if defined(CONFIG_KVM) && defined(CONFIG_BOOKE)
> > 	DEFINE(THREAD_KVM_VCPU, offsetof(struct thread_struct, kvm_vcpu));
> > #endif
> >
> > diff --git a/arch/powerpc/kvm/booke_interrupts.S
> > b/arch/powerpc/kvm/booke_interrupts.S
> > index bb46b32..ca16d57 100644
> > --- a/arch/powerpc/kvm/booke_interrupts.S
> > +++ b/arch/powerpc/kvm/booke_interrupts.S
> > @@ -56,7 +56,8 @@
> > _GLOBAL(kvmppc_handler_\ivor_nr)
> > 	/* Get pointer to vcpu and record exit number. */
> > 	mtspr	\scratch , r4
> > -	mfspr	r4, SPRN_SPRG_RVCPU
> > +	mfspr   r4, SPRN_SPRG_THREAD
> > +	lwz     r4, THREAD_KVM_VCPU(r4)
> > 	stw	r3, VCPU_GPR(R3)(r4)
> > 	stw	r5, VCPU_GPR(R5)(r4)
> > 	stw	r6, VCPU_GPR(R6)(r4)
> > @@ -402,9 +403,6 @@ lightweight_exit:
> > 	lwz	r8, kvmppc_booke_handlers@l(r8)
> > 	mtspr	SPRN_IVPR, r8
> >
> > -	/* Save vcpu pointer for the exception handlers. */
> > -	mtspr	SPRN_SPRG_WVCPU, r4
> > -
> > 	lwz	r5, VCPU_SHARED(r4)
> >
> > 	/* Can't switch the stack pointer until after IVPR is switched,
> > --
> > 1.7.0.4
> >
> >
> 


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 85b05c4..fbb999c 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -116,7 +116,7 @@  int main(void)
 #ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 	DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct, kvm_shadow_vcpu));
 #endif
-#ifdef CONFIG_KVM_BOOKE_HV
+#if defined(CONFIG_KVM) && defined(CONFIG_BOOKE)
 	DEFINE(THREAD_KVM_VCPU, offsetof(struct thread_struct, kvm_vcpu));
 #endif
 
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index bb46b32..ca16d57 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -56,7 +56,8 @@ 
 _GLOBAL(kvmppc_handler_\ivor_nr)
 	/* Get pointer to vcpu and record exit number. */
 	mtspr	\scratch , r4
-	mfspr	r4, SPRN_SPRG_RVCPU
+	mfspr   r4, SPRN_SPRG_THREAD
+	lwz     r4, THREAD_KVM_VCPU(r4)
 	stw	r3, VCPU_GPR(R3)(r4)
 	stw	r5, VCPU_GPR(R5)(r4)
 	stw	r6, VCPU_GPR(R6)(r4)
@@ -402,9 +403,6 @@  lightweight_exit:
 	lwz	r8, kvmppc_booke_handlers@l(r8)
 	mtspr	SPRN_IVPR, r8
 
-	/* Save vcpu pointer for the exception handlers. */
-	mtspr	SPRN_SPRG_WVCPU, r4
-
 	lwz	r5, VCPU_SHARED(r4)
 
 	/* Can't switch the stack pointer until after IVPR is switched,