All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+kernel@armlinux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	kvmarm@lists.cs.columbia.edu,
	Christoffer Dall <christoffer.dall@linaro.org>
Subject: [PATCH 03/14] ARM: bugs: hook processor bug checking into SMP and suspend paths
Date: Wed, 16 May 2018 12:00:52 +0100	[thread overview]
Message-ID: <E1fIuAu-0003jr-Kc@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20180516105949.GJ16141@n2100.armlinux.org.uk>

Check for CPU bugs when secondary processors are being brought online,
and also when CPUs are resuming from a low power mode.  This gives an
opportunity to check that processor specific bug workarounds are
correctly enabled for all paths that a CPU re-enters the kernel.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 arch/arm/include/asm/bugs.h | 2 ++
 arch/arm/kernel/bugs.c      | 5 +++++
 arch/arm/kernel/smp.c       | 4 ++++
 arch/arm/kernel/suspend.c   | 2 ++
 4 files changed, 13 insertions(+)

diff --git a/arch/arm/include/asm/bugs.h b/arch/arm/include/asm/bugs.h
index ed122d294f3f..73a99c72a930 100644
--- a/arch/arm/include/asm/bugs.h
+++ b/arch/arm/include/asm/bugs.h
@@ -14,8 +14,10 @@ extern void check_writebuffer_bugs(void);
 
 #ifdef CONFIG_MMU
 extern void check_bugs(void);
+extern void check_other_bugs(void);
 #else
 #define check_bugs() do { } while (0)
+#define check_other_bugs() do { } while (0)
 #endif
 
 #endif
diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c
index 88024028bb70..16e7ba2a9cc4 100644
--- a/arch/arm/kernel/bugs.c
+++ b/arch/arm/kernel/bugs.c
@@ -3,7 +3,12 @@
 #include <asm/bugs.h>
 #include <asm/proc-fns.h>
 
+void check_other_bugs(void)
+{
+}
+
 void __init check_bugs(void)
 {
 	check_writebuffer_bugs();
+	check_other_bugs();
 }
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 2da087926ebe..5ad0b67b9e33 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -31,6 +31,7 @@
 #include <linux/irq_work.h>
 
 #include <linux/atomic.h>
+#include <asm/bugs.h>
 #include <asm/smp.h>
 #include <asm/cacheflush.h>
 #include <asm/cpu.h>
@@ -405,6 +406,9 @@ asmlinkage void secondary_start_kernel(void)
 	 * before we continue - which happens after __cpu_up returns.
 	 */
 	set_cpu_online(cpu, true);
+
+	check_other_bugs();
+
 	complete(&cpu_running);
 
 	local_irq_enable();
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index a40ebb7c0896..d08099269e35 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -3,6 +3,7 @@
 #include <linux/slab.h>
 #include <linux/mm_types.h>
 
+#include <asm/bugs.h>
 #include <asm/cacheflush.h>
 #include <asm/idmap.h>
 #include <asm/pgalloc.h>
@@ -36,6 +37,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
 		cpu_switch_mm(mm->pgd, mm);
 		local_flush_bp_all();
 		local_flush_tlb_all();
+		check_other_bugs();
 	}
 
 	return ret;
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/14] ARM: bugs: hook processor bug checking into SMP and suspend paths
Date: Wed, 16 May 2018 12:00:52 +0100	[thread overview]
Message-ID: <E1fIuAu-0003jr-Kc@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20180516105949.GJ16141@n2100.armlinux.org.uk>

Check for CPU bugs when secondary processors are being brought online,
and also when CPUs are resuming from a low power mode.  This gives an
opportunity to check that processor specific bug workarounds are
correctly enabled for all paths that a CPU re-enters the kernel.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 arch/arm/include/asm/bugs.h | 2 ++
 arch/arm/kernel/bugs.c      | 5 +++++
 arch/arm/kernel/smp.c       | 4 ++++
 arch/arm/kernel/suspend.c   | 2 ++
 4 files changed, 13 insertions(+)

diff --git a/arch/arm/include/asm/bugs.h b/arch/arm/include/asm/bugs.h
index ed122d294f3f..73a99c72a930 100644
--- a/arch/arm/include/asm/bugs.h
+++ b/arch/arm/include/asm/bugs.h
@@ -14,8 +14,10 @@ extern void check_writebuffer_bugs(void);
 
 #ifdef CONFIG_MMU
 extern void check_bugs(void);
+extern void check_other_bugs(void);
 #else
 #define check_bugs() do { } while (0)
+#define check_other_bugs() do { } while (0)
 #endif
 
 #endif
diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c
index 88024028bb70..16e7ba2a9cc4 100644
--- a/arch/arm/kernel/bugs.c
+++ b/arch/arm/kernel/bugs.c
@@ -3,7 +3,12 @@
 #include <asm/bugs.h>
 #include <asm/proc-fns.h>
 
+void check_other_bugs(void)
+{
+}
+
 void __init check_bugs(void)
 {
 	check_writebuffer_bugs();
+	check_other_bugs();
 }
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 2da087926ebe..5ad0b67b9e33 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -31,6 +31,7 @@
 #include <linux/irq_work.h>
 
 #include <linux/atomic.h>
+#include <asm/bugs.h>
 #include <asm/smp.h>
 #include <asm/cacheflush.h>
 #include <asm/cpu.h>
@@ -405,6 +406,9 @@ asmlinkage void secondary_start_kernel(void)
 	 * before we continue - which happens after __cpu_up returns.
 	 */
 	set_cpu_online(cpu, true);
+
+	check_other_bugs();
+
 	complete(&cpu_running);
 
 	local_irq_enable();
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index a40ebb7c0896..d08099269e35 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -3,6 +3,7 @@
 #include <linux/slab.h>
 #include <linux/mm_types.h>
 
+#include <asm/bugs.h>
 #include <asm/cacheflush.h>
 #include <asm/idmap.h>
 #include <asm/pgalloc.h>
@@ -36,6 +37,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
 		cpu_switch_mm(mm->pgd, mm);
 		local_flush_bp_all();
 		local_flush_tlb_all();
+		check_other_bugs();
 	}
 
 	return ret;
-- 
2.7.4

  parent reply	other threads:[~2018-05-16 11:00 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 10:59 [PATCH 0/14] ARM Spectre variant 2 fixes Russell King - ARM Linux
2018-05-16 10:59 ` Russell King - ARM Linux
2018-05-16 11:00 ` [PATCH 01/14] ARM: add CPU part numbers for Cortex A73, A75 and Brahma B15 Russell King
2018-05-16 11:00   ` Russell King
2018-05-16 16:19   ` Florian Fainelli
2018-05-16 16:19     ` Florian Fainelli
2018-05-16 11:00 ` [PATCH 02/14] ARM: bugs: prepare processor bug infrastructure Russell King
2018-05-16 11:00   ` Russell King
2018-05-16 16:21   ` Florian Fainelli
2018-05-16 16:21     ` Florian Fainelli
2018-05-16 11:00 ` Russell King [this message]
2018-05-16 11:00   ` [PATCH 03/14] ARM: bugs: hook processor bug checking into SMP and suspend paths Russell King
2018-05-16 16:23   ` Florian Fainelli
2018-05-16 16:23     ` Florian Fainelli
2018-05-19 10:13     ` Russell King - ARM Linux
2018-05-19 10:13       ` Russell King - ARM Linux
2018-05-16 11:00 ` [PATCH 04/14] ARM: bugs: add support for per-processor bug checking Russell King
2018-05-16 11:00   ` Russell King
2018-05-16 16:23   ` Florian Fainelli
2018-05-16 16:23     ` Florian Fainelli
2018-05-16 11:01 ` [PATCH 05/14] ARM: spectre: add Kconfig symbol for CPUs vulnerable to Spectre Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 16:24   ` Florian Fainelli
2018-05-16 16:24     ` Florian Fainelli
2018-05-16 11:01 ` [PATCH 06/14] ARM: spectre-v2: harden branch predictor on context switches Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 11:33   ` Vladimir Murzin
2018-05-16 11:33     ` Vladimir Murzin
2018-05-16 11:01 ` [PATCH 07/14] ARM: spectre-v2: add Cortex A8 and A15 validation of the IBE bit Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 16:33   ` Florian Fainelli
2018-05-16 16:33     ` Florian Fainelli
2018-05-16 16:34   ` Florian Fainelli
2018-05-16 16:34     ` Florian Fainelli
2018-05-22 10:38   ` Geert Uytterhoeven
2018-05-22 10:38     ` Geert Uytterhoeven
2018-05-22 10:55     ` Russell King - ARM Linux
2018-05-22 10:55       ` Russell King - ARM Linux
2018-05-16 11:01 ` [PATCH 08/14] ARM: spectre-v2: harden user aborts in kernel space Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 16:35   ` Florian Fainelli
2018-05-16 16:35     ` Florian Fainelli
2018-05-16 11:01 ` [PATCH 09/14] ARM: spectre-v2: add PSCI based hardening Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 17:01   ` Marc Zyngier
2018-05-16 17:01     ` Marc Zyngier
2018-05-16 11:01 ` [PATCH 10/14] ARM: KVM: invalidate BTB on guest exit for Cortex-A12/A17 Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 11:01 ` [PATCH 11/14] ARM: KVM: invalidate icache on guest exit for Cortex-A15 Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 11:01 ` [PATCH 12/14] ARM: spectre-v2: KVM: invalidate icache on guest exit for Brahma B15 Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 16:27   ` Florian Fainelli
2018-05-16 16:27     ` Florian Fainelli
2018-05-16 11:01 ` [PATCH 13/14] ARM: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling Russell King
2018-05-16 11:01   ` Russell King
2018-05-16 11:01 ` [PATCH 14/14] ARM: KVM: report support for SMCCC_ARCH_WORKAROUND_1 Russell King
2018-05-16 11:01   ` Russell King
2018-05-21 11:42 [PATCH v2 00/14] ARM Spectre variant 2 fixes Russell King - ARM Linux
2018-05-21 11:44 ` [PATCH 03/14] ARM: bugs: hook processor bug checking into SMP and suspend paths Russell King
2018-05-21 11:44   ` Russell King
2018-05-24 23:30   ` Florian Fainelli
2018-05-24 23:30     ` Florian Fainelli
2018-05-25 10:03     ` Russell King - ARM Linux
2018-05-25 10:03       ` Russell King - ARM Linux
2018-05-25 11:31       ` Russell King - ARM Linux
2018-05-25 11:31         ` Russell King - ARM Linux

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=E1fIuAu-0003jr-Kc@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=christoffer.dall@linaro.org \
    --cc=f.fainelli@gmail.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.