From: Bernhard Walle <bwalle@suse.de>
To: kexec@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-ia64@vger.kernel.org
Subject: [patch 4/7] Use extended crashkernel command line on ia64
Date: Thu, 13 Sep 2007 18:14:32 +0200 [thread overview]
Message-ID: <20070913161429.709200229@strauss.suse.de> (raw)
In-Reply-To: 20070913161428.343951643@strauss.suse.de
[-- Attachment #1: crashkernel-ia64 --]
[-- Type: text/plain, Size: 4974 bytes --]
This patch adapts IA64 to use the generic parse_crashkernel() function
instead of its own parsing for the crashkernel command line.
Because the total amount of System RAM must be known when calling this
function, efi_memmap_init() is modified to return its accumulated total_memory
variable.
Also, the crashkernel handling is moved in an own function in
arch/ia64/kernel/setup.c to make the code more readable.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
arch/ia64/kernel/efi.c | 4 +-
arch/ia64/kernel/setup.c | 88 +++++++++++++++++++++++----------------------
include/asm-ia64/meminit.h | 2 -
3 files changed, 50 insertions(+), 44 deletions(-)
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -967,7 +967,7 @@ find_memmap_space (void)
* to use. We can allocate partial granules only if the unavailable
* parts exist, and are WB.
*/
-void
+unsigned long
efi_memmap_init(unsigned long *s, unsigned long *e)
{
struct kern_memdesc *k, *prev = NULL;
@@ -1084,6 +1084,8 @@ efi_memmap_init(unsigned long *s, unsign
/* reserve the memory we are using for kern_memmap */
*s = (u64)kern_memmap;
*e = (u64)++k;
+
+ return total_memory;
}
void
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -208,6 +208,48 @@ static int __init register_memory(void)
__initcall(register_memory);
+
+#ifdef CONFIG_KEXEC
+static void setup_crashkernel(unsigned long total, int *n)
+{
+ unsigned long long base = 0, size = 0;
+ int ret;
+
+ ret = parse_crashkernel(boot_command_line, total,
+ &size, &base);
+ if (ret == 0 && size > 0) {
+ if (!base) {
+ sort_regions(rsvd_region, *n);
+ base = kdump_find_rsvd_region(size,
+ rsvd_region, *n);
+ }
+ if (base != ~0UL) {
+ printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
+ "for crashkernel (System RAM: %ldMB)\n",
+ (unsigned long)(size >> 20),
+ (unsigned long)(base >> 20),
+ (unsigned long)(total >> 20));
+ rsvd_region[*n].start =
+ (unsigned long)__va(base);
+ rsvd_region[*n].end =
+ (unsigned long)__va(base + size);
+ (*n)++;
+ crashk_res.start = base;
+ crashk_res.end = base + size - 1;
+ }
+ }
+ efi_memmap_res.start = ia64_boot_param->efi_memmap;
+ efi_memmap_res.end = efi_memmap_res.start +
+ ia64_boot_param->efi_memmap_size;
+ boot_param_res.start = __pa(ia64_boot_param);
+ boot_param_res.end = boot_param_res.start +
+ sizeof(*ia64_boot_param);
+}
+#else
+static inline void setup_crashkernel(unsigned long total, int *n)
+{}
+#endif
+
/**
* reserve_memory - setup reserved memory areas
*
@@ -219,6 +261,7 @@ void __init
reserve_memory (void)
{
int n = 0;
+ unsigned long total_memory = 0;
/*
* none of the entries in this table overlap
@@ -254,50 +297,11 @@ reserve_memory (void)
n++;
#endif
- efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
+ total_memory = efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
n++;
-#ifdef CONFIG_KEXEC
- /* crashkernel=size@offset specifies the size to reserve for a crash
- * kernel. If offset is 0, then it is determined automatically.
- * By reserving this memory we guarantee that linux never set's it
- * up as a DMA target.Useful for holding code to do something
- * appropriate after a kernel panic.
- */
- {
- char *from = strstr(boot_command_line, "crashkernel=");
- unsigned long base, size;
- if (from) {
- size = memparse(from + 12, &from);
- if (*from == '@')
- base = memparse(from+1, &from);
- else
- base = 0;
- if (size) {
- if (!base) {
- sort_regions(rsvd_region, n);
- base = kdump_find_rsvd_region(size,
- rsvd_region, n);
- }
- if (base != ~0UL) {
- rsvd_region[n].start =
- (unsigned long)__va(base);
- rsvd_region[n].end =
- (unsigned long)__va(base + size);
- n++;
- crashk_res.start = base;
- crashk_res.end = base + size - 1;
- }
- }
- }
- efi_memmap_res.start = ia64_boot_param->efi_memmap;
- efi_memmap_res.end = efi_memmap_res.start +
- ia64_boot_param->efi_memmap_size;
- boot_param_res.start = __pa(ia64_boot_param);
- boot_param_res.end = boot_param_res.start +
- sizeof(*ia64_boot_param);
- }
-#endif
+ setup_crashkernel(total_memory, &n);
+
/* end of memory marker */
rsvd_region[n].start = ~0UL;
rsvd_region[n].end = ~0UL;
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -35,7 +35,7 @@ extern void find_memory (void);
extern void reserve_memory (void);
extern void find_initrd (void);
extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
-extern void efi_memmap_init(unsigned long *, unsigned long *);
+extern unsigned long efi_memmap_init(unsigned long *s, unsigned long *e);
extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
extern unsigned long vmcore_find_descriptor_size(unsigned long address);
--
next prev parent reply other threads:[~2007-09-13 16:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-13 16:14 [patch 0/7] Add extended crashkernel command line syntax Bernhard Walle
2007-09-13 16:14 ` [patch 1/7] Extended crashkernel command line Bernhard Walle
2007-09-19 22:32 ` Andrew Morton
2007-09-13 16:14 ` [patch 2/7] Use extended crashkernel command line on i386 Bernhard Walle
2007-09-18 4:36 ` Vivek Goyal
2007-09-13 16:14 ` [patch 3/7] Use extended crashkernel command line on x86_64 Bernhard Walle
2007-09-19 22:33 ` Andrew Morton
2007-09-20 17:19 ` Bernhard Walle
2007-09-13 16:14 ` Bernhard Walle [this message]
2007-09-13 16:14 ` [patch 5/7] Use extended crashkernel command line on ppc64 Bernhard Walle
2007-09-13 16:14 ` [patch 6/7] Use extended crashkernel command line on sh Bernhard Walle
2007-09-14 3:30 ` Paul Mundt
2007-09-13 16:14 ` [patch 7/7] Add documentation for extended crashkernel syntax Bernhard Walle
2007-09-18 17:21 ` Pavel Machek
2007-09-22 7:06 ` Bernhard Walle
-- strict thread matches above, loose matches on Subject: below --
2007-09-20 17:18 [patch 0/7] Add extended crashkernel command line syntax Bernhard Walle
2007-09-20 17:18 ` [patch 4/7] Use extended crashkernel command line on ia64 Bernhard Walle
2007-09-25 18:22 [patch 0/7] Add extended crashkernel command line syntax Bernhard Walle
2007-09-25 18:23 ` [patch 4/7] Use extended crashkernel command line on ia64 Bernhard Walle
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=20070913161429.709200229@strauss.suse.de \
--to=bwalle@suse.de \
--cc=kexec@lists.infradead.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-ia64@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).