public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pingfan Liu <kernelfans@gmail.com>
To: x86@kernel.org
Cc: Pingfan Liu <kernelfans@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Jordan Borgner <mail@jordan-borgner.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] x86/boot: push console_init forward
Date: Tue,  7 May 2019 14:01:00 +0800	[thread overview]
Message-ID: <1557208860-12846-2-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1557208860-12846-1-git-send-email-kernelfans@gmail.com>

At the very early boot stage, early console is badly needed. Push its
initialization as early as possible, just after stack is ready.

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Jordan Borgner <mail@jordan-borgner.de>
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/boot/compressed/early_serial_console.c | 7 +++++++
 arch/x86/boot/compressed/head_64.S              | 4 ++++
 arch/x86/boot/compressed/misc.c                 | 1 -
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
index 624e334..223954a 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -3,3 +3,10 @@
 int early_serial_base = -1;
 
 #include "../early_serial_console.c"
+
+void early_console_init(void *rmode)
+{
+	boot_params = rmode;
+	console_init();
+	debug_putstr("early console is ready\n");
+}
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index fafb75c..e4a25f9 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -323,6 +323,10 @@ ENTRY(startup_64)
 	subq	$1b, %rdi
 
 	call	adjust_got
+	pushq	%rsi
+	movq	%rsi, %rdi
+	call	early_console_init
+	popq	%rsi
 
 	/*
 	 * At this point we are in long mode with 4-level paging enabled,
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index cafc6aa..475a3c6 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -368,7 +368,6 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
 	lines = boot_params->screen_info.orig_video_lines;
 	cols = boot_params->screen_info.orig_video_cols;
 
-	console_init();
 	debug_putstr("early console in extract_kernel\n");
 
 	free_mem_ptr     = heap;	/* Heap */
-- 
2.7.4


  reply	other threads:[~2019-05-07  6:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07  6:00 [PATCH 1/2] x86/boot: move early_serial_base to .data section Pingfan Liu
2019-05-07  6:01 ` Pingfan Liu [this message]
2019-05-07  8:28 ` Ingo Molnar
2019-05-08  4:42   ` Pingfan Liu

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=1557208860-12846-2-git-send-email-kernelfans@gmail.com \
    --to=kernelfans@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@jordan-borgner.de \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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