From: Yinghai Lu <yinghai@kernel.org>
To: Simon Horman <horms@verge.net.au>,
"H. Peter Anvin" <hpa@zytor.com>, Vivek Goyal <vgoyal@redhat.com>,
"Eric W. Biederman" <ebiederm@xmission.com>
Cc: Yinghai Lu <yinghai@kernel.org>, kexec@lists.infradead.org
Subject: [PATCH v8 5/7] kexec, x86: put ramdisk/cmd_line above 4G for 64bit bzImage
Date: Wed, 30 Jan 2013 13:25:18 -0800 [thread overview]
Message-ID: <1359581120-24397-6-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1359581120-24397-1-git-send-email-yinghai@kernel.org>
We could put ramdisk/cmdline above for bzImage on 64bit for protocol 2.12.
-v2: change ext_... handling to way that eric like.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
kexec/arch/i386/x86-linux-setup.c | 36 +++++++++++++++++++++++++++---------
kexec/arch/i386/x86-linux-setup.h | 15 +++++++++++++--
2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index d09c6ce..e0ddc84 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -46,11 +46,11 @@ void init_linux_parameters(struct x86_linux_param_header *real_mode)
real_mode->cmdline_size = COMMAND_LINE_SIZE;
}
-void setup_linux_bootloader_parameters(
+void setup_linux_bootloader_parameters_high(
struct kexec_info *info, struct x86_linux_param_header *real_mode,
unsigned long real_mode_base, unsigned long cmdline_offset,
const char *cmdline, off_t cmdline_len,
- const char *initrd_buf, off_t initrd_size)
+ const char *initrd_buf, off_t initrd_size, int initrd_high)
{
char *cmdline_ptr;
unsigned long initrd_base, initrd_addr_max;
@@ -62,10 +62,15 @@ void setup_linux_bootloader_parameters(
real_mode->loader_flags = 0;
/* Find the maximum initial ramdisk address */
- initrd_addr_max = DEFAULT_INITRD_ADDR_MAX;
- if (real_mode->protocol_version >= 0x0203) {
- initrd_addr_max = real_mode->initrd_addr_max;
- dbgprintf("initrd_addr_max is 0x%lx\n", initrd_addr_max);
+ if (initrd_high)
+ initrd_addr_max = ULONG_MAX;
+ else {
+ initrd_addr_max = DEFAULT_INITRD_ADDR_MAX;
+ if (real_mode->protocol_version >= 0x0203) {
+ initrd_addr_max = real_mode->initrd_addr_max;
+ dbgprintf("initrd_addr_max is 0x%lx\n",
+ initrd_addr_max);
+ }
}
/* Load the initrd if we have one */
@@ -81,8 +86,16 @@ void setup_linux_bootloader_parameters(
}
/* Ramdisk address and size */
- real_mode->initrd_start = initrd_base;
- real_mode->initrd_size = initrd_size;
+ real_mode->initrd_start = initrd_base & 0xffffffffUL;
+ real_mode->initrd_size = initrd_size & 0xffffffffUL;
+
+ if (real_mode->protocol_version >= 0x020c &&
+ (initrd_base & 0xffffffffUL) != initrd_base)
+ real_mode->ext_ramdisk_image = initrd_base >> 32;
+
+ if (real_mode->protocol_version >= 0x020c &&
+ (initrd_size & 0xffffffffUL) != initrd_size)
+ real_mode->ext_ramdisk_size = initrd_size >> 32;
/* The location of the command line */
/* if (real_mode_base == 0x90000) { */
@@ -91,7 +104,12 @@ void setup_linux_bootloader_parameters(
/* setup_move_size */
/* } */
if (real_mode->protocol_version >= 0x0202) {
- real_mode->cmd_line_ptr = real_mode_base + cmdline_offset;
+ unsigned long cmd_line_ptr = real_mode_base + cmdline_offset;
+
+ real_mode->cmd_line_ptr = cmd_line_ptr & 0xffffffffUL;
+ if ((real_mode->protocol_version >= 0x020c) &&
+ ((cmd_line_ptr & 0xffffffffUL) != cmd_line_ptr))
+ real_mode->ext_cmd_line_ptr = cmd_line_ptr >> 32;
}
/* Fill in the command line */
diff --git a/kexec/arch/i386/x86-linux-setup.h b/kexec/arch/i386/x86-linux-setup.h
index 96fbd33..09aed4d 100644
--- a/kexec/arch/i386/x86-linux-setup.h
+++ b/kexec/arch/i386/x86-linux-setup.h
@@ -2,11 +2,22 @@
#define X86_LINUX_SETUP_H
void init_linux_parameters(struct x86_linux_param_header *real_mode);
-void setup_linux_bootloader_parameters(
+void setup_linux_bootloader_parameters_high(
struct kexec_info *info, struct x86_linux_param_header *real_mode,
unsigned long real_mode_base, unsigned long cmdline_offset,
const char *cmdline, off_t cmdline_len,
- const char *initrd_buf, off_t initrd_size);
+ const char *initrd_buf, off_t initrd_size, int initrd_high);
+static inline void setup_linux_bootloader_parameters(
+ struct kexec_info *info, struct x86_linux_param_header *real_mode,
+ unsigned long real_mode_base, unsigned long cmdline_offset,
+ const char *cmdline, off_t cmdline_len,
+ const char *initrd_buf, off_t initrd_size)
+{
+ setup_linux_bootloader_parameters_high(info,
+ real_mode, real_mode_base,
+ cmdline_offset, cmdline, cmdline_len,
+ initrd_buf, initrd_size, 0);
+}
void setup_linux_system_parameters(struct kexec_info *info,
struct x86_linux_param_header *real_mode);
--
1.7.10.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-01-30 21:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 21:25 [PATCH v8 0/7] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 1/7] kexec, x86: set booloader id in setup_header Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 2/7] kexec, x86: add boot header member for version 2.12 Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 3/7] kexec, x86: clean boot_params area for entry-32bit path Yinghai Lu
2013-01-30 21:34 ` H. Peter Anvin
2013-01-30 22:09 ` Yinghai Lu
2013-01-30 22:11 ` H. Peter Anvin
2013-01-30 21:25 ` [PATCH v8 4/7] kexec, x86: Fix bzImage real-mode booting Yinghai Lu
2013-01-30 21:25 ` Yinghai Lu [this message]
2013-01-30 21:25 ` [PATCH v8 6/7] kexec, x86_64: Load bzImage64 above 4G Yinghai Lu
2013-01-30 21:25 ` [PATCH v8 7/7] kexec, x86: handle Crash low kernel range Yinghai Lu
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=1359581120-24397-6-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=ebiederm@xmission.com \
--cc=horms@verge.net.au \
--cc=hpa@zytor.com \
--cc=kexec@lists.infradead.org \
--cc=vgoyal@redhat.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