[PATCH 5/6] powerpc: Macros for saving/restore PPR
Benjamin Herrenschmidt
benh at kernel.crashing.org
Mon Sep 10 14:24:04 EST 2012
On Sun, 2012-09-09 at 04:43 -0700, Haren Myneni wrote:
> Several macros are defined for saving and restore user defined PPR value.
>
> Signed-off-by: Haren Myneni <haren at us.ibm.com>
> ---
> arch/powerpc/include/asm/exception-64s.h | 35 ++++++++++++++++++++++++++++++
> arch/powerpc/include/asm/reg.h | 1 +
> 2 files changed, 36 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
> index bfd3f1f..618fd18 100644
> --- a/arch/powerpc/include/asm/exception-64s.h
> +++ b/arch/powerpc/include/asm/exception-64s.h
> @@ -62,6 +62,41 @@
> #define EXC_HV H
> #define EXC_STD
>
> +/*
> + * PPR save/restore macros - Used on P7 or later processors
> + */
> +#define SAVE_PPR(area, ra, rb) \
> +BEGIN_FTR_SECTION_NESTED(940) \
> + ld ra,area+EX_PPR(r13); /* Read PPR from paca */ \
> + clrrdi rb,r1,THREAD_SHIFT; /* thread_info struct */ \
> + std ra,TI_PPR(rb); /* Save PPR in thread_info */ \
> +END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,940)
Why the thread info and not the thread struct ?
Cheers,
Ben.
> +#define RESTORE_PPR(ra,rb) \
> +BEGIN_FTR_SECTION_NESTED(941) \
> + clrrdi ra,r1,THREAD_SHIFT; \
> + ld rb,TI_PPR(ra); /* Read PPR from thread_info */ \
> + mtspr SPRN_PPR,rb; /* Restore PPR */ \
> +END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,941)
> +
> +#define RESTORE_PPR_PACA(area,ra) \
> +BEGIN_FTR_SECTION_NESTED(942) \
> + ld ra,area+EX_PPR(r13); \
> + mtspr SPRN_PPR,ra; \
> +END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,942)
> +
> +#define HMT_MEDIUM_NO_PPR \
> +BEGIN_FTR_SECTION_NESTED(944) \
> + HMT_MEDIUM; \
> +END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,0,944) /*non P7*/
> +
> +#define HMT_MEDIUM_HAS_PPR(area, ra) \
> +BEGIN_FTR_SECTION_NESTED(943) \
> + mfspr ra,SPRN_PPR; \
> + std ra,area+EX_PPR(r13); \
> + HMT_MEDIUM; \
> +END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,943) /* P7 */
> +
> #define __EXCEPTION_PROLOG_1(area, extra, vec) \
> GET_PACA(r13); \
> std r9,area+EX_R9(r13); /* save r9 - r12 */ \
> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> index 6386086..dff2f89 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -284,6 +284,7 @@
> #define SPRN_DBAT6U 0x23C /* Data BAT 6 Upper Register */
> #define SPRN_DBAT7L 0x23F /* Data BAT 7 Lower Register */
> #define SPRN_DBAT7U 0x23E /* Data BAT 7 Upper Register */
> +#define SPRN_PPR 0x380 /* SMT Thread status Register */
>
> #define SPRN_DEC 0x016 /* Decrement Register */
> #define SPRN_DER 0x095 /* Debug Enable Regsiter */
More information about the Linuxppc-dev
mailing list