]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/parisc-detect-qemu-earlier-in-boot-process.patch
Linux 4.14.112
[thirdparty/kernel/stable-queue.git] / queue-4.19 / parisc-detect-qemu-earlier-in-boot-process.patch
1 From d006e95b5561f708d0385e9677ffe2c46f2ae345 Mon Sep 17 00:00:00 2001
2 From: Helge Deller <deller@gmx.de>
3 Date: Tue, 2 Apr 2019 12:13:27 +0200
4 Subject: parisc: Detect QEMU earlier in boot process
5
6 From: Helge Deller <deller@gmx.de>
7
8 commit d006e95b5561f708d0385e9677ffe2c46f2ae345 upstream.
9
10 While adding LASI support to QEMU, I noticed that the QEMU detection in
11 the kernel happens much too late. For example, when a LASI chip is found
12 by the kernel, it registers the LASI LED driver as well. But when we
13 run on QEMU it makes sense to avoid spending unnecessary CPU cycles, so
14 we need to access the running_on_QEMU flag earlier than before.
15
16 This patch now makes the QEMU detection the fist task of the Linux
17 kernel by moving it to where the kernel enters the C-coding.
18
19 Fixes: 310d82784fb4 ("parisc: qemu idle sleep support")
20 Signed-off-by: Helge Deller <deller@gmx.de>
21 Cc: stable@vger.kernel.org # v4.14+
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 arch/parisc/kernel/process.c | 6 ------
26 arch/parisc/kernel/setup.c | 3 +++
27 2 files changed, 3 insertions(+), 6 deletions(-)
28
29 --- a/arch/parisc/kernel/process.c
30 +++ b/arch/parisc/kernel/process.c
31 @@ -210,12 +210,6 @@ void __cpuidle arch_cpu_idle(void)
32
33 static int __init parisc_idle_init(void)
34 {
35 - const char *marker;
36 -
37 - /* check QEMU/SeaBIOS marker in PAGE0 */
38 - marker = (char *) &PAGE0->pad0;
39 - running_on_qemu = (memcmp(marker, "SeaBIOS", 8) == 0);
40 -
41 if (!running_on_qemu)
42 cpu_idle_poll_ctrl(1);
43
44 --- a/arch/parisc/kernel/setup.c
45 +++ b/arch/parisc/kernel/setup.c
46 @@ -399,6 +399,9 @@ void __init start_parisc(void)
47 int ret, cpunum;
48 struct pdc_coproc_cfg coproc_cfg;
49
50 + /* check QEMU/SeaBIOS marker in PAGE0 */
51 + running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0);
52 +
53 cpunum = smp_processor_id();
54
55 init_cpu_topology();