* [PATCH] kvm: ppc: bookehv: Save restore SPRN_SPRG9 on guest entry exit
@ 2014-07-16 5:49 Bharat Bhushan
2014-07-17 16:16 ` Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Bharat Bhushan @ 2014-07-16 5:49 UTC (permalink / raw)
To: agraf, kvm-ppc; +Cc: kvm, scottwood, stuart.yoder, Bharat Bhushan
SPRN_SPRG is used by debug interrupt handler, so this is required
for debug support.
Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
---
arch/powerpc/include/asm/kvm_host.h | 1 +
arch/powerpc/kernel/asm-offsets.c | 1 +
arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++
3 files changed, 6 insertions(+)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 372b977..f9e94ed 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -588,6 +588,7 @@ struct kvm_vcpu_arch {
u32 mmucfg;
u32 eptcfg;
u32 epr;
+ u32 sprg9;
u32 pwrmgtcr0;
u32 crit_save;
/* guest debug registers*/
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 17ffcb4..ab9ae04 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -668,6 +668,7 @@ int main(void)
DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
+ DEFINE(VCPU_SPRG9, offsetof(struct kvm_vcpu, arch.sprg9));
DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index a1712b8..f45da85 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -441,6 +441,7 @@ _GLOBAL(kvmppc_resume_host)
#ifdef CONFIG_64BIT
PPC_LL r3, PACA_SPRG_VDSO(r13)
#endif
+ mfspr r5, SPRN_SPRG9
PPC_STD(r6, VCPU_SHARED_SPRG4, r11)
mfspr r8, SPRN_SPRG6
PPC_STD(r7, VCPU_SHARED_SPRG5, r11)
@@ -448,6 +449,7 @@ _GLOBAL(kvmppc_resume_host)
#ifdef CONFIG_64BIT
mtspr SPRN_SPRG_VDSO_WRITE, r3
#endif
+ PPC_STD(r5, VCPU_SPRG9, r4)
PPC_STD(r8, VCPU_SHARED_SPRG6, r11)
mfxer r3
PPC_STD(r9, VCPU_SHARED_SPRG7, r11)
@@ -682,7 +684,9 @@ lightweight_exit:
mtspr SPRN_SPRG5W, r6
PPC_LD(r8, VCPU_SHARED_SPRG7, r11)
mtspr SPRN_SPRG6W, r7
+ PPC_LD(r5, VCPU_SPRG9, r4)
mtspr SPRN_SPRG7W, r8
+ mtspr SPRN_SPRG9, r5
/* Load some guest volatiles. */
PPC_LL r3, VCPU_LR(r4)
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: ppc: bookehv: Save restore SPRN_SPRG9 on guest entry exit
2014-07-16 5:49 [PATCH] kvm: ppc: bookehv: Save restore SPRN_SPRG9 on guest entry exit Bharat Bhushan
@ 2014-07-17 16:16 ` Alexander Graf
2014-07-17 16:26 ` Bharat.Bhushan
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2014-07-17 16:16 UTC (permalink / raw)
To: Bharat Bhushan, kvm-ppc; +Cc: kvm, scottwood, stuart.yoder
On 16.07.14 07:49, Bharat Bhushan wrote:
> SPRN_SPRG is used by debug interrupt handler, so this is required
> for debug support.
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
> ---
> arch/powerpc/include/asm/kvm_host.h | 1 +
> arch/powerpc/kernel/asm-offsets.c | 1 +
> arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++
> 3 files changed, 6 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index 372b977..f9e94ed 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -588,6 +588,7 @@ struct kvm_vcpu_arch {
> u32 mmucfg;
> u32 eptcfg;
> u32 epr;
> + u32 sprg9;
u32? really?
Alex
> u32 pwrmgtcr0;
> u32 crit_save;
> /* guest debug registers*/
> diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
> index 17ffcb4..ab9ae04 100644
> --- a/arch/powerpc/kernel/asm-offsets.c
> +++ b/arch/powerpc/kernel/asm-offsets.c
> @@ -668,6 +668,7 @@ int main(void)
> DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
> DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
> DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
> + DEFINE(VCPU_SPRG9, offsetof(struct kvm_vcpu, arch.sprg9));
> DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
> DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
> DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
> diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
> index a1712b8..f45da85 100644
> --- a/arch/powerpc/kvm/bookehv_interrupts.S
> +++ b/arch/powerpc/kvm/bookehv_interrupts.S
> @@ -441,6 +441,7 @@ _GLOBAL(kvmppc_resume_host)
> #ifdef CONFIG_64BIT
> PPC_LL r3, PACA_SPRG_VDSO(r13)
> #endif
> + mfspr r5, SPRN_SPRG9
> PPC_STD(r6, VCPU_SHARED_SPRG4, r11)
> mfspr r8, SPRN_SPRG6
> PPC_STD(r7, VCPU_SHARED_SPRG5, r11)
> @@ -448,6 +449,7 @@ _GLOBAL(kvmppc_resume_host)
> #ifdef CONFIG_64BIT
> mtspr SPRN_SPRG_VDSO_WRITE, r3
> #endif
> + PPC_STD(r5, VCPU_SPRG9, r4)
> PPC_STD(r8, VCPU_SHARED_SPRG6, r11)
> mfxer r3
> PPC_STD(r9, VCPU_SHARED_SPRG7, r11)
> @@ -682,7 +684,9 @@ lightweight_exit:
> mtspr SPRN_SPRG5W, r6
> PPC_LD(r8, VCPU_SHARED_SPRG7, r11)
> mtspr SPRN_SPRG6W, r7
> + PPC_LD(r5, VCPU_SPRG9, r4)
> mtspr SPRN_SPRG7W, r8
> + mtspr SPRN_SPRG9, r5
>
> /* Load some guest volatiles. */
> PPC_LL r3, VCPU_LR(r4)
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] kvm: ppc: bookehv: Save restore SPRN_SPRG9 on guest entry exit
2014-07-17 16:16 ` Alexander Graf
@ 2014-07-17 16:26 ` Bharat.Bhushan
0 siblings, 0 replies; 3+ messages in thread
From: Bharat.Bhushan @ 2014-07-17 16:26 UTC (permalink / raw)
To: Alexander Graf, kvm-ppc@vger.kernel.org
Cc: kvm@vger.kernel.org, Scott Wood, Stuart Yoder
> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Thursday, July 17, 2014 9:47 PM
> To: Bhushan Bharat-R65777; kvm-ppc@vger.kernel.org
> Cc: kvm@vger.kernel.org; Wood Scott-B07421; Yoder Stuart-B08248
> Subject: Re: [PATCH] kvm: ppc: bookehv: Save restore SPRN_SPRG9 on guest entry
> exit
>
>
> On 16.07.14 07:49, Bharat Bhushan wrote:
> > SPRN_SPRG is used by debug interrupt handler, so this is required for
> > debug support.
> >
> > Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
> > ---
> > arch/powerpc/include/asm/kvm_host.h | 1 +
> > arch/powerpc/kernel/asm-offsets.c | 1 +
> > arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++
> > 3 files changed, 6 insertions(+)
> >
> > diff --git a/arch/powerpc/include/asm/kvm_host.h
> > b/arch/powerpc/include/asm/kvm_host.h
> > index 372b977..f9e94ed 100644
> > --- a/arch/powerpc/include/asm/kvm_host.h
> > +++ b/arch/powerpc/include/asm/kvm_host.h
> > @@ -588,6 +588,7 @@ struct kvm_vcpu_arch {
> > u32 mmucfg;
> > u32 eptcfg;
> > u32 epr;
> > + u32 sprg9;
>
> u32? really?
Must be 64, even I did 64bit save/restore below. Will correct in next version.
Thanks
-Bharat
>
>
> Alex
>
> > u32 pwrmgtcr0;
> > u32 crit_save;
> > /* guest debug registers*/
> > diff --git a/arch/powerpc/kernel/asm-offsets.c
> > b/arch/powerpc/kernel/asm-offsets.c
> > index 17ffcb4..ab9ae04 100644
> > --- a/arch/powerpc/kernel/asm-offsets.c
> > +++ b/arch/powerpc/kernel/asm-offsets.c
> > @@ -668,6 +668,7 @@ int main(void)
> > DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
> > DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
> > DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
> > + DEFINE(VCPU_SPRG9, offsetof(struct kvm_vcpu, arch.sprg9));
> > DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
> > DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
> > DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
> > diff --git a/arch/powerpc/kvm/bookehv_interrupts.S
> > b/arch/powerpc/kvm/bookehv_interrupts.S
> > index a1712b8..f45da85 100644
> > --- a/arch/powerpc/kvm/bookehv_interrupts.S
> > +++ b/arch/powerpc/kvm/bookehv_interrupts.S
> > @@ -441,6 +441,7 @@ _GLOBAL(kvmppc_resume_host)
> > #ifdef CONFIG_64BIT
> > PPC_LL r3, PACA_SPRG_VDSO(r13)
> > #endif
> > + mfspr r5, SPRN_SPRG9
> > PPC_STD(r6, VCPU_SHARED_SPRG4, r11)
> > mfspr r8, SPRN_SPRG6
> > PPC_STD(r7, VCPU_SHARED_SPRG5, r11) @@ -448,6 +449,7 @@
> > _GLOBAL(kvmppc_resume_host)
> > #ifdef CONFIG_64BIT
> > mtspr SPRN_SPRG_VDSO_WRITE, r3
> > #endif
> > + PPC_STD(r5, VCPU_SPRG9, r4)
> > PPC_STD(r8, VCPU_SHARED_SPRG6, r11)
> > mfxer r3
> > PPC_STD(r9, VCPU_SHARED_SPRG7, r11) @@ -682,7 +684,9 @@
> > lightweight_exit:
> > mtspr SPRN_SPRG5W, r6
> > PPC_LD(r8, VCPU_SHARED_SPRG7, r11)
> > mtspr SPRN_SPRG6W, r7
> > + PPC_LD(r5, VCPU_SPRG9, r4)
> > mtspr SPRN_SPRG7W, r8
> > + mtspr SPRN_SPRG9, r5
> >
> > /* Load some guest volatiles. */
> > PPC_LL r3, VCPU_LR(r4)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-17 16:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16 5:49 [PATCH] kvm: ppc: bookehv: Save restore SPRN_SPRG9 on guest entry exit Bharat Bhushan
2014-07-17 16:16 ` Alexander Graf
2014-07-17 16:26 ` Bharat.Bhushan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox