Skip to content

Commit a3ea40d

Browse files
apopplempe
authored andcommitted
powerpc: Add POWER10 architected mode
PVR value of 0x0F000006 means we are arch v3.1 compliant (i.e. POWER10). This is used by phyp and kvm when booting as a pseries guest to detect the presence of new P10 features and to enable the appropriate hwcap and facility bits. Signed-off-by: Alistair Popple <[email protected]> Signed-off-by: Cédric Le Goater <[email protected]> [mpe: Fall through to __init_FSCR rather than duplicating it, drop hack to set current->thread.fscr now that is handled elsewhere.] Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 87939d5 commit a3ea40d

File tree

6 files changed

+65
-6
lines changed

6 files changed

+65
-6
lines changed

arch/powerpc/include/asm/cputable.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,17 @@ static inline void cpu_feature_keys_init(void) { }
468468
#define CPU_FTRS_POWER9_DD2_2 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1 | \
469469
CPU_FTR_P9_TM_HV_ASSIST | \
470470
CPU_FTR_P9_TM_XER_SO_BUG)
471+
#define CPU_FTRS_POWER10 (CPU_FTR_LWSYNC | \
472+
CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
473+
CPU_FTR_MMCRA | CPU_FTR_SMT | \
474+
CPU_FTR_COHERENT_ICACHE | \
475+
CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
476+
CPU_FTR_DSCR | CPU_FTR_SAO | \
477+
CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
478+
CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
479+
CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
480+
CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_PKEY | \
481+
CPU_FTR_ARCH_31)
471482
#define CPU_FTRS_CELL (CPU_FTR_LWSYNC | \
472483
CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
473484
CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -486,14 +497,14 @@ static inline void cpu_feature_keys_init(void) { }
486497
#define CPU_FTRS_POSSIBLE \
487498
(CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | CPU_FTRS_POWER8 | \
488499
CPU_FTR_ALTIVEC_COMP | CPU_FTR_VSX_COMP | CPU_FTRS_POWER9 | \
489-
CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2)
500+
CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10)
490501
#else
491502
#define CPU_FTRS_POSSIBLE \
492503
(CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
493504
CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \
494505
CPU_FTRS_POWER8 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \
495506
CPU_FTR_VSX_COMP | CPU_FTR_ALTIVEC_COMP | CPU_FTRS_POWER9 | \
496-
CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2)
507+
CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10)
497508
#endif /* CONFIG_CPU_LITTLE_ENDIAN */
498509
#endif
499510
#else

arch/powerpc/include/asm/mmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
#define MMU_FTRS_POWER7 MMU_FTRS_POWER6
123123
#define MMU_FTRS_POWER8 MMU_FTRS_POWER6
124124
#define MMU_FTRS_POWER9 MMU_FTRS_POWER6
125+
#define MMU_FTRS_POWER10 MMU_FTRS_POWER6
125126
#define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
126127
MMU_FTR_CI_LARGE_PAGE
127128
#define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \

arch/powerpc/include/asm/prom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ extern int of_read_drc_info_cell(struct property **prop,
117117
#define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */
118118

119119
#define OV1_PPC_3_00 0x80 /* set if we support PowerPC 3.00 */
120+
#define OV1_PPC_3_1 0x40 /* set if we support PowerPC 3.1 */
120121

121122
/* Option vector 2: Open Firmware options supported */
122123
#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */

arch/powerpc/kernel/cpu_setup_power.S

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,15 @@ _GLOBAL(__restore_cpu_power8)
9191
mtlr r11
9292
blr
9393

94+
_GLOBAL(__setup_cpu_power10)
95+
mflr r11
96+
bl __init_FSCR_power10
97+
b 1f
98+
9499
_GLOBAL(__setup_cpu_power9)
95100
mflr r11
96101
bl __init_FSCR
97-
bl __init_PMU
102+
1: bl __init_PMU
98103
bl __init_hvmode_206
99104
mtlr r11
100105
beqlr
@@ -116,10 +121,15 @@ _GLOBAL(__setup_cpu_power9)
116121
mtlr r11
117122
blr
118123

124+
_GLOBAL(__restore_cpu_power10)
125+
mflr r11
126+
bl __init_FSCR_power10
127+
b 1f
128+
119129
_GLOBAL(__restore_cpu_power9)
120130
mflr r11
121131
bl __init_FSCR
122-
bl __init_PMU
132+
1: bl __init_PMU
123133
mfmsr r3
124134
rldicl. r0,r3,4,63
125135
mtlr r11
@@ -182,6 +192,12 @@ __init_LPCR_ISA300:
182192
isync
183193
blr
184194

195+
__init_FSCR_power10:
196+
mfspr r3, SPRN_FSCR
197+
ori r3, r3, FSCR_PREFIX
198+
mtspr SPRN_FSCR, r3
199+
// fall through
200+
185201
__init_FSCR:
186202
mfspr r3,SPRN_FSCR
187203
ori r3,r3,FSCR_TAR|FSCR_EBB

arch/powerpc/kernel/cputable.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec);
7070
extern void __restore_cpu_power8(void);
7171
extern void __setup_cpu_power9(unsigned long offset, struct cpu_spec* spec);
7272
extern void __restore_cpu_power9(void);
73+
extern void __setup_cpu_power10(unsigned long offset, struct cpu_spec* spec);
74+
extern void __restore_cpu_power10(void);
7375
extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
7476
extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
7577
extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
@@ -119,6 +121,10 @@ extern void __restore_cpu_e6500(void);
119121
PPC_FEATURE2_ARCH_3_00 | \
120122
PPC_FEATURE2_HAS_IEEE128 | \
121123
PPC_FEATURE2_DARN )
124+
#define COMMON_USER_POWER10 COMMON_USER_POWER9
125+
#define COMMON_USER2_POWER10 (COMMON_USER2_POWER9 | \
126+
PPC_FEATURE2_ARCH_3_1 | \
127+
PPC_FEATURE2_MMA)
122128

123129
#ifdef CONFIG_PPC_BOOK3E_64
124130
#define COMMON_USER_BOOKE (COMMON_USER_PPC64 | PPC_FEATURE_BOOKE)
@@ -367,6 +373,22 @@ static struct cpu_spec __initdata cpu_specs[] = {
367373
.cpu_restore = __restore_cpu_power9,
368374
.platform = "power9",
369375
},
376+
{ /* 3.1-compliant processor, i.e. Power10 "architected" mode */
377+
.pvr_mask = 0xffffffff,
378+
.pvr_value = 0x0f000006,
379+
.cpu_name = "POWER10 (architected)",
380+
.cpu_features = CPU_FTRS_POWER10,
381+
.cpu_user_features = COMMON_USER_POWER10,
382+
.cpu_user_features2 = COMMON_USER2_POWER10,
383+
.mmu_features = MMU_FTRS_POWER10,
384+
.icache_bsize = 128,
385+
.dcache_bsize = 128,
386+
.oprofile_type = PPC_OPROFILE_INVALID,
387+
.oprofile_cpu_type = "ppc64/ibm-compat-v1",
388+
.cpu_setup = __setup_cpu_power10,
389+
.cpu_restore = __restore_cpu_power10,
390+
.platform = "power10",
391+
},
370392
{ /* Power7 */
371393
.pvr_mask = 0xffff0000,
372394
.pvr_value = 0x003f0000,

arch/powerpc/kernel/prom_init.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ struct option_vector6 {
920920
} __packed;
921921

922922
struct ibm_arch_vec {
923-
struct { u32 mask, val; } pvrs[12];
923+
struct { u32 mask, val; } pvrs[14];
924924

925925
u8 num_vectors;
926926

@@ -973,6 +973,14 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
973973
.mask = cpu_to_be32(0xffff0000), /* POWER9 */
974974
.val = cpu_to_be32(0x004e0000),
975975
},
976+
{
977+
.mask = cpu_to_be32(0xffff0000), /* POWER10 */
978+
.val = cpu_to_be32(0x00800000),
979+
},
980+
{
981+
.mask = cpu_to_be32(0xffffffff), /* all 3.1-compliant */
982+
.val = cpu_to_be32(0x0f000006),
983+
},
976984
{
977985
.mask = cpu_to_be32(0xffffffff), /* all 3.00-compliant */
978986
.val = cpu_to_be32(0x0f000005),
@@ -1002,7 +1010,7 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
10021010
.byte1 = 0,
10031011
.arch_versions = OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
10041012
OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
1005-
.arch_versions3 = OV1_PPC_3_00,
1013+
.arch_versions3 = OV1_PPC_3_00 | OV1_PPC_3_1,
10061014
},
10071015

10081016
.vec2_len = VECTOR_LENGTH(sizeof(struct option_vector2)),

0 commit comments

Comments
 (0)