@@ -36,6 +36,7 @@
*/
#include <asm/head-64.h>
#include <asm/feature-fixups.h>
+#include <asm/reg-ftr.h>
/* PACA save area offsets (exgen, exmc, etc) */
#define EX_R9 0
new file mode 100644
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Contains the definition of registers common to all PowerPC variants.
+ * If a register definition has been changed in a different PowerPC
+ * variant, we will case it in #ifndef XXX ... #endif, and have the
+ * number used in the Programming Environments Manual For 32-Bit
+ * Implementations of the PowerPC Architecture (a.k.a. Green Book) here.
+ */
+
+#ifndef _ASM_POWERPC_REG_FTR_H
+#define _ASM_POWERPC_REG_FTR_H
+#ifdef __KERNEL__
+
+#include <linux/stringify.h>
+#include <asm/cputable.h>
+#include <asm/feature-fixups.h>
+#include <asm/reg.h>
+
+#ifdef CONFIG_PPC_BOOK3S_64
+
+#define GET_PACA(rX) \
+ BEGIN_FTR_SECTION_NESTED(66); \
+ mfspr rX,SPRN_SPRG_PACA; \
+ FTR_SECTION_ELSE_NESTED(66); \
+ mfspr rX,SPRN_SPRG_HPACA; \
+ ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
+
+#define SET_PACA(rX) \
+ BEGIN_FTR_SECTION_NESTED(66); \
+ mtspr SPRN_SPRG_PACA,rX; \
+ FTR_SECTION_ELSE_NESTED(66); \
+ mtspr SPRN_SPRG_HPACA,rX; \
+ ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
+
+#define GET_SCRATCH0(rX) \
+ BEGIN_FTR_SECTION_NESTED(66); \
+ mfspr rX,SPRN_SPRG_SCRATCH0; \
+ FTR_SECTION_ELSE_NESTED(66); \
+ mfspr rX,SPRN_SPRG_HSCRATCH0; \
+ ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
+
+#define SET_SCRATCH0(rX) \
+ BEGIN_FTR_SECTION_NESTED(66); \
+ mtspr SPRN_SPRG_SCRATCH0,rX; \
+ FTR_SECTION_ELSE_NESTED(66); \
+ mtspr SPRN_SPRG_HSCRATCH0,rX; \
+ ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
+
+#else /* CONFIG_PPC_BOOK3S_64 */
+#define GET_SCRATCH0(rX) mfspr rX,SPRN_SPRG_SCRATCH0
+#define SET_SCRATCH0(rX) mtspr SPRN_SPRG_SCRATCH0,rX
+
+#endif
+
+#ifdef CONFIG_PPC_BOOK3E_64
+
+#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX
+#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA
+
+#endif
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_POWERPC_REG_FTR_H */
@@ -14,7 +14,6 @@
#include <linux/stringify.h>
#include <asm/cputable.h>
#include <asm/asm-const.h>
-#include <asm/feature-fixups.h>
/* Pickup Book E specific registers. */
#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
@@ -1084,38 +1083,6 @@
#define SPRN_SPRG_VDSO_READ SPRN_USPRG3
#define SPRN_SPRG_VDSO_WRITE SPRN_SPRG3
-#define GET_PACA(rX) \
- BEGIN_FTR_SECTION_NESTED(66); \
- mfspr rX,SPRN_SPRG_PACA; \
- FTR_SECTION_ELSE_NESTED(66); \
- mfspr rX,SPRN_SPRG_HPACA; \
- ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
-
-#define SET_PACA(rX) \
- BEGIN_FTR_SECTION_NESTED(66); \
- mtspr SPRN_SPRG_PACA,rX; \
- FTR_SECTION_ELSE_NESTED(66); \
- mtspr SPRN_SPRG_HPACA,rX; \
- ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
-
-#define GET_SCRATCH0(rX) \
- BEGIN_FTR_SECTION_NESTED(66); \
- mfspr rX,SPRN_SPRG_SCRATCH0; \
- FTR_SECTION_ELSE_NESTED(66); \
- mfspr rX,SPRN_SPRG_HSCRATCH0; \
- ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
-
-#define SET_SCRATCH0(rX) \
- BEGIN_FTR_SECTION_NESTED(66); \
- mtspr SPRN_SPRG_SCRATCH0,rX; \
- FTR_SECTION_ELSE_NESTED(66); \
- mtspr SPRN_SPRG_HSCRATCH0,rX; \
- ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE, 66)
-
-#else /* CONFIG_PPC_BOOK3S_64 */
-#define GET_SCRATCH0(rX) mfspr rX,SPRN_SPRG_SCRATCH0
-#define SET_SCRATCH0(rX) mtspr SPRN_SPRG_SCRATCH0,rX
-
#endif
#ifdef CONFIG_PPC_BOOK3E_64
@@ -1129,9 +1096,6 @@
#define SPRN_SPRG_VDSO_READ SPRN_USPRG7
#define SPRN_SPRG_VDSO_WRITE SPRN_SPRG7
-#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX
-#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA
-
#endif
#ifdef CONFIG_PPC_BOOK3S_32
@@ -44,6 +44,7 @@
#include <asm/exception-64e.h>
#endif
#include <asm/feature-fixups.h>
+#include <asm/reg-ftr.h>
/*
* System calls.
@@ -19,6 +19,7 @@
#include <asm/cpuidle.h>
#include <asm/head-64.h>
#include <asm/feature-fixups.h>
+#include <asm/reg-ftr.h>
/*
* There are a few constraints to be concerned with.
@@ -25,6 +25,7 @@
#include <linux/threads.h>
#include <linux/init.h>
#include <asm/reg.h>
+#include <asm/reg-ftr.h>
#include <asm/page.h>
#include <asm/mmu.h>
#include <asm/ppc_asm.h>
@@ -25,6 +25,7 @@
#include <asm/mmu.h>
#include <asm/asm-compat.h>
#include <asm/feature-fixups.h>
+#include <asm/reg-ftr.h>
#undef DEBUG
@@ -17,6 +17,7 @@
#include <asm/sections.h>
#include <asm/pgtable.h>
#include <asm/kexec.h>
+#include <asm/reg-ftr.h>
#include "setup.h"
@@ -11,6 +11,7 @@
#include <asm/ppc-opcode.h>
#include <asm/ptrace.h>
#include <asm/reg.h>
+#include <asm/reg-ftr.h>
#include <asm/bug.h>
#include <asm/feature-fixups.h>
@@ -20,6 +20,7 @@
#include <asm/ppc_asm.h>
#include <asm/kvm_asm.h>
#include <asm/reg.h>
+#include <asm/reg-ftr.h>
#include <asm/mmu.h>
#include <asm/page.h>
#include <asm/ptrace.h>
@@ -20,6 +20,7 @@
#include <asm/ppc_asm.h>
#include <asm/kvm_asm.h>
#include <asm/reg.h>
+#include <asm/reg-ftr.h>
#include <asm/mmu.h>
#include <asm/page.h>
#include <asm/asm-offsets.h>
@@ -21,6 +21,7 @@
#include <asm/asm-compat.h>
#include <asm/feature-fixups.h>
+#include <asm/reg-ftr.h>
#if defined(CONFIG_PPC_BOOK3S_64)
Move all macros involving feature-fixups in a new file reg-ftr.h Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- arch/powerpc/include/asm/exception-64s.h | 1 + arch/powerpc/include/asm/reg-ftr.h | 63 ++++++++++++++++++++++++++++++++ arch/powerpc/include/asm/reg.h | 36 ------------------ arch/powerpc/kernel/entry_64.S | 1 + arch/powerpc/kernel/exceptions-64s.S | 1 + arch/powerpc/kernel/head_64.S | 1 + arch/powerpc/kernel/idle_book3s.S | 1 + arch/powerpc/kernel/paca.c | 1 + arch/powerpc/kernel/tm.S | 1 + arch/powerpc/kvm/book3s_hv_rmhandlers.S | 1 + arch/powerpc/kvm/book3s_rmhandlers.S | 1 + arch/powerpc/kvm/book3s_segment.S | 1 + 12 files changed, 73 insertions(+), 36 deletions(-) create mode 100644 arch/powerpc/include/asm/reg-ftr.h