aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 16:27:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 16:27:50 -0500
commit3e01dfce1387f8bec41018f0d7b42fd88ad4163f (patch)
tree88223ad43e3afe6e0ebdec1f636a2d04975fdf9d
parent45f37e86f1ef95f002386d8a0ab508407cec9bf3 (diff)
parentd987402695f16ae33999d7315b915099d64616d4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86: x86: avoid section mismatch involving arch_register_cpu x86: fixes for lookup_address args x86: fix sparse warnings in cpu/common.c x86: make early_console static in early_printk.c x86: remove unneeded round_up x86: fix section mismatch warning in kernel/pci-calgary x86: fix section mismatch warning in acpi/boot.c x86: fix section mismatch warnings when referencing notifiers x86: silence section mismatch warning in smpboot_64.c x86: fix comments in vmlinux_64.lds x86_64: make bootmap_start page align v6 x86_64: add debug name for early_res
-rw-r--r--arch/x86/boot/compressed/vmlinux_64.lds2
-rw-r--r--arch/x86/kernel/acpi/boot.c8
-rw-r--r--arch/x86/kernel/cpu/common.c20
-rw-r--r--arch/x86/kernel/cpuid.c2
-rw-r--r--arch/x86/kernel/e820_64.c23
-rw-r--r--arch/x86/kernel/early_printk.c2
-rw-r--r--arch/x86/kernel/efi_64.c2
-rw-r--r--arch/x86/kernel/head64.c6
-rw-r--r--arch/x86/kernel/microcode.c2
-rw-r--r--arch/x86/kernel/msr.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c4
-rw-r--r--arch/x86/kernel/setup_64.c3
-rw-r--r--arch/x86/kernel/smpboot_64.c2
-rw-r--r--arch/x86/kernel/topology.c3
-rw-r--r--arch/x86/mm/fault.c2
-rw-r--r--arch/x86/mm/init_64.c13
-rw-r--r--arch/x86/mm/ioremap.c3
-rw-r--r--arch/x86/mm/numa_64.c34
-rw-r--r--arch/x86/mm/pageattr-test.c4
-rw-r--r--include/asm-x86/cpu.h3
-rw-r--r--include/asm-x86/e820_64.h4
21 files changed, 79 insertions, 65 deletions
diff --git a/arch/x86/boot/compressed/vmlinux_64.lds b/arch/x86/boot/compressed/vmlinux_64.lds
index f6e5b445f457..7e5c7209f6cc 100644
--- a/arch/x86/boot/compressed/vmlinux_64.lds
+++ b/arch/x86/boot/compressed/vmlinux_64.lds
@@ -3,7 +3,7 @@ OUTPUT_ARCH(i386:x86-64)
3ENTRY(startup_64) 3ENTRY(startup_64)
4SECTIONS 4SECTIONS
5{ 5{
6 /* Be careful parts of head_64.S assume startup_64 is at 6 /* Be careful parts of head_64.S assume startup_32 is at
7 * address 0. 7 * address 0.
8 */ 8 */
9 . = 0; 9 . = 0;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 0ca27c7b0e8d..d2a58431a074 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -496,7 +496,8 @@ EXPORT_SYMBOL(acpi_register_gsi);
496 * ACPI based hotplug support for CPU 496 * ACPI based hotplug support for CPU
497 */ 497 */
498#ifdef CONFIG_ACPI_HOTPLUG_CPU 498#ifdef CONFIG_ACPI_HOTPLUG_CPU
499int acpi_map_lsapic(acpi_handle handle, int *pcpu) 499
500static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
500{ 501{
501 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 502 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
502 union acpi_object *obj; 503 union acpi_object *obj;
@@ -551,6 +552,11 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
551 return 0; 552 return 0;
552} 553}
553 554
555/* wrapper to silence section mismatch warning */
556int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu)
557{
558 return _acpi_map_lsapic(handle, pcpu);
559}
554EXPORT_SYMBOL(acpi_map_lsapic); 560EXPORT_SYMBOL(acpi_map_lsapic);
555 561
556int acpi_unmap_lsapic(int cpu) 562int acpi_unmap_lsapic(int cpu)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d608c9ebbfe2..b7b2142b58e7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -258,10 +258,10 @@ static int __cpuinit have_cpuid_p(void)
258void __init cpu_detect(struct cpuinfo_x86 *c) 258void __init cpu_detect(struct cpuinfo_x86 *c)
259{ 259{
260 /* Get vendor name */ 260 /* Get vendor name */
261 cpuid(0x00000000, &c->cpuid_level, 261 cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
262 (int *)&c->x86_vendor_id[0], 262 (unsigned int *)&c->x86_vendor_id[0],
263 (int *)&c->x86_vendor_id[8], 263 (unsigned int *)&c->x86_vendor_id[8],
264 (int *)&c->x86_vendor_id[4]); 264 (unsigned int *)&c->x86_vendor_id[4]);
265 265
266 c->x86 = 4; 266 c->x86 = 4;
267 if (c->cpuid_level >= 0x00000001) { 267 if (c->cpuid_level >= 0x00000001) {
@@ -283,7 +283,7 @@ void __init cpu_detect(struct cpuinfo_x86 *c)
283static void __cpuinit early_get_cap(struct cpuinfo_x86 *c) 283static void __cpuinit early_get_cap(struct cpuinfo_x86 *c)
284{ 284{
285 u32 tfms, xlvl; 285 u32 tfms, xlvl;
286 int ebx; 286 unsigned int ebx;
287 287
288 memset(&c->x86_capability, 0, sizeof c->x86_capability); 288 memset(&c->x86_capability, 0, sizeof c->x86_capability);
289 if (have_cpuid_p()) { 289 if (have_cpuid_p()) {
@@ -343,14 +343,14 @@ static void __init early_cpu_detect(void)
343static void __cpuinit generic_identify(struct cpuinfo_x86 * c) 343static void __cpuinit generic_identify(struct cpuinfo_x86 * c)
344{ 344{
345 u32 tfms, xlvl; 345 u32 tfms, xlvl;
346 int ebx; 346 unsigned int ebx;
347 347
348 if (have_cpuid_p()) { 348 if (have_cpuid_p()) {
349 /* Get vendor name */ 349 /* Get vendor name */
350 cpuid(0x00000000, &c->cpuid_level, 350 cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
351 (int *)&c->x86_vendor_id[0], 351 (unsigned int *)&c->x86_vendor_id[0],
352 (int *)&c->x86_vendor_id[8], 352 (unsigned int *)&c->x86_vendor_id[8],
353 (int *)&c->x86_vendor_id[4]); 353 (unsigned int *)&c->x86_vendor_id[4]);
354 354
355 get_cpu_vendor(c, 0); 355 get_cpu_vendor(c, 0);
356 /* Initialize the standard set of capabilities */ 356 /* Initialize the standard set of capabilities */
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index dec66e452810..a63432d800f9 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -170,7 +170,7 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
170 return err ? NOTIFY_BAD : NOTIFY_OK; 170 return err ? NOTIFY_BAD : NOTIFY_OK;
171} 171}
172 172
173static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = 173static struct notifier_block __refdata cpuid_class_cpu_notifier =
174{ 174{
175 .notifier_call = cpuid_class_cpu_callback, 175 .notifier_call = cpuid_class_cpu_callback,
176}; 176};
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index c617174e8963..9f65b4cc323c 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -54,30 +54,33 @@ static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT;
54 54
55struct early_res { 55struct early_res {
56 unsigned long start, end; 56 unsigned long start, end;
57 char name[16];
57}; 58};
58static struct early_res early_res[MAX_EARLY_RES] __initdata = { 59static struct early_res early_res[MAX_EARLY_RES] __initdata = {
59 { 0, PAGE_SIZE }, /* BIOS data page */ 60 { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */
60#ifdef CONFIG_SMP 61#ifdef CONFIG_SMP
61 { SMP_TRAMPOLINE_BASE, SMP_TRAMPOLINE_BASE + 2*PAGE_SIZE }, 62 { SMP_TRAMPOLINE_BASE, SMP_TRAMPOLINE_BASE + 2*PAGE_SIZE, "SMP_TRAMPOLINE" },
62#endif 63#endif
63 {} 64 {}
64}; 65};
65 66
66void __init reserve_early(unsigned long start, unsigned long end) 67void __init reserve_early(unsigned long start, unsigned long end, char *name)
67{ 68{
68 int i; 69 int i;
69 struct early_res *r; 70 struct early_res *r;
70 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) { 71 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
71 r = &early_res[i]; 72 r = &early_res[i];
72 if (end > r->start && start < r->end) 73 if (end > r->start && start < r->end)
73 panic("Overlapping early reservations %lx-%lx to %lx-%lx\n", 74 panic("Overlapping early reservations %lx-%lx %s to %lx-%lx %s\n",
74 start, end, r->start, r->end); 75 start, end - 1, name?name:"", r->start, r->end - 1, r->name);
75 } 76 }
76 if (i >= MAX_EARLY_RES) 77 if (i >= MAX_EARLY_RES)
77 panic("Too many early reservations"); 78 panic("Too many early reservations");
78 r = &early_res[i]; 79 r = &early_res[i];
79 r->start = start; 80 r->start = start;
80 r->end = end; 81 r->end = end;
82 if (name)
83 strncpy(r->name, name, sizeof(r->name) - 1);
81} 84}
82 85
83void __init early_res_to_bootmem(void) 86void __init early_res_to_bootmem(void)
@@ -85,6 +88,8 @@ void __init early_res_to_bootmem(void)
85 int i; 88 int i;
86 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) { 89 for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
87 struct early_res *r = &early_res[i]; 90 struct early_res *r = &early_res[i];
91 printk(KERN_INFO "early res: %d [%lx-%lx] %s\n", i,
92 r->start, r->end - 1, r->name);
88 reserve_bootmem_generic(r->start, r->end - r->start); 93 reserve_bootmem_generic(r->start, r->end - r->start);
89 } 94 }
90} 95}
@@ -166,12 +171,13 @@ int __init e820_all_mapped(unsigned long start, unsigned long end,
166} 171}
167 172
168/* 173/*
169 * Find a free area in a specific range. 174 * Find a free area with specified alignment in a specific range.
170 */ 175 */
171unsigned long __init find_e820_area(unsigned long start, unsigned long end, 176unsigned long __init find_e820_area(unsigned long start, unsigned long end,
172 unsigned size) 177 unsigned size, unsigned long align)
173{ 178{
174 int i; 179 int i;
180 unsigned long mask = ~(align - 1);
175 181
176 for (i = 0; i < e820.nr_map; i++) { 182 for (i = 0; i < e820.nr_map; i++) {
177 struct e820entry *ei = &e820.map[i]; 183 struct e820entry *ei = &e820.map[i];
@@ -185,7 +191,8 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end,
185 continue; 191 continue;
186 while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) 192 while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size)
187 ; 193 ;
188 last = PAGE_ALIGN(addr) + size; 194 addr = (addr + align - 1) & mask;
195 last = addr + size;
189 if (last > ei->addr + ei->size) 196 if (last > ei->addr + ei->size)
190 continue; 197 continue;
191 if (last > end) 198 if (last > end)
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index b7d6c23f2871..cff84cd9987f 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -193,7 +193,7 @@ static struct console simnow_console = {
193}; 193};
194 194
195/* Direct interface for emergencies */ 195/* Direct interface for emergencies */
196struct console *early_console = &early_vga_console; 196static struct console *early_console = &early_vga_console;
197static int early_console_initialized = 0; 197static int early_console_initialized = 0;
198 198
199void early_printk(const char *fmt, ...) 199void early_printk(const char *fmt, ...)
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 4b73992c1e11..674f2379480f 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -44,7 +44,7 @@ static void __init early_mapping_set_exec(unsigned long start,
44 int executable) 44 int executable)
45{ 45{
46 pte_t *kpte; 46 pte_t *kpte;
47 int level; 47 unsigned int level;
48 48
49 while (start < end) { 49 while (start < end) {
50 kpte = lookup_address((unsigned long)__va(start), &level); 50 kpte = lookup_address((unsigned long)__va(start), &level);
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index a317336cdeaa..24dbf56928d7 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -75,7 +75,7 @@ static __init void reserve_ebda(void)
75 if (ebda_size > 64*1024) 75 if (ebda_size > 64*1024)
76 ebda_size = 64*1024; 76 ebda_size = 64*1024;
77 77
78 reserve_early(ebda_addr, ebda_addr + ebda_size); 78 reserve_early(ebda_addr, ebda_addr + ebda_size, "EBDA");
79} 79}
80 80
81void __init x86_64_start_kernel(char * real_mode_data) 81void __init x86_64_start_kernel(char * real_mode_data)
@@ -105,14 +105,14 @@ void __init x86_64_start_kernel(char * real_mode_data)
105 pda_init(0); 105 pda_init(0);
106 copy_bootdata(__va(real_mode_data)); 106 copy_bootdata(__va(real_mode_data));
107 107
108 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end)); 108 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
109 109
110 /* Reserve INITRD */ 110 /* Reserve INITRD */
111 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { 111 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
112 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; 112 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
113 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; 113 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
114 unsigned long ramdisk_end = ramdisk_image + ramdisk_size; 114 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
115 reserve_early(ramdisk_image, ramdisk_end); 115 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
116 } 116 }
117 117
118 reserve_ebda(); 118 reserve_ebda();
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
index 6ff447f9fda7..f2702d01b8a8 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -797,7 +797,7 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
797 return NOTIFY_OK; 797 return NOTIFY_OK;
798} 798}
799 799
800static struct notifier_block __cpuinitdata mc_cpu_notifier = { 800static struct notifier_block __refdata mc_cpu_notifier = {
801 .notifier_call = mc_cpu_callback, 801 .notifier_call = mc_cpu_callback,
802}; 802};
803 803
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 21f6e3c0be18..bd82850e6519 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -168,7 +168,7 @@ static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb,
168 return err ? NOTIFY_BAD : NOTIFY_OK; 168 return err ? NOTIFY_BAD : NOTIFY_OK;
169} 169}
170 170
171static struct notifier_block __cpuinitdata msr_class_cpu_notifier = { 171static struct notifier_block __refdata msr_class_cpu_notifier = {
172 .notifier_call = msr_class_cpu_callback, 172 .notifier_call = msr_class_cpu_callback,
173}; 173};
174 174
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 21f34db2c03c..1fe7f043ebde 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1006,7 +1006,7 @@ static void __init calgary_set_split_completion_timeout(void __iomem *bbar,
1006 readq(target); /* flush */ 1006 readq(target); /* flush */
1007} 1007}
1008 1008
1009static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) 1009static void __init calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev)
1010{ 1010{
1011 unsigned char busnum = dev->bus->number; 1011 unsigned char busnum = dev->bus->number;
1012 void __iomem *bbar = tbl->bbar; 1012 void __iomem *bbar = tbl->bbar;
@@ -1022,7 +1022,7 @@ static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev)
1022 writel(cpu_to_be32(val), target); 1022 writel(cpu_to_be32(val), target);
1023} 1023}
1024 1024
1025static void calgary_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev) 1025static void __init calgary_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev)
1026{ 1026{
1027 unsigned char busnum = dev->bus->number; 1027 unsigned char busnum = dev->bus->number;
1028 1028
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 77fb87bf6e5a..18df70c534b9 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -182,7 +182,8 @@ contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
182 unsigned long bootmap_size, bootmap; 182 unsigned long bootmap_size, bootmap;
183 183
184 bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT; 184 bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT;
185 bootmap = find_e820_area(0, end_pfn<<PAGE_SHIFT, bootmap_size); 185 bootmap = find_e820_area(0, end_pfn<<PAGE_SHIFT, bootmap_size,
186 PAGE_SIZE);
186 if (bootmap == -1L) 187 if (bootmap == -1L)
187 panic("Cannot find bootmem map of size %ld\n", bootmap_size); 188 panic("Cannot find bootmem map of size %ld\n", bootmap_size);
188 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn); 189 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index cc64b8085c2a..d53bd6fcb428 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -1019,7 +1019,7 @@ static void remove_siblinginfo(int cpu)
1019 cpu_clear(cpu, cpu_sibling_setup_map); 1019 cpu_clear(cpu, cpu_sibling_setup_map);
1020} 1020}
1021 1021
1022void remove_cpu_from_maps(void) 1022static void __ref remove_cpu_from_maps(void)
1023{ 1023{
1024 int cpu = smp_processor_id(); 1024 int cpu = smp_processor_id();
1025 1025
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 78cbb655aa79..e6757aaa202b 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -57,11 +57,10 @@ void arch_unregister_cpu(int num)
57} 57}
58EXPORT_SYMBOL(arch_unregister_cpu); 58EXPORT_SYMBOL(arch_unregister_cpu);
59#else 59#else
60int arch_register_cpu(int num) 60static int __init arch_register_cpu(int num)
61{ 61{
62 return register_cpu(&per_cpu(cpu_devices, num).cpu, num); 62 return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
63} 63}
64EXPORT_SYMBOL(arch_register_cpu);
65#endif /*CONFIG_HOTPLUG_CPU*/ 64#endif /*CONFIG_HOTPLUG_CPU*/
66 65
67static int __init topology_init(void) 66static int __init topology_init(void)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index e28cc5277b16..e4440d0abf81 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -382,7 +382,7 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code,
382 382
383#ifdef CONFIG_X86_PAE 383#ifdef CONFIG_X86_PAE
384 if (error_code & PF_INSTR) { 384 if (error_code & PF_INSTR) {
385 int level; 385 unsigned int level;
386 pte_t *pte = lookup_address(address, &level); 386 pte_t *pte = lookup_address(address, &level);
387 387
388 if (pte && pte_present(*pte) && !pte_exec(*pte)) 388 if (pte && pte_present(*pte) && !pte_exec(*pte))
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index cc50a13ce8d9..eabcaed76c28 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -354,17 +354,10 @@ static void __init find_early_table_space(unsigned long end)
354 * need roughly 0.5KB per GB. 354 * need roughly 0.5KB per GB.
355 */ 355 */
356 start = 0x8000; 356 start = 0x8000;
357 table_start = find_e820_area(start, end, tables); 357 table_start = find_e820_area(start, end, tables, PAGE_SIZE);
358 if (table_start == -1UL) 358 if (table_start == -1UL)
359 panic("Cannot find space for the kernel page tables"); 359 panic("Cannot find space for the kernel page tables");
360 360
361 /*
362 * When you have a lot of RAM like 256GB, early_table will not fit
363 * into 0x8000 range, find_e820_area() will find area after kernel
364 * bss but the table_start is not page aligned, so need to round it
365 * up to avoid overlap with bss:
366 */
367 table_start = round_up(table_start, PAGE_SIZE);
368 table_start >>= PAGE_SHIFT; 361 table_start >>= PAGE_SHIFT;
369 table_end = table_start; 362 table_end = table_start;
370 363
@@ -420,7 +413,9 @@ void __init_refok init_memory_mapping(unsigned long start, unsigned long end)
420 mmu_cr4_features = read_cr4(); 413 mmu_cr4_features = read_cr4();
421 __flush_tlb_all(); 414 __flush_tlb_all();
422 415
423 reserve_early(table_start << PAGE_SHIFT, table_end << PAGE_SHIFT); 416 if (!after_bootmem)
417 reserve_early(table_start << PAGE_SHIFT,
418 table_end << PAGE_SHIFT, "PGTABLE");
424} 419}
425 420
426#ifndef CONFIG_NUMA 421#ifndef CONFIG_NUMA
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index a177d76e1c53..c004d94608fd 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -75,7 +75,8 @@ static int ioremap_change_attr(unsigned long paddr, unsigned long size,
75{ 75{
76 unsigned long vaddr = (unsigned long)__va(paddr); 76 unsigned long vaddr = (unsigned long)__va(paddr);
77 unsigned long nrpages = size >> PAGE_SHIFT; 77 unsigned long nrpages = size >> PAGE_SHIFT;
78 int err, level; 78 unsigned int level;
79 int err;
79 80
80 /* No change for pages after the last mapping */ 81 /* No change for pages after the last mapping */
81 if ((paddr + size - 1) >= (max_pfn_mapped << PAGE_SHIFT)) 82 if ((paddr + size - 1) >= (max_pfn_mapped << PAGE_SHIFT))
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index dc3b1f7e1451..a920d09b9194 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -84,26 +84,24 @@ static int __init populate_memnodemap(const struct bootnode *nodes,
84 84
85static int __init allocate_cachealigned_memnodemap(void) 85static int __init allocate_cachealigned_memnodemap(void)
86{ 86{
87 unsigned long pad, pad_addr; 87 unsigned long addr;
88 88
89 memnodemap = memnode.embedded_map; 89 memnodemap = memnode.embedded_map;
90 if (memnodemapsize <= ARRAY_SIZE(memnode.embedded_map)) 90 if (memnodemapsize <= ARRAY_SIZE(memnode.embedded_map))
91 return 0; 91 return 0;
92 92
93 pad = L1_CACHE_BYTES - 1; 93 addr = 0x8000;
94 pad_addr = 0x8000; 94 nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES);
95 nodemap_size = pad + sizeof(s16) * memnodemapsize; 95 nodemap_addr = find_e820_area(addr, end_pfn<<PAGE_SHIFT,
96 nodemap_addr = find_e820_area(pad_addr, end_pfn<<PAGE_SHIFT, 96 nodemap_size, L1_CACHE_BYTES);
97 nodemap_size);
98 if (nodemap_addr == -1UL) { 97 if (nodemap_addr == -1UL) {
99 printk(KERN_ERR 98 printk(KERN_ERR
100 "NUMA: Unable to allocate Memory to Node hash map\n"); 99 "NUMA: Unable to allocate Memory to Node hash map\n");
101 nodemap_addr = nodemap_size = 0; 100 nodemap_addr = nodemap_size = 0;
102 return -1; 101 return -1;
103 } 102 }
104 pad_addr = (nodemap_addr + pad) & ~pad; 103 memnodemap = phys_to_virt(nodemap_addr);
105 memnodemap = phys_to_virt(pad_addr); 104 reserve_early(nodemap_addr, nodemap_addr + nodemap_size, "MEMNODEMAP");
106 reserve_early(nodemap_addr, nodemap_addr + nodemap_size);
107 105
108 printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n", 106 printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n",
109 nodemap_addr, nodemap_addr + nodemap_size); 107 nodemap_addr, nodemap_addr + nodemap_size);
@@ -164,15 +162,16 @@ int early_pfn_to_nid(unsigned long pfn)
164} 162}
165 163
166static void * __init early_node_mem(int nodeid, unsigned long start, 164static void * __init early_node_mem(int nodeid, unsigned long start,
167 unsigned long end, unsigned long size) 165 unsigned long end, unsigned long size,
166 unsigned long align)
168{ 167{
169 unsigned long mem = find_e820_area(start, end, size); 168 unsigned long mem = find_e820_area(start, end, size, align);
170 void *ptr; 169 void *ptr;
171 170
172 if (mem != -1L) 171 if (mem != -1L)
173 return __va(mem); 172 return __va(mem);
174 ptr = __alloc_bootmem_nopanic(size, 173
175 SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)); 174 ptr = __alloc_bootmem_nopanic(size, align, __pa(MAX_DMA_ADDRESS));
176 if (ptr == NULL) { 175 if (ptr == NULL) {
177 printk(KERN_ERR "Cannot find %lu bytes in node %d\n", 176 printk(KERN_ERR "Cannot find %lu bytes in node %d\n",
178 size, nodeid); 177 size, nodeid);
@@ -198,7 +197,8 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
198 start_pfn = start >> PAGE_SHIFT; 197 start_pfn = start >> PAGE_SHIFT;
199 end_pfn = end >> PAGE_SHIFT; 198 end_pfn = end >> PAGE_SHIFT;
200 199
201 node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size); 200 node_data[nodeid] = early_node_mem(nodeid, start, end, pgdat_size,
201 SMP_CACHE_BYTES);
202 if (node_data[nodeid] == NULL) 202 if (node_data[nodeid] == NULL)
203 return; 203 return;
204 nodedata_phys = __pa(node_data[nodeid]); 204 nodedata_phys = __pa(node_data[nodeid]);
@@ -211,8 +211,12 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
211 /* Find a place for the bootmem map */ 211 /* Find a place for the bootmem map */
212 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 212 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
213 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE); 213 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE);
214 /*
215 * SMP_CAHCE_BYTES could be enough, but init_bootmem_node like
216 * to use that to align to PAGE_SIZE
217 */
214 bootmap = early_node_mem(nodeid, bootmap_start, end, 218 bootmap = early_node_mem(nodeid, bootmap_start, end,
215 bootmap_pages<<PAGE_SHIFT); 219 bootmap_pages<<PAGE_SHIFT, PAGE_SIZE);
216 if (bootmap == NULL) { 220 if (bootmap == NULL) {
217 if (nodedata_phys < start || nodedata_phys >= end) 221 if (nodedata_phys < start || nodedata_phys >= end)
218 free_bootmem((unsigned long)node_data[nodeid], 222 free_bootmem((unsigned long)node_data[nodeid],
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 06353d43f72e..7573e786d2f2 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -42,7 +42,7 @@ static __init int print_split(struct split_state *s)
42 s->max_exec = 0; 42 s->max_exec = 0;
43 for (i = 0; i < max_pfn_mapped; ) { 43 for (i = 0; i < max_pfn_mapped; ) {
44 unsigned long addr = (unsigned long)__va(i << PAGE_SHIFT); 44 unsigned long addr = (unsigned long)__va(i << PAGE_SHIFT);
45 int level; 45 unsigned int level;
46 pte_t *pte; 46 pte_t *pte;
47 47
48 pte = lookup_address(addr, &level); 48 pte = lookup_address(addr, &level);
@@ -106,7 +106,7 @@ static __init int exercise_pageattr(void)
106 unsigned long *bm; 106 unsigned long *bm;
107 pte_t *pte, pte0; 107 pte_t *pte, pte0;
108 int failed = 0; 108 int failed = 0;
109 int level; 109 unsigned int level;
110 int i, k; 110 int i, k;
111 int err; 111 int err;
112 112
diff --git a/include/asm-x86/cpu.h b/include/asm-x86/cpu.h
index 85ece5f10e9e..73f2ea84fd74 100644
--- a/include/asm-x86/cpu.h
+++ b/include/asm-x86/cpu.h
@@ -10,8 +10,9 @@
10struct x86_cpu { 10struct x86_cpu {
11 struct cpu cpu; 11 struct cpu cpu;
12}; 12};
13extern int arch_register_cpu(int num); 13
14#ifdef CONFIG_HOTPLUG_CPU 14#ifdef CONFIG_HOTPLUG_CPU
15extern int arch_register_cpu(int num);
15extern void arch_unregister_cpu(int); 16extern void arch_unregister_cpu(int);
16#endif 17#endif
17 18
diff --git a/include/asm-x86/e820_64.h b/include/asm-x86/e820_64.h
index 51e4170f9ca5..a560c4f5d500 100644
--- a/include/asm-x86/e820_64.h
+++ b/include/asm-x86/e820_64.h
@@ -15,7 +15,7 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17extern unsigned long find_e820_area(unsigned long start, unsigned long end, 17extern unsigned long find_e820_area(unsigned long start, unsigned long end,
18 unsigned size); 18 unsigned size, unsigned long align);
19extern void add_memory_region(unsigned long start, unsigned long size, 19extern void add_memory_region(unsigned long start, unsigned long size,
20 int type); 20 int type);
21extern void setup_memory_region(void); 21extern void setup_memory_region(void);
@@ -41,7 +41,7 @@ extern void finish_e820_parsing(void);
41extern struct e820map e820; 41extern struct e820map e820;
42extern void update_e820(void); 42extern void update_e820(void);
43 43
44extern void reserve_early(unsigned long start, unsigned long end); 44extern void reserve_early(unsigned long start, unsigned long end, char *name);
45extern void early_res_to_bootmem(void); 45extern void early_res_to_bootmem(void);
46 46
47#endif/*!__ASSEMBLY__*/ 47#endif/*!__ASSEMBLY__*/