Base support for Power12
Subsystems (2)
cover Base support for Power12
This series enables Power12 raw and architected mode with Performance Monitoring support.
Athira Rajeev (1):
powerpc/perf: Add power12 Base Performance Monitoring support
Mahesh Salgaonkar (1):
powerpc/pseries: Limit PVR list to 16 entries for CAS negotiation
Nicholas Piggin (1):
powerpc: Add Power12 raw mode
Ritesh Harjani (IBM) (1):
powerpc: Add Power12 architected mode
arch/powerpc/include/asm/cpu_setup.h | 2 + arch/powerpc/include/asm/cputable.h | 17 +- arch/powerpc/include/asm/mmu.h | 1 + arch/powerpc/include/asm/prom.h | 1 + arch/powerpc/include/asm/reg.h | 5 +- arch/powerpc/include/asm/synch.h | 6 +- arch/powerpc/include/uapi/asm/cputable.h | 2 + arch/powerpc/kernel/cpu_setup_power.c | 43 ++ arch/powerpc/kernel/cpu_specs_book3s_64.h | 36 ++ arch/powerpc/kernel/dt_cpu_ftrs.c | 37 ++ arch/powerpc/kernel/prom_init.c | 30 +- arch/powerpc/kernel/setup-common.c | 1 + arch/powerpc/kvm/book3s_hv.c | 9 +- arch/powerpc/mm/book3s64/hash_native.c | 22 +- arch/powerpc/mm/init_64.c | 4 +- arch/powerpc/perf/Makefile | 2 +- arch/powerpc/perf/core-book3s.c | 2 + arch/powerpc/perf/internal.h | 1 + arch/powerpc/perf/power12-events-list.h | 78 ++++ arch/powerpc/perf/power12-pmu.c | 466 ++++++++++++++++++++++ 20 files changed, 742 insertions(+), 23 deletions(-) create mode 100644 arch/powerpc/perf/power12-events-list.h create mode 100644 arch/powerpc/perf/power12-pmu.c
Signature · 1 line
2.55.0
PATCH 2/4 powerpc: Add Power12 raw mode
From: Nicholas Piggin <[email protected]>
Add CPU table entries for raw mode.
--- arch/powerpc/include/asm/cpu_setup.h | 2 ++ arch/powerpc/include/asm/cputable.h | 17 +++++++-- arch/powerpc/include/asm/mmu.h | 1 + arch/powerpc/include/asm/reg.h | 5 ++- arch/powerpc/include/asm/synch.h | 6 +++- arch/powerpc/include/uapi/asm/cputable.h | 1 + arch/powerpc/kernel/cpu_setup_power.c | 43 +++++++++++++++++++++++ arch/powerpc/kernel/cpu_specs_book3s_64.h | 22 ++++++++++++ arch/powerpc/kernel/dt_cpu_ftrs.c | 37 +++++++++++++++++++ arch/powerpc/kernel/setup-common.c | 1 + arch/powerpc/kvm/book3s_hv.c | 9 +++-- arch/powerpc/mm/book3s64/hash_native.c | 22 ++++++++---- arch/powerpc/mm/init_64.c | 4 ++- 13 files changed, 157 insertions(+), 13 deletions(-)
arch/powerpc/include/asm/cpu_setup.h +2 -0
@@ -9,10 +9,12 @@ void __setup_cpu_power7(unsigned long offset, struct cpu_spec *spec);void __setup_cpu_power8 (unsigned long offset,struct cpu_spec *spec);void __setup_cpu_power9 (unsigned long offset,struct cpu_spec *spec);void __setup_cpu_power10 (unsigned long offset,struct cpu_spec *spec); +void __setup_cpu_power12 (unsigned long offset,struct cpu_spec *spec);void __restore_cpu_power7 (void );void __restore_cpu_power8 (void );void __restore_cpu_power9 (void );void __restore_cpu_power10 (void ); +void __restore_cpu_power12 (void );void __setup_cpu_e500v1 (unsigned long offset,struct cpu_spec *spec);void __setup_cpu_e500v2 (unsigned long offset,struct cpu_spec *spec);
arch/powerpc/include/asm/cputable.h +15 -2
@@ -194,6 +194,7 @@ static inline void cpu_feature_keys_init(void) { }#define CPU_FTR_DAWR1 LONG_ASM_CONST(0x0008000000000000)#define CPU_FTR_DEXCR_NPHIE LONG_ASM_CONST(0x0010000000000000)#define CPU_FTR_P11_PVR LONG_ASM_CONST(0x0020000000000000) +#define CPU_FTR_ARCH_32 LONG_ASM_CONST(0x0040000000000000)#ifndef __ASSEMBLER__
@@ -457,6 +458,18 @@ static inline void cpu_feature_keys_init(void) { }#define CPU_FTRS_POWER11 (CPU_FTRS_POWER10 | CPU_FTR_P11_PVR) +#define CPU_FTRS_POWER12 (CPU_FTR_LWSYNC | \ + CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ + CPU_FTR_MMCRA | CPU_FTR_SMT | \ + CPU_FTR_COHERENT_ICACHE | \ + CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ + CPU_FTR_DSCR | \ + CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ + CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ + CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ + CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | CPU_FTR_ARCH_32 | \ + CPU_FTR_DAWR | CPU_FTR_DAWR1) +#define CPU_FTRS_CELL (CPU_FTR_LWSYNC | \ CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -476,7 +489,7 @@ static inline void cpu_feature_keys_init(void) { } (CPU_FTRS_POWER7 |CPU_FTRS_POWER8E |CPU_FTRS_POWER8 | \CPU_FTR_ALTIVEC_COMP |CPU_FTR_VSX_COMP |CPU_FTRS_POWER9 | \CPU_FTRS_POWER9_DD2_1 |CPU_FTRS_POWER9_DD2_2 | \ - CPU_FTRS_POWER9_DD2_3 | CPU_FTRS_POWER10 | CPU_FTRS_POWER11) + CPU_FTRS_POWER9_DD2_3 | CPU_FTRS_POWER10 | CPU_FTRS_POWER11 | CPU_FTRS_POWER12)#else #define CPU_FTRS_POSSIBLE \ (CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
@@ -484,7 +497,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTRS_POWER8 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \ CPU_FTR_VSX_COMP | CPU_FTR_ALTIVEC_COMP | CPU_FTRS_POWER9 | \ CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | \ - CPU_FTRS_POWER9_DD2_3 | CPU_FTRS_POWER10 | CPU_FTRS_POWER11) + CPU_FTRS_POWER9_DD2_3 | CPU_FTRS_POWER10 | CPU_FTRS_POWER11 | CPU_FTRS_POWER12)#endif /* CONFIG_CPU_LITTLE_ENDIAN */ #endif #else
arch/powerpc/include/asm/mmu.h +1 -0
@@ -133,6 +133,7 @@#define MMU_FTRS_POWER9 MMU_FTRS_POWER6#define MMU_FTRS_POWER10 MMU_FTRS_POWER6#define MMU_FTRS_POWER11 MMU_FTRS_POWER6 +#define MMU_FTRS_POWER12 MMU_FTRS_POWER6#define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ MMU_FTR_CI_LARGE_PAGE#define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
arch/powerpc/include/asm/reg.h +4 -1
@@ -492,11 +492,12 @@* determine both the compatibility level which we want to emulate and the * compatibility level which the host is capable of emulating. */ +#define PCR_ARCH_31 0x20/* Architecture 3.1 */ #define PCR_ARCH_300 0x10/* Architecture 3.00 */ #define PCR_ARCH_207 0x8/* Architecture 2.07 */ #define PCR_ARCH_206 0x4/* Architecture 2.06 */ #define PCR_ARCH_205 0x2/* Architecture 2.05 */ -#define PCR_LOW_BITS (PCR_ARCH_207 | PCR_ARCH_206 | PCR_ARCH_205 | PCR_ARCH_300) +#define PCR_LOW_BITS (PCR_ARCH_207 | PCR_ARCH_206 | PCR_ARCH_205 | PCR_ARCH_300 | PCR_ARCH_31)#define PCR_MASK ~(PCR_HIGH_BITS | PCR_LOW_BITS)/* PCR Reserved Bits */ #define SPRN_HEIR 0x153/* Hypervisor Emulated Instruction Register */ #define SPRN_TLBINDEXR 0x154/* P7 TLB control register */
@@ -1344,6 +1345,7 @@#define PVR_POWER9 0x004E#define PVR_POWER10 0x0080#define PVR_POWER11 0x0082 +#define PVR_POWER12 0x0083#define PVR_BE 0x0070#define PVR_PA6T 0x0090
@@ -1356,6 +1358,7 @@#define PVR_ARCH_300 0x0f000005#define PVR_ARCH_31 0x0f000006#define PVR_ARCH_31_P11 0x0f000007 +#define PVR_ARCH_32 0x0f000008/* Macros for setting and retrieving special purpose registers */ #ifndef __ASSEMBLER__
arch/powerpc/include/asm/synch.h +5 -1
@@ -37,8 +37,12 @@ static inline void ppc_after_tlbiel_barrier(void)* accelerators mapped will use tlbie (which does invalidate the copy) * to invalidate translations. It's not possible to limit POWER10 this * way due to local copy-paste. +* +* POWER12 does not need it. */ - asm volatile(ASM_FTR_IFSET(PPC_CP_ABORT, "", %0) : : "i" (CPU_FTR_ARCH_31) : "memory"); + asm volatile(ASM_FTR_IF(PPC_CP_ABORT, "", %0, %1) : + : "i" (CPU_FTR_ARCH_31|CPU_FTR_ARCH_32), "i" (CPU_FTR_ARCH_31) + : "memory"); }#endif /* __ASSEMBLER__ */
arch/powerpc/include/uapi/asm/cputable.h +1 -0
@@ -52,6 +52,7 @@#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000/* TM w/out suspended state */ #define PPC_FEATURE2_ARCH_3_1 0x00040000/* ISA 3.1 */ #define PPC_FEATURE2_MMA 0x00020000/* Matrix Multiply Assist */ +#define PPC_FEATURE2_ARCH_3_2 0x00010000/* ISA 3.2 */ /* * IMPORTANT!
arch/powerpc/kernel/cpu_setup_power.c +43 -0
46 lines not on this page · raw message
arch/powerpc/kernel/cpu_specs_book3s_64.h +22 -0
@@ -63,6 +63,11 @@#define COMMON_USER_POWER11 COMMON_USER_POWER10#define COMMON_USER2_POWER11 COMMON_USER2_POWER10 +#define COMMON_USER_POWER12 COMMON_USER_POWER10 +#define COMMON_USER2_POWER12 (COMMON_USER2_POWER10 | \ + PPC_FEATURE2_ARCH_3_2) + +static struct cpu_spec cpu_specs[]__initdata = { {/* PPC970 */ .pvr_mask =0xffff0000 ,
@@ -485,6 +490,23 @@ static struct cpu_spec cpu_specs[] __initdata = { .machine_check_early = __machine_check_early_realmode_p10, .platform = "power11", }, + {/* Power12 */ + .pvr_mask = 0xffff0000, + .pvr_value = 0x00830000, + .cpu_name = "Power12 (raw)", + .cpu_features = CPU_FTRS_POWER12, + .cpu_user_features = COMMON_USER_POWER12, + .cpu_user_features2 = COMMON_USER2_POWER12, + .mmu_features = MMU_FTRS_POWER12, + .icache_bsize = 128, + .dcache_bsize = 128, + .num_pmcs = 6, + .pmc_type = PPC_PMC_IBM, + .cpu_setup = __setup_cpu_power12, + .cpu_restore = __restore_cpu_power12, + .machine_check_early = __machine_check_early_realmode_p10, + .platform = "power12", + }, { /* Cell Broadband Engine */ .pvr_mask = 0xffff0000, .pvr_value = 0x00700000,
arch/powerpc/kernel/dt_cpu_ftrs.c +37 -0
@@ -26,6 +26,7 @@/* Device-tree visible constants follow */ #define ISA_V3_0B 3000#define ISA_V3_1 3100 +#define ISA_V3_2 3200#define USABLE_PR (1U << 0)#define USABLE_OS (1U << 1)
@@ -466,6 +467,35 @@ static int __init feat_enable_mce_power11(struct dt_cpu_feature *f)return 1 ; } +static void init_pmu_power12 (void ) +{ +init_pmu_power10 (); +} + +static int __init feat_enable_pmu_power12 (struct dt_cpu_feature *f) +{ +hfscr_pmu_enable (); + +init_pmu_power12 (); + init_pmu_registers = init_pmu_power12; + + cur_cpu_spec->cpu_features |=CPU_FTR_MMCRA ; + cur_cpu_spec->cpu_user_features |=PPC_FEATURE_PSERIES_PERFMON_COMPAT ; + + cur_cpu_spec->num_pmcs =6 ; + cur_cpu_spec->pmc_type =PPC_PMC_IBM ; + +return 1 ; +} + +static int __init feat_enable_mce_power12 (struct dt_cpu_feature *f) +{ + cur_cpu_spec->platform ="power12" ; + cur_cpu_spec->machine_check_early = __machine_check_early_realmode_p10; + +return 1 ; +} +static int __init feat_enable_tm (struct dt_cpu_feature *f) {#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -657,9 +687,11 @@ static struct dt_cpu_feature_match __initdata {"machine-check-power9", feat_enable_mce_power9, 0}, {"machine-check-power10", feat_enable_mce_power10, 0}, {"machine-check-power11", feat_enable_mce_power11, 0}, + {"machine-check-power12", feat_enable_mce_power12, 0}, {"performance-monitor-power9", feat_enable_pmu_power9, 0}, {"performance-monitor-power10", feat_enable_pmu_power10, 0}, {"performance-monitor-power11", feat_enable_pmu_power10, 0}, + {"performance-monitor-power12", feat_enable_pmu_power12, 0}, {"event-based-branch-v3", feat_enable, 0}, {"random-number-generator", feat_enable, 0}, {"system-call-vectored", feat_disable, 0},
@@ -714,6 +746,11 @@ static void __init cpufeatures_setup_start(u32 isa)if (PVR_VER (mfspr (SPRN_PVR )) >=PVR_POWER11 ) cur_cpu_spec->cpu_features |=CPU_FTR_P11_PVR ; } + +if (isa >=ISA_V3_2 ) { + cur_cpu_spec->cpu_features |=CPU_FTR_ARCH_32 ; + cur_cpu_spec->cpu_user_features2 |=PPC_FEATURE2_ARCH_3_2 ; + } }static bool __init cpufeatures_process_feature (struct dt_cpu_feature *f)
arch/powerpc/kernel/setup-common.c +1 -0
@@ -304,6 +304,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)break ;case 0x004e :/* POWER9 bits 12-15 give chip type */ case 0x0080 :/* POWER10 bit 12 gives SMT8/4 */ +case 0x0083 :/* POWER12 bit 12 gives SMT8/4 */ maj = (pvr >>8 ) &0x0F ; min = pvr &0xFF ;break ;
arch/powerpc/kvm/book3s_hv.c +7 -2
@@ -388,7 +388,7 @@ static void kvmppc_set_pvr_hv(struct kvm_vcpu *vcpu, u32 pvr) }/* Dummy value used in computing PCR value below */ -#define PCR_ARCH_31 (PCR_ARCH_300 << 1) +#define PCR_ARCH_32 (PCR_ARCH_31 << 1)static inline unsigned long map_pcr_to_cap (unsigned long pcr) {
@@ -417,7 +417,9 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)struct kvmppc_vcore *vc = vcpu->arch.vcore;/* We can (emulate) our own architecture version and anything older */ -if (cpu_has_feature (CPU_FTR_P11_PVR ) ||cpu_has_feature (CPU_FTR_ARCH_31 )) +if (cpu_has_feature (CPU_FTR_ARCH_32 )) + host_pcr_bit =PCR_ARCH_32 ; +else if (cpu_has_feature (CPU_FTR_P11_PVR ) ||cpu_has_feature (CPU_FTR_ARCH_31 )) host_pcr_bit =PCR_ARCH_31 ;else if (cpu_has_feature (CPU_FTR_ARCH_300 )) host_pcr_bit =PCR_ARCH_300 ;
@@ -449,6 +451,9 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)case PVR_ARCH_31_P11 : guest_pcr_bit =PCR_ARCH_31 ;break ; +case PVR_ARCH_32 : + guest_pcr_bit =PCR_ARCH_32 ; +break ;default :return -EINVAL ; }
arch/powerpc/mm/book3s64/hash_native.c +16 -6
@@ -184,9 +184,14 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize) va |= ssize <<8 ; sllp =get_sllp_encoding (apsize); va |= sllp <<5 ; - asm volatile(ASM_FTR_IFSET("tlbiel %0", PPC_TLBIEL_v205(%0, 0), %1) - : : "r" (va), "i" (CPU_FTR_ARCH_206) - : "memory"); + +if (cpu_has_feature (CPU_FTR_ARCH_32 )) { + asm volatile(PPC_TLBIEL(%0, %1, 0, 0, 0) : : "r"(va), "r"(0) : "memory"); + }else { + asm volatile(ASM_FTR_IFSET("tlbiel %0", PPC_TLBIEL_v205(%0, 0), %1) + : : "r" (va), "i" (CPU_FTR_ARCH_206) + : "memory"); + }break ;default :/* We need 14 to 14 + i bits of va */
@@ -203,9 +208,14 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)*/ va |= (vpn &0xfe ); va |=1 ;/* L */ - asm volatile(ASM_FTR_IFSET("tlbiel %0", PPC_TLBIEL_v205(%0, 1), %1) - : : "r" (va), "i" (CPU_FTR_ARCH_206) - : "memory"); + +if (cpu_has_feature (CPU_FTR_ARCH_32 )) { + asm volatile(PPC_TLBIEL(%0, %1, 0, 0, 0) : : "r"(va), "r"(0) : "memory"); + }else { + asm volatile(ASM_FTR_IFSET("tlbiel %0", PPC_TLBIEL_v205(%0, 1), %1) + : : "r" (va), "i" (CPU_FTR_ARCH_206) + : "memory"); + }break ; }trace_tlbie (0 ,1 , va,0 ,0 ,0 ,0 );
arch/powerpc/mm/init_64.c +3 -1
@@ -628,7 +628,9 @@ void __init mmu_early_init_devtree(void)of_scan_flat_dt (dt_scan_mmu_pid_width,NULL );if (hvmode && !mmu_lpid_bits) { -if (early_cpu_has_feature (CPU_FTR_ARCH_207S )) +if (early_cpu_has_feature (CPU_FTR_ARCH_32 )) + mmu_lpid_bits =16 ;/* POWER12 */ +else if (early_cpu_has_feature (CPU_FTR_ARCH_207S )) mmu_lpid_bits =12 ;/* POWER8-10 */ else mmu_lpid_bits =10 ;/* POWER7 */
Signature · 1 line
2.55.0
PATCH 1/4 powerpc/pseries: Limit PVR list to 16 entries for CAS negotiation
In reply to Mahesh SalgaonkarCurrent Power system firmware caps the PVR list array size at 16 entries during CAS (Client Architecture Support) negotiation. Passing more than capped size to older firmware could cause an undefined behaviour and breaks compatibility.
Future Power system firmware releases will lift this restriction and support greater than 16 array entries.
Ensure that when running on Power11 or below hardware, the number of PVR entries passed during CAS negotiation does not exceed the firmware-imposed limit of 16.
In prom_send_capabilities(), compute start_index to skip the oldest leading pvrs[] entries when running on Power11 or below hardware, so that the pointer passed to ibm,client-architecture-support points to ibm_architecture_vec.pvrs[start_index], presenting exactly 16 entries to firmware.
--- arch/powerpc/kernel/prom_init.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
arch/powerpc/kernel/prom_init.c +11 -7
@@ -979,6 +979,10 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = { .mask = cpu_to_be32(0xfffe0000), /* POWER5/POWER5+ */ .val = cpu_to_be32(0x003a0000), }, + { + .mask = cpu_to_be32(0xffffffff), /* all 2.04-compliant and earlier */ + .val = cpu_to_be32(0x0f000001), + }, { .mask = cpu_to_be32(0xffff0000), /* POWER6 */ .val = cpu_to_be32(0x003e0000),
@@ -1032,13 +1036,9 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = { .val = cpu_to_be32(0x0f000003), }, { - .mask = cpu_to_be32(0xffffffff), /* all 2.05-compliant */ + .mask = cpu_to_be32(0xfffffffd), /* all 2.05-compliant */ .val = cpu_to_be32(0x0f000002), }, - { - .mask = cpu_to_be32(0xfffffffe), /* all 2.04-compliant and earlier */ - .val = cpu_to_be32(0x0f000001), - }, }, .num_vectors = NUM_VECTORS(6),
@@ -1347,7 +1347,6 @@ static void __init prom_check_platform_support(void) };int prop_len =prom_getproplen (prom.chosen,"ibm,arch-vec-5-platform-support" ); -/* * First copy the architecture vec template *
@@ -1403,6 +1402,11 @@ static void __init prom_send_capabilities(void)ihandle root;prom_arg_t ret;u32 cores; +int start_index =0 ; + +if ((ARRAY_SIZE (ibm_architecture_vec_template.pvrs) >16 ) && + (PVR_VER (mfspr (SPRN_PVR )) <=PVR_POWER11 )) + start_index =ARRAY_SIZE (ibm_architecture_vec_template.pvrs) -16 ;/* Check ibm,arch-vec-5-platform-support and fixup vec5 if required */ prom_check_platform_support ();
@@ -1427,7 +1431,7 @@ static void __init prom_send_capabilities(void)if (call_prom_ret ("call-method" ,3 ,2 , &ret,ADDR ("ibm,client-architecture-support" ), root, -ADDR (&ibm_architecture_vec)) ==0 ) { +ADDR (&ibm_architecture_vec.pvrs[start_index])) ==0 ) {/* the call exists... */ if (ret) prom_printf("\nWARNING: ibm,client-architecture"
Signature · 1 line
2.55.0
PATCH 3/4 powerpc: Add Power12 architected mode
In reply to Mahesh SalgaonkarFrom: "Ritesh Harjani (IBM)" <[email protected]>
PVR value of 0x0f000008 means we are arch v3.2 compliant (i.e. Power12). This is used by phyp and kvm when booting as a pseries guest to detect the presence of new Power12 features and to enable the appropriate hwcap and facility bits.
--- arch/powerpc/include/asm/prom.h | 1 + arch/powerpc/include/uapi/asm/cputable.h | 1 + arch/powerpc/kernel/cpu_specs_book3s_64.h | 14 ++++++++++++++ arch/powerpc/kernel/prom_init.c | 12 ++++++++++-- 4 files changed, 26 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/prom.h +1 -0
@@ -118,6 +118,7 @@ extern unsigned int boot_cpu_node_count;#define OV1_PPC_3_00 0x80/* set if we support PowerPC 3.00 */ #define OV1_PPC_3_1 0x40/* set if we support PowerPC 3.1 */ +#define OV1_PPC_3_2 0x20/* set if we support PowerPC 3.2 */ /* Option vector 2: Open Firmware options supported */ #define OV2_REAL_MODE 0x20/* set if we want OF in real mode */
arch/powerpc/include/uapi/asm/cputable.h +1 -0
@@ -53,6 +53,7 @@#define PPC_FEATURE2_ARCH_3_1 0x00040000/* ISA 3.1 */ #define PPC_FEATURE2_MMA 0x00020000/* Matrix Multiply Assist */ #define PPC_FEATURE2_ARCH_3_2 0x00010000/* ISA 3.2 */ +#define PPC_FEATURE2_DMF 0x00008000/* Dense Math Facility */ /* * IMPORTANT!
arch/powerpc/kernel/cpu_specs_book3s_64.h +14 -0
@@ -303,6 +303,20 @@ static struct cpu_spec cpu_specs[] __initdata = { .cpu_restore = __restore_cpu_power10, .platform = "power11", }, + {/* 3.2-compliant processor, i.e. Power12 "architected" mode */ + .pvr_mask = 0xffffffff, + .pvr_value = 0x0f000008, + .cpu_name = "Power12 (architected)", + .cpu_features = CPU_FTRS_POWER12, + .cpu_user_features = COMMON_USER_POWER12, + .cpu_user_features2 = COMMON_USER2_POWER12, + .mmu_features = MMU_FTRS_POWER12, + .icache_bsize = 128, + .dcache_bsize = 128, + .cpu_setup = __setup_cpu_power12, + .cpu_restore = __restore_cpu_power12, + .platform = "power12", + }, { /* Power7 */ .pvr_mask = 0xffff0000, .pvr_value = 0x003f0000,
arch/powerpc/kernel/prom_init.c +10 -2
@@ -947,7 +947,7 @@ struct option_vector7 { } __packed;struct ibm_arch_vec { -struct {__be32 mask, val; } pvrs[16 ]; +struct {__be32 mask, val; } pvrs[18 ];u8 num_vectors;
@@ -1015,6 +1015,14 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = { .mask = cpu_to_be32(0xffff0000), /* POWER11 */ .val = cpu_to_be32(0x00820000), }, + { + .mask = cpu_to_be32(0xffff0000), /* POWER12 */ + .val = cpu_to_be32(0x00830000), + }, + { + .mask = cpu_to_be32(0xffffffff), /* all 3.2-compliant */ + .val = cpu_to_be32(0x0f000008), + }, { .mask = cpu_to_be32(0xffffffff), /* P11 compliant */ .val = cpu_to_be32(0x0f000007),
@@ -1048,7 +1056,7 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = { .byte1 = 0, .arch_versions =OV1_PPC_2_00 |OV1_PPC_2_01 |OV1_PPC_2_02 |OV1_PPC_2_03 | OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07, - .arch_versions3 = OV1_PPC_3_00 | OV1_PPC_3_1, + .arch_versions3 = OV1_PPC_3_00 | OV1_PPC_3_1 | OV1_PPC_3_2, }, .vec2_len = VECTOR_LENGTH(sizeof(struct option_vector2)),
Signature · 1 line
2.55.0
PATCH 4/4 powerpc/perf: Add power12 Base Performance Monitoring support
In reply to Mahesh SalgaonkarFrom: Athira Rajeev <[email protected]>
Base enablement patch to register performance monitoring hardware support for power12. Patch introduce the raw event encoding format, defines the supported list of events, config fields for the event attributes and their corresponding bit values which are exported via sysfs.
--- arch/powerpc/perf/Makefile | 2 +- arch/powerpc/perf/core-book3s.c | 2 + arch/powerpc/perf/internal.h | 1 + arch/powerpc/perf/power12-events-list.h | 78 ++++ arch/powerpc/perf/power12-pmu.c | 466 ++++++++++++++++++++++++ 5 files changed, 548 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/perf/power12-events-list.h create mode 100644 arch/powerpc/perf/power12-pmu.c
arch/powerpc/perf/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o obj64-$(CONFIG_PPC_PERF_CTRS) += ppc970-pmu.o power5-pmu.o \ power5+-pmu.o power6-pmu.o power7-pmu.o \ isa207-common.o power8-pmu.o power9-pmu.o \ - generic-compat-pmu.o power10-pmu.o bhrb.o + generic-compat-pmu.o power10-pmu.o bhrb.o power12-pmu.o obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o obj-$(CONFIG_PPC_POWERNV) += imc-pmu.o
arch/powerpc/perf/core-book3s.c +2 -0
@@ -2613,6 +2613,8 @@ static int __init init_ppc64_pmu(void)return 0 ; else if (!init_power11_pmu()) return 0; + else if (!init_power12_pmu()) + return 0; else if (!init_ppc970_pmu()) return 0; else
arch/powerpc/perf/internal.h +1 -0
@@ -11,4 +11,5 @@ int __init init_power8_pmu(void);int __init init_power9_pmu (void );int __init init_power10_pmu (void );int __init init_power11_pmu (void ); +int __init init_power12_pmu (void );int __init init_generic_compat_pmu (void );
arch/powerpc/perf/power12-events-list.h new file +78 -0
78 lines not on this page · raw message
arch/powerpc/perf/power12-pmu.c new file +466 -0
466 lines not on this page · raw message
Signature · 1 line
2.55.0
Tested on Power9, Power10 and Power11. System boots well on all three platforms.
Re: [PATCH 4/4] powerpc/perf: Add power12 Base Performance Monitoring support
In reply to Mahesh Salgaonkararch/powerpc/perf/power12-events-list.h line 34
Quoted 2 lines · Mahesh Salgaonkar
arch/powerpc/perf/power12-events-list.h new file +2
-0+/* Instruction Demand sectors wriittent into IL1 */ +EVENT (PM_INST_FROM_L1MISS ,0x03F00000001C040 );
Hi Athira and Mahesh,
There is a typo here: "wriittent" should be "written".
Thanks
~ Nikhil
Re: [PATCH 1/4] powerpc/pseries: Limit PVR list to 16 entries for CAS negotiation
In reply to Mahesh Salgaonkararch/powerpc/kernel/prom_init.c static void __init prom_send_capabilities(void) · line 1409
Quoted 3 lines · Mahesh Salgaonkar
arch/powerpc/kernel/prom_init.c +3
-0+if ((ARRAY_SIZE (ibm_architecture_vec_template.pvrs) >16 ) && + (PVR_VER (mfspr (SPRN_PVR )) <=PVR_POWER11 )) + start_index =ARRAY_SIZE (ibm_architecture_vec_template.pvrs) -16 ;
Hi Mahesh,
The literal 16 appears twice. Please define a named macro, e.g.: #define CAS_MAX_PVR_ENTRIES 16
Thanks,
~ Nikhil
Re: [PATCH 2/4] powerpc: Add Power12 raw mode
In reply to Mahesh SalgaonkarOn 29/07/26 20:24, Mahesh Salgaonkar wrote:
Looks good overall.
Thanks,
~ Nikhil
Re: [PATCH 1/4] powerpc/pseries: Limit PVR list to 16 entries for CAS negotiation
In reply to Nikhil Kumar SinghQuoted 12 lines · Nikhil Kumar Singh
arch/powerpc/kernel/prom_init.c static void __init prom_send_capabilities(void) · line 1409
Quoted 3 lines · Mahesh Salgaonkar
arch/powerpc/kernel/prom_init.c +3
-0+if ((ARRAY_SIZE (ibm_architecture_vec_template.pvrs) >16 ) && + (PVR_VER (mfspr (SPRN_PVR )) <=PVR_POWER11 )) + start_index =ARRAY_SIZE (ibm_architecture_vec_template.pvrs) -16 ;Hi Mahesh,
Quoted 2 lines
The literal 16 appears twice. Please define a named macro, e.g.: #define
CAS_MAX_PVR_ENTRIES16
Sure, will do. Thanks for your review.
Thanks,
-Mahesh.
Quoted 4 lines
Thanks,
~ Nikhil
Signature · 1 line
Mahesh J Salgaonkar
Re: [PATCH 4/4] powerpc/perf: Add power12 Base Performance Monitoring support
In reply to Nikhil Kumar SinghQuoted 9 lines · Nikhil Kumar Singh
arch/powerpc/perf/power12-events-list.h line 34
Quoted 2 lines · Mahesh Salgaonkar
arch/powerpc/perf/power12-events-list.h new file +2
-0+/* Instruction Demand sectors wriittent into IL1 */ +EVENT (PM_INST_FROM_L1MISS ,0x03F00000001C040 );Hi Athira and Mahesh,
There is a typo here: "wriittent" should be "written".
Will fix it. Thanks for catching it.
Quoted 4 lines
Thanks
~ Nikhil
Signature · 1 line
Mahesh J Salgaonkar
Re: [PATCH 3/4] powerpc: Add Power12 architected mode
In reply to Mahesh SalgaonkarQuoted 1 line · Mahesh Salgaonkar
+#define
PPC_FEATURE2_DMF0x00008000/* Dense Math Facility */
Hi Ritesh and Mahesh,
PPC_FEATURE2_DMF is added to the uapi header but never set anywhere in this series. Would it be better to drop the #define here and add it in the series that actually enables Dense Math Facility?
Thanks,
~ Nikhil
Re: [PATCH 3/4] powerpc: Add Power12 architected mode
Quoted 11 lines · Nikhil Kumar Singh
Quoted 1 line · Mahesh Salgaonkar
+#define
PPC_FEATURE2_DMF0x00008000/* Dense Math Facility */Hi Ritesh and Mahesh,
PPC_FEATURE2_DMFis added to the uapi header but never set anywhere in this series. Would it be better to drop the #define here and add it in the series that actually enables Dense Math Facility?
This bit is defined for future use.
Thanks,
-Mahesh.
Quoted 5 lines
Thanks,
~ Nikhil
Signature · 1 line
Mahesh J Salgaonkar
Nikhil Kumar Singh
Reviewed-byRe: [PATCH 3/4] powerpc: Add Power12 architected mode
Quoted 4 lines · Mahesh J Salgaonkar
Quoted 4 lines
Quoted 1 line
+#define
PPC_FEATURE2_DMF0x00008000/* Dense Math Facility */Hi Ritesh and Mahesh,
Quoted 8 lines
Quoted 3 lines
PPC_FEATURE2_DMFis added to the uapi header but never set anywhere in this series. Would it be better to drop the #define here and add it in the series that actually enables Dense Math Facility?This bit is defined for future use.
Thanks,
-Mahesh.
Understood. I have no additional questions, the patch looks fine to me.
Thanks,
~ Nikhil