From: Magnus Damm <magnus@valinux.co.jp>
To: fastboot@lists.osdl.org, linux-kernel@vger.kernel.org
Cc: Magnus Damm <magnus@valinux.co.jp>, ebiederm@xmission.com
Subject: [PATCH] Kexec: Remove order for x86_64
Date: Fri, 14 Apr 2006 11:49:13 +0900 (JST) [thread overview]
Message-ID: <20060414025017.15979.43301.sendpatchset@cherry.local> (raw)
Kexec: Remove order for x86_64
This patch converts the x86_64 specific kexec code to 0-order allocations.
Instead of having two contiguous pages at image->control_code_page we now
allocate two 0-order pages. One page is pointed to by image->control_code_page
and the other page is pointed to by the new member image->arch_private.
The main purpose of this modification is to simplify Xen porting work.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
---
The patch has been tested on x86_64. Apply on top of linux-2.6.17-rc1-git8.
arch/x86_64/kernel/machine_kexec.c | 33 ++++++++++++++++++++++-----------
include/asm-x86_64/kexec.h | 3 +--
include/linux/kexec.h | 1 +
3 files changed, 24 insertions(+), 13 deletions(-)
--- 0001/arch/x86_64/kernel/machine_kexec.c
+++ work/arch/x86_64/kernel/machine_kexec.c 2006-04-14 11:25:25.000000000 +0900
@@ -154,12 +154,20 @@ const extern unsigned long relocate_new_
int machine_kexec_prepare(struct kimage *image)
{
- unsigned long start_pgtable, control_code_buffer;
+ unsigned long start_pgtable, control_code;
+ struct page *page;
int result;
- /* Calculate the offsets */
- start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
- control_code_buffer = start_pgtable + PAGE_SIZE;
+ page = kimage_alloc_control_pages(image, 0);
+ if (!page) {
+ printk(KERN_ERR "Could not allocate start_pgtable\n");
+ return -ENOMEM;
+ }
+
+ image->arch_private = page;
+
+ control_code = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
+ start_pgtable = page_to_pfn(page) << PAGE_SHIFT;
/* Setup the identity mapped 64bit page table */
result = init_pgtable(image, start_pgtable);
@@ -167,7 +175,7 @@ int machine_kexec_prepare(struct kimage
return result;
/* Place the code in the reboot code buffer */
- memcpy(__va(control_code_buffer), relocate_new_kernel,
+ memcpy(__va(control_code), relocate_new_kernel,
relocate_new_kernel_size);
return 0;
@@ -185,17 +193,20 @@ void machine_kexec_cleanup(struct kimage
NORET_TYPE void machine_kexec(struct kimage *image)
{
unsigned long page_list;
- unsigned long control_code_buffer;
+ unsigned long control_code;
unsigned long start_pgtable;
+ struct page *page;
relocate_new_kernel_t rnk;
+ page = image->arch_private;
+ BUG_ON(!page);
+
/* Interrupts aren't acceptable while we reboot */
local_irq_disable();
- /* Calculate the offsets */
+ control_code = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
+ start_pgtable = page_to_pfn(page) << PAGE_SHIFT;
page_list = image->head;
- start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
- control_code_buffer = start_pgtable + PAGE_SIZE;
/* Set the low half of the page table to my identity mapped
* page table for kexec. Leave the high half pointing at the
@@ -226,6 +237,6 @@ NORET_TYPE void machine_kexec(struct kim
set_gdt(phys_to_virt(0),0);
set_idt(phys_to_virt(0),0);
/* now call it */
- rnk = (relocate_new_kernel_t) control_code_buffer;
- (*rnk)(page_list, control_code_buffer, image->start, start_pgtable);
+ rnk = (relocate_new_kernel_t) control_code;
+ (*rnk)(page_list, control_code, image->start, start_pgtable);
}
--- 0001/include/asm-x86_64/kexec.h
+++ work/include/asm-x86_64/kexec.h 2006-04-14 11:25:25.000000000 +0900
@@ -21,8 +21,7 @@
/* Maximum address we can use for the control pages */
#define KEXEC_CONTROL_MEMORY_LIMIT (0xFFFFFFFFFFUL)
-/* Allocate one page for the pdp and the second for the code */
-#define KEXEC_CONTROL_CODE_SIZE (4096UL + 4096UL)
+#define KEXEC_CONTROL_CODE_SIZE 4096
/* The native architecture */
#define KEXEC_ARCH KEXEC_ARCH_X86_64
--- 0001/include/linux/kexec.h
+++ work/include/linux/kexec.h 2006-04-14 11:25:25.000000000 +0900
@@ -68,6 +68,7 @@ struct kimage {
unsigned long start;
struct page *control_code_page;
+ void *arch_private;
unsigned long nr_segments;
struct kexec_segment segment[KEXEC_SEGMENT_MAX];
reply other threads:[~2006-04-14 2:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20060414025017.15979.43301.sendpatchset@cherry.local \
--to=magnus@valinux.co.jp \
--cc=ebiederm@xmission.com \
--cc=fastboot@lists.osdl.org \
--cc=linux-kernel@vger.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 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.