Skip to content

Commit d442bc6

Browse files
author
Fox Snowpatch
committed
1 parent 5165c17 commit d442bc6

File tree

10 files changed

+90
-1
lines changed

10 files changed

+90
-1
lines changed

arch/powerpc/include/asm/cputable.h

+3
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ static inline void cpu_feature_keys_init(void) { }
454454
CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \
455455
CPU_FTR_DAWR | CPU_FTR_DAWR1 | \
456456
CPU_FTR_DEXCR_NPHIE)
457+
458+
#define CPU_FTRS_POWER11 CPU_FTRS_POWER10
459+
457460
#define CPU_FTRS_CELL (CPU_FTR_LWSYNC | \
458461
CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
459462
CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \

arch/powerpc/include/asm/mmu.h

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
#define MMU_FTRS_POWER8 MMU_FTRS_POWER6
134134
#define MMU_FTRS_POWER9 MMU_FTRS_POWER6
135135
#define MMU_FTRS_POWER10 MMU_FTRS_POWER6
136+
#define MMU_FTRS_POWER11 MMU_FTRS_POWER6
136137
#define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
137138
MMU_FTR_CI_LARGE_PAGE
138139
#define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \

arch/powerpc/include/asm/reg.h

+2
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@
13641364
#define PVR_HX_C2000 0x0066
13651365
#define PVR_POWER9 0x004E
13661366
#define PVR_POWER10 0x0080
1367+
#define PVR_POWER11 0x0082
13671368
#define PVR_BE 0x0070
13681369
#define PVR_PA6T 0x0090
13691370

@@ -1375,6 +1376,7 @@
13751376
#define PVR_ARCH_207 0x0f000004
13761377
#define PVR_ARCH_300 0x0f000005
13771378
#define PVR_ARCH_31 0x0f000006
1379+
#define PVR_ARCH_31N 0x0f000007
13781380

13791381
/* Macros for setting and retrieving special purpose registers */
13801382
#ifndef __ASSEMBLY__

arch/powerpc/kernel/cpu_specs_book3s_64.h

+34
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
6161
PPC_FEATURE2_VEC_CRYPTO)
6262

63+
#define COMMON_USER_POWER11 COMMON_USER_POWER10
64+
#define COMMON_USER2_POWER11 COMMON_USER2_POWER10
65+
6366
static struct cpu_spec cpu_specs[] __initdata = {
6467
{ /* PPC970 */
6568
.pvr_mask = 0xffff0000,
@@ -281,6 +284,20 @@ static struct cpu_spec cpu_specs[] __initdata = {
281284
.cpu_restore = __restore_cpu_power10,
282285
.platform = "power10",
283286
},
287+
{ /* 3.1-compliant processor, i.e. Power11 "architected" mode */
288+
.pvr_mask = 0xffffffff,
289+
.pvr_value = 0x0f000007,
290+
.cpu_name = "Power11 (architected)",
291+
.cpu_features = CPU_FTRS_POWER11,
292+
.cpu_user_features = COMMON_USER_POWER11,
293+
.cpu_user_features2 = COMMON_USER2_POWER11,
294+
.mmu_features = MMU_FTRS_POWER11,
295+
.icache_bsize = 128,
296+
.dcache_bsize = 128,
297+
.cpu_setup = __setup_cpu_power10,
298+
.cpu_restore = __restore_cpu_power10,
299+
.platform = "power11",
300+
},
284301
{ /* Power7 */
285302
.pvr_mask = 0xffff0000,
286303
.pvr_value = 0x003f0000,
@@ -451,6 +468,23 @@ static struct cpu_spec cpu_specs[] __initdata = {
451468
.machine_check_early = __machine_check_early_realmode_p10,
452469
.platform = "power10",
453470
},
471+
{ /* Power11 */
472+
.pvr_mask = 0xffff0000,
473+
.pvr_value = 0x00820000,
474+
.cpu_name = "Power11 (raw)",
475+
.cpu_features = CPU_FTRS_POWER11,
476+
.cpu_user_features = COMMON_USER_POWER11,
477+
.cpu_user_features2 = COMMON_USER2_POWER11,
478+
.mmu_features = MMU_FTRS_POWER11,
479+
.icache_bsize = 128,
480+
.dcache_bsize = 128,
481+
.num_pmcs = 6,
482+
.pmc_type = PPC_PMC_IBM,
483+
.cpu_setup = __setup_cpu_power10,
484+
.cpu_restore = __restore_cpu_power10,
485+
.machine_check_early = __machine_check_early_realmode_p10,
486+
.platform = "power11",
487+
},
454488
{ /* Cell Broadband Engine */
455489
.pvr_mask = 0xffff0000,
456490
.pvr_value = 0x00700000,

arch/powerpc/kernel/dt_cpu_ftrs.c

+10
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,14 @@ static int __init feat_enable_mce_power10(struct dt_cpu_feature *f)
458458
return 1;
459459
}
460460

461+
static int __init feat_enable_mce_power11(struct dt_cpu_feature *f)
462+
{
463+
cur_cpu_spec->platform = "power11";
464+
cur_cpu_spec->machine_check_early = __machine_check_early_realmode_p10;
465+
466+
return 1;
467+
}
468+
461469
static int __init feat_enable_tm(struct dt_cpu_feature *f)
462470
{
463471
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -648,8 +656,10 @@ static struct dt_cpu_feature_match __initdata
648656
{"pc-relative-addressing", feat_enable, 0},
649657
{"machine-check-power9", feat_enable_mce_power9, 0},
650658
{"machine-check-power10", feat_enable_mce_power10, 0},
659+
{"machine-check-power11", feat_enable_mce_power11, 0},
651660
{"performance-monitor-power9", feat_enable_pmu_power9, 0},
652661
{"performance-monitor-power10", feat_enable_pmu_power10, 0},
662+
{"performance-monitor-power11", feat_enable_pmu_power10, 0},
653663
{"event-based-branch-v3", feat_enable, 0},
654664
{"random-number-generator", feat_enable, 0},
655665
{"system-call-vectored", feat_disable, 0},

arch/powerpc/kernel/prom_init.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ struct option_vector7 {
947947
} __packed;
948948

949949
struct ibm_arch_vec {
950-
struct { __be32 mask, val; } pvrs[14];
950+
struct { __be32 mask, val; } pvrs[16];
951951

952952
u8 num_vectors;
953953

@@ -1007,6 +1007,14 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
10071007
.mask = cpu_to_be32(0xffff0000), /* POWER10 */
10081008
.val = cpu_to_be32(0x00800000),
10091009
},
1010+
{
1011+
.mask = cpu_to_be32(0xffff0000), /* POWER11 */
1012+
.val = cpu_to_be32(0x00820000),
1013+
},
1014+
{
1015+
.mask = cpu_to_be32(0xffffffff), /* all 3.1-compliant */
1016+
.val = cpu_to_be32(0x0f000007),
1017+
},
10101018
{
10111019
.mask = cpu_to_be32(0xffffffff), /* all 3.1-compliant */
10121020
.val = cpu_to_be32(0x0f000006),

arch/powerpc/kvm/book3s_hv.c

+1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)
427427
cap = H_GUEST_CAP_POWER9;
428428
break;
429429
case PVR_ARCH_31:
430+
case PVR_ARCH_31N:
430431
guest_pcr_bit = PCR_ARCH_31;
431432
cap = H_GUEST_CAP_POWER10;
432433
break;

arch/powerpc/perf/core-book3s.c

+2
Original file line numberDiff line numberDiff line change
@@ -2593,6 +2593,8 @@ static int __init init_ppc64_pmu(void)
25932593
return 0;
25942594
else if (!init_power10_pmu())
25952595
return 0;
2596+
else if (!init_power11_pmu())
2597+
return 0;
25962598
else if (!init_ppc970_pmu())
25972599
return 0;
25982600
else

arch/powerpc/perf/internal.h

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ int __init init_power7_pmu(void);
1010
int __init init_power8_pmu(void);
1111
int __init init_power9_pmu(void);
1212
int __init init_power10_pmu(void);
13+
int __init init_power11_pmu(void);
1314
int __init init_generic_compat_pmu(void);

arch/powerpc/perf/power10-pmu.c

+27
Original file line numberDiff line numberDiff line change
@@ -634,3 +634,30 @@ int __init init_power10_pmu(void)
634634

635635
return 0;
636636
}
637+
638+
static struct power_pmu power11_pmu;
639+
640+
int __init init_power11_pmu(void)
641+
{
642+
unsigned int pvr;
643+
int rc;
644+
645+
pvr = mfspr(SPRN_PVR);
646+
if (PVR_VER(pvr) != PVR_POWER11)
647+
return -ENODEV;
648+
649+
/* Set the PERF_REG_EXTENDED_MASK here */
650+
PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_31;
651+
652+
power11_pmu = power10_pmu;
653+
power11_pmu.name = "Power11";
654+
655+
rc = register_power_pmu(&power11_pmu);
656+
if (rc)
657+
return rc;
658+
659+
/* Tell userspace that EBB is supported */
660+
cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_EBB;
661+
662+
return 0;
663+
}

0 commit comments

Comments
 (0)