[PATCH][v2] PPC: use CURRENT_THREAD_INFO instead of open coded assembly

Alexander Graf agraf at suse.de
Tue Jul 3 07:15:53 EST 2012


On 02.07.2012, at 23:14, Stuart Yoder wrote:

> From: Stuart Yoder <stuart.yoder at freescale.com>
> 
> Signed-off-by: Stuart Yoder <stuart.yoder at freescale.com>
> ---
> 
> -this patch is a pre-requisite for the idle hcall which I
> am trying to get into Alex's KVM tree, so ideally would like
> Ben's ack and get this applied to Alex's tree
> 
> -built/tested with a 32-bit booke kernel, built a 64-bit
> booke kernel
> 
> -v2
>   -moved CURRENT_THREAD_INFO under assembly only
>    #ifdef
> 
> arch/powerpc/include/asm/exception-64s.h |    4 ++--
> arch/powerpc/include/asm/thread_info.h   |    8 ++++++++
> arch/powerpc/kernel/entry_32.S           |   24 ++++++++++++------------
> arch/powerpc/kernel/entry_64.S           |   14 +++++++-------
> arch/powerpc/kernel/exceptions-64e.S     |    2 +-
> arch/powerpc/kernel/exceptions-64s.S     |    2 +-
> arch/powerpc/kernel/head_fsl_booke.S     |    2 +-
> arch/powerpc/kernel/idle_6xx.S           |    4 ++--
> arch/powerpc/kernel/idle_book3e.S        |    2 +-
> arch/powerpc/kernel/idle_e500.S          |    4 ++--
> arch/powerpc/kernel/idle_power4.S        |    2 +-
> arch/powerpc/kernel/misc_32.S            |    4 ++--
> arch/powerpc/kvm/bookehv_interrupts.S    |    6 +-----
> arch/powerpc/mm/hash_low_32.S            |    8 ++++----
> arch/powerpc/sysdev/6xx-suspend.S        |    2 +-
> 15 files changed, 46 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
> index d58fc4e..5dbd00d 100644
> --- a/arch/powerpc/include/asm/exception-64s.h
> +++ b/arch/powerpc/include/asm/exception-64s.h
> @@ -293,7 +293,7 @@ label##_hv:								\
> 
> #define RUNLATCH_ON				\
> BEGIN_FTR_SECTION				\
> -	clrrdi	r3,r1,THREAD_SHIFT;		\
> +	CURRENT_THREAD_INFO(r3, r1)		\
> 	ld	r4,TI_LOCAL_FLAGS(r3);		\
> 	andi.	r0,r4,_TLF_RUNLATCH;		\
> 	beql	ppc64_runlatch_on_trampoline;	\
> @@ -332,7 +332,7 @@ label##_common:							\
> #ifdef CONFIG_PPC_970_NAP
> #define FINISH_NAP				\
> BEGIN_FTR_SECTION				\
> -	clrrdi	r11,r1,THREAD_SHIFT;		\
> +	CURRENT_THREAD_INFO(r11, r1)		\
> 	ld	r9,TI_LOCAL_FLAGS(r11);		\
> 	andi.	r10,r9,_TLF_NAPPING;		\
> 	bnel	power4_fixup_nap;		\
> diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
> index 68831e9..3760620 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -74,6 +74,14 @@ static inline struct thread_info *current_thread_info(void)
> 	return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
> }
> 
> +#else
> +
> +#ifndef CONFIG_PPC64

Oh no! The logic is still backwards :(

> +#define CURRENT_THREAD_INFO(dest, sp)	rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT
> +#else
> +#define CURRENT_THREAD_INFO(dest, sp)	clrrdi dest, sp, THREAD_SHIFT
> +#endif


Alex



More information about the Linuxppc-dev mailing list