stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Long <dave.long@linaro.org>
To: stable@vger.kernel.org,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Mark Rutland <mark.rutland@arm.com>
Cc: Greg KH <gregkh@linuxfoundation.org>, Mark Brown <broonie@kernel.org>
Subject: [PATCH 4.9 V2 04/24] ARM: bugs: add support for per-processor bug checking
Date: Wed,  7 Nov 2018 11:43:42 -0500	[thread overview]
Message-ID: <20181107164402.9380-5-dave.long@linaro.org> (raw)
In-Reply-To: <20181107164402.9380-1-dave.long@linaro.org>

From: Russell King <rmk+kernel@armlinux.org.uk>

Commit 9d3a04925deeabb97c8e26d940b501a2873e8af3 upstream.

Add support for per-processor bug checking - each processor function
descriptor gains a function pointer for this check, which must not be
an __init function.  If non-NULL, this will be called whenever a CPU
enters the kernel via which ever path (boot CPU, secondary CPU startup,
CPU resuming, etc.)

This allows processor specific bug checks to validate that workaround
bits are properly enabled by firmware via all entry paths to the kernel.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Boot-tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: David A. Long <dave.long@linaro.org>
---
 arch/arm/include/asm/proc-fns.h | 4 ++++
 arch/arm/kernel/bugs.c          | 4 ++++
 arch/arm/mm/proc-macros.S       | 3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
index 8877ad5ffe10..f379f5f849a9 100644
--- a/arch/arm/include/asm/proc-fns.h
+++ b/arch/arm/include/asm/proc-fns.h
@@ -36,6 +36,10 @@ extern struct processor {
 	 * Set up any processor specifics
 	 */
 	void (*_proc_init)(void);
+	/*
+	 * Check for processor bugs
+	 */
+	void (*check_bugs)(void);
 	/*
 	 * Disable any processor specifics
 	 */
diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c
index 16e7ba2a9cc4..7be511310191 100644
--- a/arch/arm/kernel/bugs.c
+++ b/arch/arm/kernel/bugs.c
@@ -5,6 +5,10 @@
 
 void check_other_bugs(void)
 {
+#ifdef MULTI_CPU
+	if (processor.check_bugs)
+		processor.check_bugs();
+#endif
 }
 
 void __init check_bugs(void)
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 0d40c285bd86..7d9176c4a21d 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -274,13 +274,14 @@
 	mcr	p15, 0, ip, c7, c10, 4		@ data write barrier
 	.endm
 
-.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0
+.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0
 	.type	\name\()_processor_functions, #object
 	.align 2
 ENTRY(\name\()_processor_functions)
 	.word	\dabort
 	.word	\pabort
 	.word	cpu_\name\()_proc_init
+	.word	\bugs
 	.word	cpu_\name\()_proc_fin
 	.word	cpu_\name\()_reset
 	.word	cpu_\name\()_do_idle
-- 
2.17.1

  parent reply	other threads:[~2018-11-08  2:15 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 16:43 [PATCH 4.9 V2 00/24] V4.9 backport of 32-bit arm spectre patches David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 01/24] ARM: add more CPU part numbers for Cortex and Brahma B15 CPUs David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 02/24] ARM: bugs: prepare processor bug infrastructure David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 03/24] ARM: bugs: hook processor bug checking into SMP and suspend paths David Long
2018-11-07 16:43 ` David Long [this message]
2018-11-07 16:43 ` [PATCH 4.9 V2 05/24] ARM: spectre: add Kconfig symbol for CPUs vulnerable to Spectre David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 06/24] ARM: spectre-v2: harden branch predictor on context switches David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 07/24] ARM: spectre-v2: add Cortex A8 and A15 validation of the IBE bit David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 08/24] ARM: spectre-v2: harden user aborts in kernel space David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 09/24] ARM: spectre-v2: add firmware based hardening David Long
2018-11-12 16:54   ` Russell King - ARM Linux
2018-11-13 14:23     ` Marc Zyngier
2018-11-13 15:16       ` David Long
2018-11-13 17:36         ` Marc Zyngier
2018-11-13 17:54           ` Russell King - ARM Linux
2018-11-13 16:43       ` Tony Lindgren
2018-11-13 18:08       ` Florian Fainelli
2018-11-20 10:59         ` Russell King - ARM Linux
2018-11-20 11:15           ` Greg KH
2018-11-20 15:30             ` David Long
2018-11-20 16:42               ` Marc Zyngier
2018-11-20 16:24           ` David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 10/24] ARM: spectre-v2: warn about incorrect context switching functions David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 11/24] ARM: KVM: invalidate BTB on guest exit for Cortex-A12/A17 David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 12/24] ARM: KVM: invalidate icache on guest exit for Cortex-A15 David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 13/24] ARM: spectre-v2: KVM: invalidate icache on guest exit for Brahma B15 David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 14/24] ARM: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 15/24] ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 16/24] ARM: spectre-v1: add speculation barrier (csdb) macros David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 17/24] ARM: spectre-v1: add array_index_mask_nospec() implementation David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 18/24] ARM: spectre-v1: fix syscall entry David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 19/24] ARM: signal: copy registers using __copy_from_user() David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 20/24] ARM: vfp: use __copy_from_user() when restoring VFP state David Long
2018-11-07 16:43 ` [PATCH 4.9 V2 21/24] ARM: oabi-compat: copy semops using __copy_from_user() David Long
2018-11-07 16:44 ` [PATCH 4.9 V2 22/24] ARM: use __inttype() in get_user() David Long
2018-11-07 16:44 ` [PATCH 4.9 V2 23/24] ARM: spectre-v1: use get_user() for __get_user() David Long
2018-11-07 16:44 ` [PATCH 4.9 V2 24/24] ARM: spectre-v1: mitigate user accesses David Long
2018-11-12 15:27 ` [PATCH 4.9 V2 00/24] V4.9 backport of 32-bit arm spectre patches Russell King - ARM Linux
2018-11-21 18:27 ` Greg KH
2018-11-21 19:13   ` David Long

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=20181107164402.9380-5-dave.long@linaro.org \
    --to=dave.long@linaro.org \
    --cc=broonie@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux@armlinux.org.uk \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.com \
    /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;
as well as URLs for NNTP newsgroup(s).