diff mbox

[1/4,v6] powerpc: export debug registers save function for KVM

Message ID 1372921067-19678-2-git-send-email-Bharat.Bhushan@freescale.com (mailing list archive)
State Accepted, archived
Commit 3743c9b8ceb638b6e4b78b42f2262e22aa6359f0
Delegated to: Scott Wood
Headers show

Commit Message

Bharat Bhushan July 4, 2013, 6:57 a.m. UTC
KVM need this function when switching from vcpu to user-space
thread. My subsequent patch will use this function.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
v5->v6
 - switch_booke_debug_regs() not guarded by the compiler switch

 arch/powerpc/include/asm/switch_to.h |    1 +
 arch/powerpc/kernel/process.c        |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

Comments

Alexander Graf July 25, 2013, 10:20 a.m. UTC | #1
On 04.07.2013, at 08:57, Bharat Bhushan wrote:

> KVM need this function when switching from vcpu to user-space
> thread. My subsequent patch will use this function.
> 
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>

Ben / Michael, please ack.


Alex

> ---
> v5->v6
> - switch_booke_debug_regs() not guarded by the compiler switch
> 
> arch/powerpc/include/asm/switch_to.h |    1 +
> arch/powerpc/kernel/process.c        |    3 ++-
> 2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
> index 200d763..db68f1d 100644
> --- a/arch/powerpc/include/asm/switch_to.h
> +++ b/arch/powerpc/include/asm/switch_to.h
> @@ -29,6 +29,7 @@ extern void giveup_vsx(struct task_struct *);
> extern void enable_kernel_spe(void);
> extern void giveup_spe(struct task_struct *);
> extern void load_up_spe(struct task_struct *);
> +extern void switch_booke_debug_regs(struct thread_struct *new_thread);
> 
> #ifndef CONFIG_SMP
> extern void discard_lazy_cpu_state(void);
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 01ff496..da586aa 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -362,12 +362,13 @@ static void prime_debug_regs(struct thread_struct *thread)
>  * debug registers, set the debug registers from the values
>  * stored in the new thread.
>  */
> -static void switch_booke_debug_regs(struct thread_struct *new_thread)
> +void switch_booke_debug_regs(struct thread_struct *new_thread)
> {
> 	if ((current->thread.debug.dbcr0 & DBCR0_IDM)
> 		|| (new_thread->debug.dbcr0 & DBCR0_IDM))
> 			prime_debug_regs(new_thread);
> }
> +EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
> #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
> #ifndef CONFIG_HAVE_HW_BREAKPOINT
> static void set_debug_reg_defaults(struct thread_struct *thread)
> -- 
> 1.7.0.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Neuling July 30, 2013, 2:42 a.m. UTC | #2
Alexander Graf <agraf@suse.de> wrote:

> 
> On 04.07.2013, at 08:57, Bharat Bhushan wrote:
> 
> > KVM need this function when switching from vcpu to user-space
> > thread. My subsequent patch will use this function.
> > 
> > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> 
> Ben / Michael, please ack.

It's not really my area of expertise, but it applies and compiles for me
and it's relatively simple, so FWIW...

Acked-by: Michael Neuling <mikey@neuling.org>

> 
> 
> Alex
> 
> > ---
> > v5->v6
> > - switch_booke_debug_regs() not guarded by the compiler switch
> > 
> > arch/powerpc/include/asm/switch_to.h |    1 +
> > arch/powerpc/kernel/process.c        |    3 ++-
> > 2 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
> > index 200d763..db68f1d 100644
> > --- a/arch/powerpc/include/asm/switch_to.h
> > +++ b/arch/powerpc/include/asm/switch_to.h
> > @@ -29,6 +29,7 @@ extern void giveup_vsx(struct task_struct *);
> > extern void enable_kernel_spe(void);
> > extern void giveup_spe(struct task_struct *);
> > extern void load_up_spe(struct task_struct *);
> > +extern void switch_booke_debug_regs(struct thread_struct *new_thread);
> > 
> > #ifndef CONFIG_SMP
> > extern void discard_lazy_cpu_state(void);
> > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> > index 01ff496..da586aa 100644
> > --- a/arch/powerpc/kernel/process.c
> > +++ b/arch/powerpc/kernel/process.c
> > @@ -362,12 +362,13 @@ static void prime_debug_regs(struct thread_struct *thread)
> >  * debug registers, set the debug registers from the values
> >  * stored in the new thread.
> >  */
> > -static void switch_booke_debug_regs(struct thread_struct *new_thread)
> > +void switch_booke_debug_regs(struct thread_struct *new_thread)
> > {
> > 	if ((current->thread.debug.dbcr0 & DBCR0_IDM)
> > 		|| (new_thread->debug.dbcr0 & DBCR0_IDM))
> > 			prime_debug_regs(new_thread);
> > }
> > +EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
> > #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
> > #ifndef CONFIG_HAVE_HW_BREAKPOINT
> > static void set_debug_reg_defaults(struct thread_struct *thread)
> > -- 
> > 1.7.0.4
> > 
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm-ppc" 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/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 200d763..db68f1d 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -29,6 +29,7 @@  extern void giveup_vsx(struct task_struct *);
 extern void enable_kernel_spe(void);
 extern void giveup_spe(struct task_struct *);
 extern void load_up_spe(struct task_struct *);
+extern void switch_booke_debug_regs(struct thread_struct *new_thread);
 
 #ifndef CONFIG_SMP
 extern void discard_lazy_cpu_state(void);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 01ff496..da586aa 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -362,12 +362,13 @@  static void prime_debug_regs(struct thread_struct *thread)
  * debug registers, set the debug registers from the values
  * stored in the new thread.
  */
-static void switch_booke_debug_regs(struct thread_struct *new_thread)
+void switch_booke_debug_regs(struct thread_struct *new_thread)
 {
 	if ((current->thread.debug.dbcr0 & DBCR0_IDM)
 		|| (new_thread->debug.dbcr0 & DBCR0_IDM))
 			prime_debug_regs(new_thread);
 }
+EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
 #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
 #ifndef CONFIG_HAVE_HW_BREAKPOINT
 static void set_debug_reg_defaults(struct thread_struct *thread)