Skip to content

Commit

Permalink
parisc: Detect QEMU earlier in boot process
Browse files Browse the repository at this point in the history
commit d006e95 upstream.

While adding LASI support to QEMU, I noticed that the QEMU detection in
the kernel happens much too late. For example, when a LASI chip is found
by the kernel, it registers the LASI LED driver as well.  But when we
run on QEMU it makes sense to avoid spending unnecessary CPU cycles, so
we need to access the running_on_QEMU flag earlier than before.

This patch now makes the QEMU detection the fist task of the Linux
kernel by moving it to where the kernel enters the C-coding.

Fixes: 310d827 ("parisc: qemu idle sleep support")
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v4.14+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
hdeller authored and gregkh committed Apr 17, 2019
1 parent ba5765a commit 41cf811
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 0 additions & 6 deletions arch/parisc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@ void __cpuidle arch_cpu_idle(void)

static int __init parisc_idle_init(void)
{
const char *marker;

/* check QEMU/SeaBIOS marker in PAGE0 */
marker = (char *) &PAGE0->pad0;
running_on_qemu = (memcmp(marker, "SeaBIOS", 8) == 0);

if (!running_on_qemu)
cpu_idle_poll_ctrl(1);

Expand Down
3 changes: 3 additions & 0 deletions arch/parisc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ void __init start_parisc(void)
int ret, cpunum;
struct pdc_coproc_cfg coproc_cfg;

/* check QEMU/SeaBIOS marker in PAGE0 */
running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0);

cpunum = smp_processor_id();

init_cpu_topology();
Expand Down

0 comments on commit 41cf811

Please sign in to comment.