Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: ovidiu.panait@windriver.com
Cc: stable@vger.kernel.org,
	D Scott Phillips <scott@os.amperecomputing.com>,
	James Morse <james.morse@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH 5.4 1/2] arm64: Add AMPERE1 to the Spectre-BHB affected list
Date: Fri, 4 Aug 2023 12:24:12 +0200	[thread overview]
Message-ID: <2023080406-wow-repeated-09d9@gregkh> (raw)
In-Reply-To: <20230801093736.4110870-1-ovidiu.panait@windriver.com>

On Tue, Aug 01, 2023 at 12:37:35PM +0300, ovidiu.panait@windriver.com wrote:
> From: D Scott Phillips <scott@os.amperecomputing.com>
> 
> commit 0e5d5ae837c8ce04d2ddb874ec5f920118bd9d31 upstream.
> 
> Per AmpereOne erratum AC03_CPU_12, "Branch history may allow control of
> speculative execution across software contexts," the AMPERE1 core needs the
> bhb clearing loop to mitigate Spectre-BHB, with a loop iteration count of
> 11.
> 
> Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
> Link: https://lore.kernel.org/r/20221011022140.432370-1-scott@os.amperecomputing.com
> Reviewed-by: James Morse <james.morse@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
> ---
>  arch/arm64/include/asm/cputype.h | 4 ++++
>  arch/arm64/kernel/cpu_errata.c   | 6 ++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
> index f0165df489a3..08241810cfea 100644
> --- a/arch/arm64/include/asm/cputype.h
> +++ b/arch/arm64/include/asm/cputype.h
> @@ -59,6 +59,7 @@
>  #define ARM_CPU_IMP_NVIDIA		0x4E
>  #define ARM_CPU_IMP_FUJITSU		0x46
>  #define ARM_CPU_IMP_HISI		0x48
> +#define ARM_CPU_IMP_AMPERE		0xC0
>  
>  #define ARM_CPU_PART_AEM_V8		0xD0F
>  #define ARM_CPU_PART_FOUNDATION		0xD00
> @@ -101,6 +102,8 @@
>  
>  #define HISI_CPU_PART_TSV110		0xD01
>  
> +#define AMPERE_CPU_PART_AMPERE1		0xAC3
> +
>  #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
>  #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
>  #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
> @@ -131,6 +134,7 @@
>  #define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
>  #define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)
>  #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
> +#define MIDR_AMPERE1 MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1)
>  
>  /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */
>  #define MIDR_FUJITSU_ERRATUM_010001		MIDR_FUJITSU_A64FX
> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index b18f307a3c59..342cba2ae982 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c
> @@ -1145,6 +1145,10 @@ u8 spectre_bhb_loop_affected(int scope)
>  			MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1),
>  			{},
>  		};
> +		static const struct midr_range spectre_bhb_k11_list[] = {
> +			MIDR_ALL_VERSIONS(MIDR_AMPERE1),
> +			{},
> +		};
>  		static const struct midr_range spectre_bhb_k8_list[] = {
>  			MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
>  			MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
> @@ -1155,6 +1159,8 @@ u8 spectre_bhb_loop_affected(int scope)
>  			k = 32;
>  		else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k24_list))
>  			k = 24;
> +		else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k11_list))
> +			k = 11;
>  		else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list))
>  			k =  8;
>  
> -- 
> 2.39.1
> 

Both now queued up, thanks.

greg k-h

      parent reply	other threads:[~2023-08-04 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  9:37 [PATCH 5.4 1/2] arm64: Add AMPERE1 to the Spectre-BHB affected list ovidiu.panait
2023-08-01  9:37 ` [PATCH 5.4 2/2] arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro ovidiu.panait
2023-08-04 10:24 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2023080406-wow-repeated-09d9@gregkh \
    --to=greg@kroah.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=ovidiu.panait@windriver.com \
    --cc=scott@os.amperecomputing.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox