[PATCH v2 1/2] powerpc: Introduce POWER10_DD1 feature

Jordan Niethe jniethe5 at gmail.com
Thu Oct 22 17:26:21 AEDT 2020


On Thu, Oct 22, 2020 at 4:33 PM Ravi Bangoria
<ravi.bangoria at linux.ibm.com> wrote:
>
>
>
> On 10/22/20 10:41 AM, Jordan Niethe wrote:
> > On Thu, Oct 22, 2020 at 2:40 PM Ravi Bangoria
> > <ravi.bangoria at linux.ibm.com> wrote:
> >>
> >> POWER10_DD1 feature flag will be needed while adding
> >> conditional code that applies only for Power10 DD1.
> >>
> >> Signed-off-by: Ravi Bangoria <ravi.bangoria at linux.ibm.com>
> >> ---
> >>   arch/powerpc/include/asm/cputable.h | 8 ++++++--
> >>   arch/powerpc/kernel/dt_cpu_ftrs.c   | 3 +++
> >>   arch/powerpc/kernel/prom.c          | 9 +++++++++
> >>   3 files changed, 18 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> >> index 93bc70d4c9a1..d486f56c0d33 100644
> >> --- a/arch/powerpc/include/asm/cputable.h
> >> +++ b/arch/powerpc/include/asm/cputable.h
> >> @@ -216,6 +216,7 @@ static inline void cpu_feature_keys_init(void) { }
> >>   #define CPU_FTR_P9_RADIX_PREFETCH_BUG  LONG_ASM_CONST(0x0002000000000000)
> >>   #define CPU_FTR_ARCH_31                        LONG_ASM_CONST(0x0004000000000000)
> >>   #define CPU_FTR_DAWR1                  LONG_ASM_CONST(0x0008000000000000)
> >> +#define CPU_FTR_POWER10_DD1            LONG_ASM_CONST(0x0010000000000000)
> >>
> >>   #ifndef __ASSEMBLY__
> >>
> >> @@ -479,6 +480,7 @@ static inline void cpu_feature_keys_init(void) { }
> >>              CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
> >>              CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \
> >>              CPU_FTR_DAWR | CPU_FTR_DAWR1)
> >> +#define CPU_FTRS_POWER10_DD1   (CPU_FTRS_POWER10 | CPU_FTR_POWER10_DD1)
> >>   #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 | \
> >> @@ -497,14 +499,16 @@ static inline void cpu_feature_keys_init(void) { }
> >>   #define CPU_FTRS_POSSIBLE      \
> >>              (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_POWER10)
> >> +            CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10 | \
> >> +            CPU_FTRS_POWER10_DD1)
> >>   #else
> >>   #define CPU_FTRS_POSSIBLE      \
> >>              (CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
> >>               CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \
> >>               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_POWER10)
> >> +            CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10 | \
> >> +            CPU_FTRS_POWER10_DD1)
> >>   #endif /* CONFIG_CPU_LITTLE_ENDIAN */
> >>   #endif
> >>   #else
> >> diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
> >> index 1098863e17ee..b2327f2967ff 100644
> >> --- a/arch/powerpc/kernel/dt_cpu_ftrs.c
> >> +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
> >> @@ -811,6 +811,9 @@ static __init void cpufeatures_cpu_quirks(void)
> >>          }
> >>
> >>          update_tlbie_feature_flag(version);
> >> +
> >> +       if ((version & 0xffffffff) == 0x00800100)
> >> +               cur_cpu_spec->cpu_features |= CPU_FTR_POWER10_DD1;
> >>   }
> >>
> >>   static void __init cpufeatures_setup_finished(void)
> >> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> >> index c1545f22c077..c778c81284f7 100644
> >> --- a/arch/powerpc/kernel/prom.c
> >> +++ b/arch/powerpc/kernel/prom.c
> >> @@ -305,6 +305,14 @@ static void __init check_cpu_feature_properties(unsigned long node)
> >>          }
> >>   }
> >>
> >> +static void __init fixup_cpu_features(void)
> >> +{
> >> +       unsigned long version = mfspr(SPRN_PVR);
> >> +
> >> +       if ((version & 0xffffffff) == 0x00800100)
> >> +               cur_cpu_spec->cpu_features |= CPU_FTR_POWER10_DD1;
> >> +}
> >> +
> > I am just wondering why this is needed here, but the same thing is not
> > done for, say, CPU_FTR_POWER9_DD2_1?
>
> When we don't use DT cpu_features (PowerVM / kvm geusts), we call
> identify_cpu() twice. First with Real PVR which sets "raw" cpu_spec
> as cur_cpu_spec and then 2nd time with Logical PVR (0x0f...) which
> (mostly) overwrites the cur_cpu_spec with "architected" mode cpu_spec.
> I don't see DD version specific entries for "architected" mode in
> cpu_specs[] for any previous processors. So I've introduced this
> function to tweak cpu_features.
>
> Though, I don't know why we don't have similar thing for
> CPU_FTR_POWER9_DD2_1. I've to check that.
>
> > And should we get a /* Power10 DD 1 */ added to cpu_specs[]?
>
> IIUC, we don't need such entry. For PowerVM / kvm guests, we overwrite
> cpu_spec, so /* Power10 */ "raw" entry is sufficient. And For baremetal,
> we don't use cpu_specs[] at all.
I think even for powernv, using dt features can be disabled by the
cmdline with dt_cpu_ftrs=off, then cpu_specs[] will then be used.
>
> >
> >>   static int __init early_init_dt_scan_cpus(unsigned long node,
> >>                                            const char *uname, int depth,
> >>                                            void *data)
> >> @@ -378,6 +386,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
> >>
> >>                  check_cpu_feature_properties(node);
> >>                  check_cpu_pa_features(node);
> >> +               fixup_cpu_features();
> >>          }
> >>
> >>          identical_pvr_fixup(node);
> >> --
> >> 2.25.1
> >>


More information about the Linuxppc-dev mailing list