Subject: Re: [PATCH v2] PPC: Set reserved PCR bits

From: Michael Ellerman <[email-masked]>
Date: Mon, 16 Sep 2019 19:49:26 +1000

Alistair Popple <[email-masked]> writes:
> Currently the reserved bits of the Processor Compatibility Register
> (PCR) are cleared as per the Programming Note in Section 1.3.3 of
> version 3.0B of the Power ISA. This causes all new architecture
> features to be made available when running on newer processors with
> new architecture features added to the PCR as bits must be set to
> disable a given feature.
>
> For example to disable new features added as part of Version 2.07 of
> the ISA the corresponding bit in the PCR needs to be set.
>
> As new processor features generally require explicit kernel support
> they should be disabled until such support is implemented. Therefore
> kernels should set all unknown/reserved bits in the PCR such that any
> new architecture features which the kernel does not currently know
> about get disabled.
>
> An update is planned to the ISA to clarify that the PCR is an
> exception to the Programming Note on reserved bits in Section 1.3.3.
>
> Signed-off-by: Alistair Popple <[email-masked]>
> Signed-off-by: Jordan Niethe <[email-masked]>
> Tested-by: Joel Stanley <[email-masked]>
> ---
> v2: Added some clarifications to the commit message
> ---
>  arch/powerpc/include/asm/reg.h          |  3 +++
>  arch/powerpc/kernel/cpu_setup_power.S   |  6 ++++++
>  arch/powerpc/kernel/dt_cpu_ftrs.c       |  3 ++-
>  arch/powerpc/kvm/book3s_hv.c            | 11 +++++++----
>  arch/powerpc/kvm/book3s_hv_nested.c     |  6 +++---
>  arch/powerpc/kvm/book3s_hv_rmhandlers.S | 10 ++++++----
>  6 files changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> index 10caa145f98b..258435c75c43 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -475,6 +475,7 @@
>  #define   PCR_VEC_DIS	(1ul << (63-0))	/* Vec. disable (bit NA since POWER8) */
>  #define   PCR_VSX_DIS	(1ul << (63-1))	/* VSX disable (bit NA since POWER8) */
>  #define   PCR_TM_DIS	(1ul << (63-2))	/* Trans. memory disable (POWER8) */
> +#define   PCR_HIGH_BITS	(PCR_VEC_DIS | PCR_VSX_DIS | PCR_TM_DIS)

This doesn't build with old binutils that don't support 'ul', eg:

  arch/powerpc/kvm/book3s_hv_rmhandlers.S:647: Error: junk at end of line, first unrecognized character is `u'
  arch/powerpc/kvm/book3s_hv_rmhandlers.S:647: Error: missing ')'
  arch/powerpc/kvm/book3s_hv_rmhandlers.S:647: Error: junk at end of line: `ul<<(63-0))|(1ul<<(63-1))|(1ul<<(63-2)))|(0x8|0x4|0x2)))>>32)@h'
  arch/powerpc/kernel/cpu_setup_power.S:131: Error: syntax error; found `u', expected `,'
  arch/powerpc/kernel/cpu_setup_power.S:131: Error: junk at end of line: `ul<<(63-0))|(1ul<<(63-1))|(1ul<<(63-2)))|(0x8|0x4|0x2)))@l'

etc. http://kisskb.ellerman.id.au/kisskb/buildresult/13957233/ 

There's a gcc-4.6 with an old binutils on the ka's.

cheers