[RFC PATCH 3/7] powerpc/64: provide a helper macro to load r2 with the kernel TOC

Christophe Leroy christophe.leroy at csgroup.eu
Thu Sep 22 02:52:02 AEST 2022



Le 19/09/2022 à 16:01, Nicholas Piggin a écrit :
> A later change stops the kernel using r2 and loads it with a poison
> value.  Provide a PACATOC loading abstraction which can hide this
> detail.
> 
> XXX: 64e, KVM, ftrace not entirely done
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>   arch/powerpc/include/asm/ppc_asm.h             |  3 +++
>   arch/powerpc/kernel/exceptions-64e.S           |  4 ++--
>   arch/powerpc/kernel/exceptions-64s.S           |  6 +++---
>   arch/powerpc/kernel/head_64.S                  |  4 ++--
>   arch/powerpc/kernel/interrupt_64.S             | 12 ++++++------
>   arch/powerpc/kernel/optprobes_head.S           |  2 +-
>   arch/powerpc/kernel/trace/ftrace_mprofile.S    |  4 ++--
>   arch/powerpc/platforms/powernv/opal-wrappers.S |  2 +-
>   8 files changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> index 520c4c9caf7f..c0848303151c 100644
> --- a/arch/powerpc/include/asm/ppc_asm.h
> +++ b/arch/powerpc/include/asm/ppc_asm.h
> @@ -374,6 +374,9 @@ GLUE(.,name):
>   
>   #ifdef __powerpc64__
>   
> +#define LOAD_PACA_TOC()				\
> +	ld	r2,PACATOC(r13)
> +

Wouldn't it be better as a GAS macro ?


More information about the Linuxppc-dev mailing list