aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBernhard Walle <bwalle@suse.de>2007-10-21 19:42:01 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-22 11:13:19 -0400
commit00bf4098beb15ca174b54f3af1f1e1908d7d18a3 (patch)
tree611bacb1f855c86e8b6b210bffabfc3ab481b60e /arch
parentc03ab37cbe1db0ec9186d8de04dd3801c0af0fba (diff)
kexec: add BSS to resource tree
Add the BSS to the resource tree just as kernel text and kernel data are in the resource tree. The main reason behind this is to avoid crashkernel reservation in that area. While it's not strictly necessary to have the BSS in the resource tree (the actual collision detection is done in the reserve_bootmem() function before), the usage of the BSS resource should be presented to the user in /proc/iomem just as Kernel data and Kernel code. Note: The patch currently is only implemented for x86 and ia64 (because efi_initialize_iomem_resources() has the same signature on i386 and ia64). [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Bernhard Walle <bwalle@suse.de> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Vivek Goyal <vgoyal@in.ibm.com> Cc: <linux-arch@vger.kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/kernel/efi.c4
-rw-r--r--arch/ia64/kernel/setup.c14
-rw-r--r--arch/x86/kernel/e820_32.c18
-rw-r--r--arch/x86/kernel/e820_64.c3
-rw-r--r--arch/x86/kernel/efi_32.c4
-rw-r--r--arch/x86/kernel/setup_32.c4
-rw-r--r--arch/x86/kernel/setup_64.c9
7 files changed, 47 insertions, 9 deletions
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 8e4894b205e2..3f7ea13358e9 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1090,7 +1090,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1090 1090
1091void 1091void
1092efi_initialize_iomem_resources(struct resource *code_resource, 1092efi_initialize_iomem_resources(struct resource *code_resource,
1093 struct resource *data_resource) 1093 struct resource *data_resource,
1094 struct resource *bss_resource)
1094{ 1095{
1095 struct resource *res; 1096 struct resource *res;
1096 void *efi_map_start, *efi_map_end, *p; 1097 void *efi_map_start, *efi_map_end, *p;
@@ -1171,6 +1172,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1171 */ 1172 */
1172 insert_resource(res, code_resource); 1173 insert_resource(res, code_resource);
1173 insert_resource(res, data_resource); 1174 insert_resource(res, data_resource);
1175 insert_resource(res, bss_resource);
1174#ifdef CONFIG_KEXEC 1176#ifdef CONFIG_KEXEC
1175 insert_resource(res, &efi_memmap_res); 1177 insert_resource(res, &efi_memmap_res);
1176 insert_resource(res, &boot_param_res); 1178 insert_resource(res, &boot_param_res);
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index cbf67f1aa291..ae6c3c02e117 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -90,7 +90,12 @@ static struct resource code_resource = {
90 .name = "Kernel code", 90 .name = "Kernel code",
91 .flags = IORESOURCE_BUSY | IORESOURCE_MEM 91 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
92}; 92};
93extern char _text[], _end[], _etext[]; 93
94static struct resource bss_resource = {
95 .name = "Kernel bss",
96 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
97};
98extern char _text[], _end[], _etext[], _edata[], _bss[];
94 99
95unsigned long ia64_max_cacheline_size; 100unsigned long ia64_max_cacheline_size;
96 101
@@ -200,8 +205,11 @@ static int __init register_memory(void)
200 code_resource.start = ia64_tpa(_text); 205 code_resource.start = ia64_tpa(_text);
201 code_resource.end = ia64_tpa(_etext) - 1; 206 code_resource.end = ia64_tpa(_etext) - 1;
202 data_resource.start = ia64_tpa(_etext); 207 data_resource.start = ia64_tpa(_etext);
203 data_resource.end = ia64_tpa(_end) - 1; 208 data_resource.end = ia64_tpa(_edata) - 1;
204 efi_initialize_iomem_resources(&code_resource, &data_resource); 209 bss_resource.start = ia64_tpa(_bss);
210 bss_resource.end = ia64_tpa(_end) - 1;
211 efi_initialize_iomem_resources(&code_resource, &data_resource,
212 &bss_resource);
205 213
206 return 0; 214 return 0;
207} 215}
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
index 58fd54eb5577..18f500d185a2 100644
--- a/arch/x86/kernel/e820_32.c
+++ b/arch/x86/kernel/e820_32.c
@@ -51,6 +51,13 @@ struct resource code_resource = {
51 .flags = IORESOURCE_BUSY | IORESOURCE_MEM 51 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
52}; 52};
53 53
54struct resource bss_resource = {
55 .name = "Kernel bss",
56 .start = 0,
57 .end = 0,
58 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
59};
60
54static struct resource system_rom_resource = { 61static struct resource system_rom_resource = {
55 .name = "System ROM", 62 .name = "System ROM",
56 .start = 0xf0000, 63 .start = 0xf0000,
@@ -254,7 +261,9 @@ static void __init probe_roms(void)
254 * and also for regions reported as reserved by the e820. 261 * and also for regions reported as reserved by the e820.
255 */ 262 */
256static void __init 263static void __init
257legacy_init_iomem_resources(struct resource *code_resource, struct resource *data_resource) 264legacy_init_iomem_resources(struct resource *code_resource,
265 struct resource *data_resource,
266 struct resource *bss_resource)
258{ 267{
259 int i; 268 int i;
260 269
@@ -287,6 +296,7 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
287 */ 296 */
288 request_resource(res, code_resource); 297 request_resource(res, code_resource);
289 request_resource(res, data_resource); 298 request_resource(res, data_resource);
299 request_resource(res, bss_resource);
290#ifdef CONFIG_KEXEC 300#ifdef CONFIG_KEXEC
291 if (crashk_res.start != crashk_res.end) 301 if (crashk_res.start != crashk_res.end)
292 request_resource(res, &crashk_res); 302 request_resource(res, &crashk_res);
@@ -307,9 +317,11 @@ static int __init request_standard_resources(void)
307 317
308 printk("Setting up standard PCI resources\n"); 318 printk("Setting up standard PCI resources\n");
309 if (efi_enabled) 319 if (efi_enabled)
310 efi_initialize_iomem_resources(&code_resource, &data_resource); 320 efi_initialize_iomem_resources(&code_resource,
321 &data_resource, &bss_resource);
311 else 322 else
312 legacy_init_iomem_resources(&code_resource, &data_resource); 323 legacy_init_iomem_resources(&code_resource,
324 &data_resource, &bss_resource);
313 325
314 /* EFI systems may still have VGA */ 326 /* EFI systems may still have VGA */
315 request_resource(&iomem_resource, &video_ram_resource); 327 request_resource(&iomem_resource, &video_ram_resource);
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 1ca228b06a20..04698e0b056c 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -47,7 +47,7 @@ unsigned long end_pfn_map;
47 */ 47 */
48static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; 48static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT;
49 49
50extern struct resource code_resource, data_resource; 50extern struct resource code_resource, data_resource, bss_resource;
51 51
52/* Check for some hardcoded bad areas that early boot is not allowed to touch */ 52/* Check for some hardcoded bad areas that early boot is not allowed to touch */
53static inline int bad_addr(unsigned long *addrp, unsigned long size) 53static inline int bad_addr(unsigned long *addrp, unsigned long size)
@@ -225,6 +225,7 @@ void __init e820_reserve_resources(void)
225 */ 225 */
226 request_resource(res, &code_resource); 226 request_resource(res, &code_resource);
227 request_resource(res, &data_resource); 227 request_resource(res, &data_resource);
228 request_resource(res, &bss_resource);
228#ifdef CONFIG_KEXEC 229#ifdef CONFIG_KEXEC
229 if (crashk_res.start != crashk_res.end) 230 if (crashk_res.start != crashk_res.end)
230 request_resource(res, &crashk_res); 231 request_resource(res, &crashk_res);
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index b42558c48e9d..e2be78f49399 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -603,7 +603,8 @@ void __init efi_enter_virtual_mode(void)
603 603
604void __init 604void __init
605efi_initialize_iomem_resources(struct resource *code_resource, 605efi_initialize_iomem_resources(struct resource *code_resource,
606 struct resource *data_resource) 606 struct resource *data_resource,
607 struct resource *bss_resource)
607{ 608{
608 struct resource *res; 609 struct resource *res;
609 efi_memory_desc_t *md; 610 efi_memory_desc_t *md;
@@ -675,6 +676,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
675 if (md->type == EFI_CONVENTIONAL_MEMORY) { 676 if (md->type == EFI_CONVENTIONAL_MEMORY) {
676 request_resource(res, code_resource); 677 request_resource(res, code_resource);
677 request_resource(res, data_resource); 678 request_resource(res, data_resource);
679 request_resource(res, bss_resource);
678#ifdef CONFIG_KEXEC 680#ifdef CONFIG_KEXEC
679 request_resource(res, &crashk_res); 681 request_resource(res, &crashk_res);
680#endif 682#endif
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index ba2e165a8a0f..cc0e91447b76 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -60,6 +60,7 @@
60#include <asm/vmi.h> 60#include <asm/vmi.h>
61#include <setup_arch.h> 61#include <setup_arch.h>
62#include <bios_ebda.h> 62#include <bios_ebda.h>
63#include <asm/cacheflush.h>
63 64
64/* This value is set up by the early boot code to point to the value 65/* This value is set up by the early boot code to point to the value
65 immediately after the boot time page tables. It contains a *physical* 66 immediately after the boot time page tables. It contains a *physical*
@@ -73,6 +74,7 @@ int disable_pse __devinitdata = 0;
73 */ 74 */
74extern struct resource code_resource; 75extern struct resource code_resource;
75extern struct resource data_resource; 76extern struct resource data_resource;
77extern struct resource bss_resource;
76 78
77/* cpu data as detected by the assembly code in head.S */ 79/* cpu data as detected by the assembly code in head.S */
78struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; 80struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
@@ -600,6 +602,8 @@ void __init setup_arch(char **cmdline_p)
600 code_resource.end = virt_to_phys(_etext)-1; 602 code_resource.end = virt_to_phys(_etext)-1;
601 data_resource.start = virt_to_phys(_etext); 603 data_resource.start = virt_to_phys(_etext);
602 data_resource.end = virt_to_phys(_edata)-1; 604 data_resource.end = virt_to_phys(_edata)-1;
605 bss_resource.start = virt_to_phys(&__bss_start);
606 bss_resource.end = virt_to_phys(&__bss_stop)-1;
603 607
604 parse_early_param(); 608 parse_early_param();
605 609
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 31322d42eaae..e7a9e36bd52d 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -58,6 +58,7 @@
58#include <asm/numa.h> 58#include <asm/numa.h>
59#include <asm/sections.h> 59#include <asm/sections.h>
60#include <asm/dmi.h> 60#include <asm/dmi.h>
61#include <asm/cacheflush.h>
61 62
62/* 63/*
63 * Machine setup.. 64 * Machine setup..
@@ -133,6 +134,12 @@ struct resource code_resource = {
133 .end = 0, 134 .end = 0,
134 .flags = IORESOURCE_RAM, 135 .flags = IORESOURCE_RAM,
135}; 136};
137struct resource bss_resource = {
138 .name = "Kernel bss",
139 .start = 0,
140 .end = 0,
141 .flags = IORESOURCE_RAM,
142};
136 143
137#ifdef CONFIG_PROC_VMCORE 144#ifdef CONFIG_PROC_VMCORE
138/* elfcorehdr= specifies the location of elf core header 145/* elfcorehdr= specifies the location of elf core header
@@ -276,6 +283,8 @@ void __init setup_arch(char **cmdline_p)
276 code_resource.end = virt_to_phys(&_etext)-1; 283 code_resource.end = virt_to_phys(&_etext)-1;
277 data_resource.start = virt_to_phys(&_etext); 284 data_resource.start = virt_to_phys(&_etext);
278 data_resource.end = virt_to_phys(&_edata)-1; 285 data_resource.end = virt_to_phys(&_edata)-1;
286 bss_resource.start = virt_to_phys(&__bss_start);
287 bss_resource.end = virt_to_phys(&__bss_stop)-1;
279 288
280 early_identify_cpu(&boot_cpu_data); 289 early_identify_cpu(&boot_cpu_data);
281 290