aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig.debug9
-rw-r--r--arch/alpha/defconfig1
-rw-r--r--arch/alpha/kernel/core_irongate.c3
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/alpha/kernel/setup.c5
-rw-r--r--arch/alpha/kernel/smp.c4
-rw-r--r--arch/alpha/mm/numa.c5
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c1
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c1
-rw-r--r--arch/arm/mach-rpc/riscpc.c2
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/mm/mmu.c17
-rw-r--r--arch/arm/mm/nommu.c9
-rw-r--r--arch/arm/plat-omap/fb.c2
-rw-r--r--arch/avr32/kernel/setup.c6
-rw-r--r--arch/avr32/lib/delay.c4
-rw-r--r--arch/blackfin/kernel/setup.c2
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c2
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c2
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c2
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c2
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c2
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c2
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c2
-rw-r--r--arch/cris/kernel/setup.c2
-rw-r--r--arch/frv/kernel/setup.c18
-rw-r--r--arch/h8300/kernel/irq.c1
-rw-r--r--arch/h8300/kernel/setup.c2
-rw-r--r--arch/ia64/kernel/machine_kexec.c7
-rw-r--r--arch/ia64/kernel/smpboot.c3
-rw-r--r--arch/ia64/mm/contig.c2
-rw-r--r--arch/ia64/mm/discontig.c4
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c6
-rw-r--r--arch/m32r/kernel/setup.c11
-rw-r--r--arch/m32r/kernel/smpboot.c1
-rw-r--r--arch/m32r/mm/discontig.c5
-rw-r--r--arch/m68k/amiga/chipram.c2
-rw-r--r--arch/m68k/amiga/cia.c2
-rw-r--r--arch/m68k/atari/stram.c2
-rw-r--r--arch/m68k/kernel/setup.c3
-rw-r--r--arch/m68knommu/kernel/setup.c2
-rw-r--r--arch/m68knommu/lib/memcpy.c1
-rw-r--r--arch/mips/au1000/common/gpio.c1
-rw-r--r--arch/mips/kernel/setup.c4
-rw-r--r--arch/mips/kernel/smp.c1
-rw-r--r--arch/mips/kernel/sysirix.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c3
-rw-r--r--arch/parisc/Kconfig.debug9
-rw-r--r--arch/parisc/configs/a500_defconfig1
-rw-r--r--arch/parisc/mm/init.c14
-rw-r--r--arch/powerpc/kernel/time.c12
-rw-r--r--arch/powerpc/mm/mem.c8
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c2
-rw-r--r--arch/ppc/8260_io/enet.c2
-rw-r--r--arch/ppc/8260_io/fcc_enet.c2
-rw-r--r--arch/ppc/kernel/vmlinux.lds.S5
-rw-r--r--arch/ppc/platforms/prep_setup.c81
-rw-r--r--arch/s390/kernel/setup.c11
-rw-r--r--arch/sh/boards/landisk/setup.c2
-rw-r--r--arch/sh/boards/lboxre2/setup.c2
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c2
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c2
-rw-r--r--arch/sh/boards/renesas/sdk7780/setup.c2
-rw-r--r--arch/sh/boards/se/7722/setup.c2
-rw-r--r--arch/sh/kernel/setup.c35
-rw-r--r--arch/sh/mm/numa.c4
-rw-r--r--arch/sparc/kernel/sun4d_smp.c4
-rw-r--r--arch/sparc/kernel/sun4m_smp.c5
-rw-r--r--arch/sparc/kernel/systbls.S6
-rw-r--r--arch/sparc/mm/init.c6
-rw-r--r--arch/sparc64/defconfig83
-rw-r--r--arch/sparc64/kernel/Makefile2
-rw-r--r--arch/sparc64/kernel/iommu.c142
-rw-r--r--arch/sparc64/kernel/iommu_common.c248
-rw-r--r--arch/sparc64/kernel/iommu_common.h26
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c170
-rw-r--r--arch/sparc64/kernel/smp.c2
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c1
-rw-r--r--arch/sparc64/kernel/systbls.S9
-rw-r--r--arch/sparc64/kernel/time.c5
-rw-r--r--arch/sparc64/mm/init.c8
-rw-r--r--arch/sparc64/solaris/fs.c2
-rw-r--r--arch/sparc64/solaris/timod.c6
-rw-r--r--arch/v850/kernel/anna.c3
-rw-r--r--arch/v850/kernel/as85ep1.c3
-rw-r--r--arch/v850/kernel/rte_ma1_cb.c6
-rw-r--r--arch/v850/kernel/setup.c12
-rw-r--r--arch/x86/Kconfig3
-rw-r--r--arch/x86/Kconfig.debug4
-rw-r--r--arch/x86/ia32/ia32_aout.c3
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c1
-rw-r--r--arch/x86/kernel/cpu/cyrix.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c19
-rw-r--r--arch/x86/kernel/entry_64.S24
-rw-r--r--arch/x86/kernel/head_64.S15
-rw-r--r--arch/x86/kernel/machine_kexec_32.c2
-rw-r--r--arch/x86/kernel/machine_kexec_64.c5
-rw-r--r--arch/x86/kernel/mpparse_32.c6
-rw-r--r--arch/x86/kernel/ptrace.c25
-rw-r--r--arch/x86/kernel/quirks.c26
-rw-r--r--arch/x86/kernel/setup_32.c18
-rw-r--r--arch/x86/kernel/setup_64.c37
-rw-r--r--arch/x86/kernel/smpboot_32.c2
-rw-r--r--arch/x86/kernel/test_nx.c2
-rw-r--r--arch/x86/kernel/traps_32.c15
-rw-r--r--arch/x86/lib/delay_32.c4
-rw-r--r--arch/x86/lib/delay_64.c4
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c2
-rw-r--r--arch/x86/mm/discontig_32.c3
-rw-r--r--arch/x86/mm/fault.c28
-rw-r--r--arch/x86/mm/init_64.c13
-rw-r--r--arch/x86/mm/numa_64.c5
-rw-r--r--arch/x86/mm/pageattr-test.c65
-rw-r--r--arch/x86/mm/pageattr.c14
-rw-r--r--arch/x86/mm/srat_64.c3
-rw-r--r--arch/xtensa/kernel/time.c2
122 files changed, 563 insertions, 924 deletions
diff --git a/arch/alpha/Kconfig.debug b/arch/alpha/Kconfig.debug
index f45f28cc10da..3f6265f2d9d4 100644
--- a/arch/alpha/Kconfig.debug
+++ b/arch/alpha/Kconfig.debug
@@ -7,15 +7,6 @@ config EARLY_PRINTK
7 depends on ALPHA_GENERIC || ALPHA_SRM 7 depends on ALPHA_GENERIC || ALPHA_SRM
8 default y 8 default y
9 9
10config DEBUG_RWLOCK
11 bool "Read-write spinlock debugging"
12 depends on DEBUG_KERNEL
13 help
14 If you say Y here then read-write lock processing will count how many
15 times it has tried to get the lock and issue an error message after
16 too many attempts. If you suspect a rwlock problem or a kernel
17 hacker asks for this option then say Y. Otherwise say N.
18
19config ALPHA_LEGACY_START_ADDRESS 10config ALPHA_LEGACY_START_ADDRESS
20 bool "Legacy kernel start address" 11 bool "Legacy kernel start address"
21 depends on ALPHA_GENERIC 12 depends on ALPHA_GENERIC
diff --git a/arch/alpha/defconfig b/arch/alpha/defconfig
index 6da9c3dbde44..e43f68fd66b0 100644
--- a/arch/alpha/defconfig
+++ b/arch/alpha/defconfig
@@ -882,7 +882,6 @@ CONFIG_MAGIC_SYSRQ=y
882# CONFIG_DEBUG_SPINLOCK is not set 882# CONFIG_DEBUG_SPINLOCK is not set
883CONFIG_DEBUG_INFO=y 883CONFIG_DEBUG_INFO=y
884CONFIG_EARLY_PRINTK=y 884CONFIG_EARLY_PRINTK=y
885# CONFIG_DEBUG_RWLOCK is not set
886# CONFIG_DEBUG_SEMAPHORE is not set 885# CONFIG_DEBUG_SEMAPHORE is not set
887CONFIG_ALPHA_LEGACY_START_ADDRESS=y 886CONFIG_ALPHA_LEGACY_START_ADDRESS=y
888CONFIG_MATHEMU=y 887CONFIG_MATHEMU=y
diff --git a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
index e4a0bcf1d28b..a872078497be 100644
--- a/arch/alpha/kernel/core_irongate.c
+++ b/arch/alpha/kernel/core_irongate.c
@@ -241,7 +241,8 @@ albacore_init_arch(void)
241 size / 1024); 241 size / 1024);
242 } 242 }
243#endif 243#endif
244 reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop - pci_mem); 244 reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop -
245 pci_mem, BOOTMEM_DEFAULT);
245 printk("irongate_init_arch: temporarily reserving " 246 printk("irongate_init_arch: temporarily reserving "
246 "region %08lx-%08lx for PCI\n", pci_mem, memtop - 1); 247 "region %08lx-%08lx for PCI\n", pci_mem, memtop - 1);
247 } 248 }
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 6413c5f23226..72f9a619a66d 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -430,7 +430,7 @@ sys_getpagesize(void)
430asmlinkage unsigned long 430asmlinkage unsigned long
431sys_getdtablesize(void) 431sys_getdtablesize(void)
432{ 432{
433 return NR_OPEN; 433 return sysctl_nr_open;
434} 434}
435 435
436/* 436/*
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index beff6297f788..74c346625658 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -428,7 +428,8 @@ setup_memory(void *kernel_end)
428 } 428 }
429 429
430 /* Reserve the bootmap memory. */ 430 /* Reserve the bootmap memory. */
431 reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size); 431 reserve_bootmem(PFN_PHYS(bootmap_start), bootmap_size,
432 BOOTMEM_DEFAULT);
432 printk("reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size)); 433 printk("reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
433 434
434#ifdef CONFIG_BLK_DEV_INITRD 435#ifdef CONFIG_BLK_DEV_INITRD
@@ -446,7 +447,7 @@ setup_memory(void *kernel_end)
446 phys_to_virt(PFN_PHYS(max_low_pfn))); 447 phys_to_virt(PFN_PHYS(max_low_pfn)));
447 } else { 448 } else {
448 reserve_bootmem(virt_to_phys((void *)initrd_start), 449 reserve_bootmem(virt_to_phys((void *)initrd_start),
449 INITRD_SIZE); 450 INITRD_SIZE, BOOTMEM_DEFAULT);
450 } 451 }
451 } 452 }
452#endif /* CONFIG_BLK_DEV_INITRD */ 453#endif /* CONFIG_BLK_DEV_INITRD */
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index f4ab233201b2..63c2073401ee 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -77,10 +77,6 @@ int smp_num_probed; /* Internal processor count */
77int smp_num_cpus = 1; /* Number that came online. */ 77int smp_num_cpus = 1; /* Number that came online. */
78EXPORT_SYMBOL(smp_num_cpus); 78EXPORT_SYMBOL(smp_num_cpus);
79 79
80extern void calibrate_delay(void);
81
82
83
84/* 80/*
85 * Called by both boot and secondaries to move global data into 81 * Called by both boot and secondaries to move global data into
86 * per-processor storage. 82 * per-processor storage.
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index e3e3806a6f25..10ab7833e83c 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -242,7 +242,8 @@ setup_memory_node(int nid, void *kernel_end)
242 } 242 }
243 243
244 /* Reserve the bootmap memory. */ 244 /* Reserve the bootmap memory. */
245 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start), bootmap_size); 245 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(bootmap_start),
246 bootmap_size, BOOTMEM_DEFAULT);
246 printk(" reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size)); 247 printk(" reserving pages %ld:%ld\n", bootmap_start, bootmap_start+PFN_UP(bootmap_size));
247 248
248 node_set_online(nid); 249 node_set_online(nid);
@@ -281,7 +282,7 @@ setup_memory(void *kernel_end)
281 nid = kvaddr_to_nid(initrd_start); 282 nid = kvaddr_to_nid(initrd_start);
282 reserve_bootmem_node(NODE_DATA(nid), 283 reserve_bootmem_node(NODE_DATA(nid),
283 virt_to_phys((void *)initrd_start), 284 virt_to_phys((void *)initrd_start),
284 INITRD_SIZE); 285 INITRD_SIZE, BOOTMEM_DEFAULT);
285 } 286 }
286 } 287 }
287#endif /* CONFIG_BLK_DEV_INITRD */ 288#endif /* CONFIG_BLK_DEV_INITRD */
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index aa29ea58ca09..0ce38dfa6ebe 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -383,6 +383,7 @@ static void at91_lcdc_tft_power_control(int on)
383} 383}
384 384
385static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 385static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
386 .lcdcon_is_backlight = true,
386 .default_bpp = 16, 387 .default_bpp = 16,
387 .default_dmacon = ATMEL_LCDC_DMAEN, 388 .default_dmacon = ATMEL_LCDC_DMAEN,
388 .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2, 389 .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2,
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index f09347a86e71..38313abef657 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -253,6 +253,7 @@ static void at91_lcdc_power_control(int on)
253 253
254/* Driver datas */ 254/* Driver datas */
255static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 255static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
256 .lcdcon_is_backlight = true,
256 .default_bpp = 16, 257 .default_bpp = 16,
257 .default_dmacon = ATMEL_LCDC_DMAEN, 258 .default_dmacon = ATMEL_LCDC_DMAEN,
258 .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2, 259 .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2,
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index a454451c97c3..eca558c6bf5d 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -17,7 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/pata_platform.h> 20#include <linux/ata_platform.h>
21 21
22#include <asm/elf.h> 22#include <asm/elf.h>
23#include <asm/io.h> 23#include <asm/io.h>
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c0ad7c0fbae0..ec00f26bffa4 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -239,7 +239,7 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
239 * Reserve the bootmem bitmap for this node. 239 * Reserve the bootmem bitmap for this node.
240 */ 240 */
241 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 241 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
242 boot_pages << PAGE_SHIFT); 242 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
243 243
244#ifdef CONFIG_BLK_DEV_INITRD 244#ifdef CONFIG_BLK_DEV_INITRD
245 /* 245 /*
@@ -247,7 +247,7 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
247 */ 247 */
248 if (node == initrd_node) { 248 if (node == initrd_node) {
249 reserve_bootmem_node(pgdat, phys_initrd_start, 249 reserve_bootmem_node(pgdat, phys_initrd_start,
250 phys_initrd_size); 250 phys_initrd_size, BOOTMEM_DEFAULT);
251 initrd_start = __phys_to_virt(phys_initrd_start); 251 initrd_start = __phys_to_virt(phys_initrd_start);
252 initrd_end = initrd_start + phys_initrd_size; 252 initrd_end = initrd_start + phys_initrd_size;
253 } 253 }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e5d61ee3d4a1..d41a75ed3dce 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -605,9 +605,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
605 * Note that this can only be in node 0. 605 * Note that this can only be in node 0.
606 */ 606 */
607#ifdef CONFIG_XIP_KERNEL 607#ifdef CONFIG_XIP_KERNEL
608 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start); 608 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
609 BOOTMEM_DEFAULT);
609#else 610#else
610 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext); 611 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
612 BOOTMEM_DEFAULT);
611#endif 613#endif
612 614
613 /* 615 /*
@@ -615,7 +617,7 @@ void __init reserve_node_zero(pg_data_t *pgdat)
615 * and can only be in node 0. 617 * and can only be in node 0.
616 */ 618 */
617 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir), 619 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir),
618 PTRS_PER_PGD * sizeof(pgd_t)); 620 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
619 621
620 /* 622 /*
621 * Hmm... This should go elsewhere, but we really really need to 623 * Hmm... This should go elsewhere, but we really really need to
@@ -638,8 +640,10 @@ void __init reserve_node_zero(pg_data_t *pgdat)
638 /* H1940 and RX3715 need to reserve this for suspend */ 640 /* H1940 and RX3715 need to reserve this for suspend */
639 641
640 if (machine_is_h1940() || machine_is_rx3715()) { 642 if (machine_is_h1940() || machine_is_rx3715()) {
641 reserve_bootmem_node(pgdat, 0x30003000, 0x1000); 643 reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
642 reserve_bootmem_node(pgdat, 0x30081000, 0x1000); 644 BOOTMEM_DEFAULT);
645 reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
646 BOOTMEM_DEFAULT);
643 } 647 }
644 648
645#ifdef CONFIG_SA1111 649#ifdef CONFIG_SA1111
@@ -650,7 +654,8 @@ void __init reserve_node_zero(pg_data_t *pgdat)
650 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; 654 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
651#endif 655#endif
652 if (res_size) 656 if (res_size)
653 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size); 657 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size,
658 BOOTMEM_DEFAULT);
654} 659}
655 660
656/* 661/*
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 8cd3a60954f0..63c62fdea521 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -27,9 +27,11 @@ void __init reserve_node_zero(pg_data_t *pgdat)
27 * Note that this can only be in node 0. 27 * Note that this can only be in node 0.
28 */ 28 */
29#ifdef CONFIG_XIP_KERNEL 29#ifdef CONFIG_XIP_KERNEL
30 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start); 30 reserve_bootmem_node(pgdat, __pa(&__data_start), &_end - &__data_start,
31 BOOTMEM_DEFAULT);
31#else 32#else
32 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext); 33 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext,
34 BOOTMEM_DEFAULT);
33#endif 35#endif
34 36
35 /* 37 /*
@@ -37,7 +39,8 @@ void __init reserve_node_zero(pg_data_t *pgdat)
37 * some architectures which the DRAM is the exception vector to trap, 39 * some architectures which the DRAM is the exception vector to trap,
38 * alloc_page breaks with error, although it is not NULL, but "0." 40 * alloc_page breaks with error, although it is not NULL, but "0."
39 */ 41 */
40 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE); 42 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE,
43 BOOTMEM_DEFAULT);
41} 44}
42 45
43/* 46/*
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index ee40c1a0b83d..7854f19b77cf 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -207,7 +207,7 @@ void __init omapfb_reserve_sdram(void)
207 return; 207 return;
208 } 208 }
209 if (rg.paddr) 209 if (rg.paddr)
210 reserve_bootmem(rg.paddr, rg.size); 210 reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT);
211 reserved += rg.size; 211 reserved += rg.size;
212 omapfb_config.mem_desc.region[i] = rg; 212 omapfb_config.mem_desc.region[i] = rg;
213 configured_regions++; 213 configured_regions++;
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index 4b4c1884e1c5..e66a07a928cd 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -489,7 +489,8 @@ static void __init setup_bootmem(void)
489 /* Reserve space for the bootmem bitmap... */ 489 /* Reserve space for the bootmem bitmap... */
490 reserve_bootmem_node(NODE_DATA(node), 490 reserve_bootmem_node(NODE_DATA(node),
491 PFN_PHYS(bootmap_pfn), 491 PFN_PHYS(bootmap_pfn),
492 bootmap_size); 492 bootmap_size,
493 BOOTMEM_DEFAULT);
493 494
494 /* ...and any other reserved regions. */ 495 /* ...and any other reserved regions. */
495 for (res = reserved; res; res = res->sibling) { 496 for (res = reserved; res; res = res->sibling) {
@@ -505,7 +506,8 @@ static void __init setup_bootmem(void)
505 && res->end < PFN_PHYS(max_pfn)) 506 && res->end < PFN_PHYS(max_pfn))
506 reserve_bootmem_node( 507 reserve_bootmem_node(
507 NODE_DATA(node), res->start, 508 NODE_DATA(node), res->start,
508 res->end - res->start + 1); 509 res->end - res->start + 1,
510 BOOTMEM_DEFAULT);
509 } 511 }
510 512
511 node_set_online(node); 513 node_set_online(node);
diff --git a/arch/avr32/lib/delay.c b/arch/avr32/lib/delay.c
index b3bc0b56e2c6..9aa8800830f3 100644
--- a/arch/avr32/lib/delay.c
+++ b/arch/avr32/lib/delay.c
@@ -12,13 +12,15 @@
12 12
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/timex.h>
15#include <linux/param.h> 16#include <linux/param.h>
16#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/init.h>
17 19
18#include <asm/processor.h> 20#include <asm/processor.h>
19#include <asm/sysreg.h> 21#include <asm/sysreg.h>
20 22
21int read_current_timer(unsigned long *timer_value) 23int __devinit read_current_timer(unsigned long *timer_value)
22{ 24{
23 *timer_value = sysreg_read(COUNT); 25 *timer_value = sysreg_read(COUNT);
24 return 0; 26 return 0;
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 462cae893757..6e106b3d7729 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -406,7 +406,7 @@ void __init setup_arch(char **cmdline_p)
406 */ 406 */
407 free_bootmem(memory_start, memory_end - memory_start); 407 free_bootmem(memory_start, memory_end - memory_start);
408 408
409 reserve_bootmem(memory_start, bootmap_size); 409 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
410 /* 410 /*
411 * get kmalloc into gear 411 * get kmalloc into gear
412 */ 412 */
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index f8c411a24af7..1795aab79064 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -37,7 +37,7 @@
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb/isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/ata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/usb/sl811.h> 43#include <linux/usb/sl811.h>
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index a72c7a620fa1..97378b0a9753 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -38,7 +38,7 @@
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb/isp1362.h> 39#include <linux/usb/isp1362.h>
40#endif 40#endif
41#include <linux/pata_platform.h> 41#include <linux/ata_platform.h>
42#include <linux/irq.h> 42#include <linux/irq.h>
43 43
44#include <asm/dma.h> 44#include <asm/dma.h>
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index 21df2f375497..886f260d9359 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -34,7 +34,7 @@
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb/isp1362.h> 36#include <linux/usb/isp1362.h>
37#include <linux/pata_platform.h> 37#include <linux/ata_platform.h>
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index c37dd45c8803..4026c2f3ab4e 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -35,7 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#include <linux/usb/isp1362.h> 37#include <linux/usb/isp1362.h>
38#include <linux/pata_platform.h> 38#include <linux/ata_platform.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <asm/dma.h> 40#include <asm/dma.h>
41#include <asm/bfin5xx_spi.h> 41#include <asm/bfin5xx_spi.h>
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index ac52b040b336..0185350feacc 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -38,7 +38,7 @@
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb/isp1362.h> 39#include <linux/usb/isp1362.h>
40#endif 40#endif
41#include <linux/pata_platform.h> 41#include <linux/ata_platform.h>
42#include <linux/irq.h> 42#include <linux/irq.h>
43#include <asm/dma.h> 43#include <asm/dma.h>
44#include <asm/bfin5xx_spi.h> 44#include <asm/bfin5xx_spi.h>
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 8703b67d5ec6..f7c1f964f13b 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -36,7 +36,7 @@
36#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h> 37#include <linux/spi/flash.h>
38#include <linux/usb/isp1362.h> 38#include <linux/usb/isp1362.h>
39#include <linux/pata_platform.h> 39#include <linux/ata_platform.h>
40#include <linux/irq.h> 40#include <linux/irq.h>
41#include <asm/dma.h> 41#include <asm/dma.h>
42#include <asm/bfin5xx_spi.h> 42#include <asm/bfin5xx_spi.h>
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 3e52f3f5bd58..8a3397db1d21 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -38,7 +38,7 @@
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb/isp1362.h> 39#include <linux/usb/isp1362.h>
40#endif 40#endif
41#include <linux/pata_platform.h> 41#include <linux/ata_platform.h>
42#include <linux/irq.h> 42#include <linux/irq.h>
43#include <linux/interrupt.h> 43#include <linux/interrupt.h>
44#include <linux/usb/sl811.h> 44#include <linux/usb/sl811.h>
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
index b8bbba85af53..d71e0be33921 100644
--- a/arch/blackfin/mach-bf537/boards/minotaur.c
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -10,7 +10,7 @@
10#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 10#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
11#include <linux/usb_isp1362.h> 11#include <linux/usb_isp1362.h>
12#endif 12#endif
13#include <linux/pata_platform.h> 13#include <linux/ata_platform.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/usb_sl811.h> 16#include <linux/usb_sl811.h>
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 772541548b76..119e6ea83384 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -38,7 +38,7 @@
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb/isp1362.h> 39#include <linux/usb/isp1362.h>
40#endif 40#endif
41#include <linux/pata_platform.h> 41#include <linux/ata_platform.h>
42#include <linux/irq.h> 42#include <linux/irq.h>
43#include <linux/interrupt.h> 43#include <linux/interrupt.h>
44#include <linux/usb/sl811.h> 44#include <linux/usb/sl811.h>
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 3a79a9061bdc..bf9e738a7c64 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -34,7 +34,7 @@
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb/isp1362.h> 36#include <linux/usb/isp1362.h>
37#include <linux/pata_platform.h> 37#include <linux/ata_platform.h>
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 7601c3be1b5c..ed863ce9a2d8 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -35,7 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/irq.h> 36#include <linux/irq.h>
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <linux/pata_platform.h> 38#include <linux/ata_platform.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
41#include <asm/portmux.h> 41#include <asm/portmux.h>
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 65466c49d7a9..4da042e100a0 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -137,7 +137,7 @@ setup_arch(char **cmdline_p)
137 * Arguments are start, size 137 * Arguments are start, size
138 */ 138 */
139 139
140 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size); 140 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
141 141
142 /* paging_init() sets up the MMU and marks all pages as reserved */ 142 /* paging_init() sets up the MMU and marks all pages as reserved */
143 143
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index a74c08786b21..6c01464db699 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -708,7 +708,7 @@ static void __init reserve_dma_coherent(void)
708/* 708/*
709 * calibrate the delay loop 709 * calibrate the delay loop
710 */ 710 */
711void __init calibrate_delay(void) 711void __cpuinit calibrate_delay(void)
712{ 712{
713 loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ); 713 loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ);
714 714
@@ -925,13 +925,15 @@ static void __init setup_linux_memory(void)
925#endif 925#endif
926 926
927 /* take back the memory occupied by the kernel image and the bootmem alloc map */ 927 /* take back the memory occupied by the kernel image and the bootmem alloc map */
928 reserve_bootmem(kstart, kend - kstart + bootmap_size); 928 reserve_bootmem(kstart, kend - kstart + bootmap_size,
929 BOOTMEM_DEFAULT);
929 930
930 /* reserve the memory occupied by the initial ramdisk */ 931 /* reserve the memory occupied by the initial ramdisk */
931#ifdef CONFIG_BLK_DEV_INITRD 932#ifdef CONFIG_BLK_DEV_INITRD
932 if (LOADER_TYPE && INITRD_START) { 933 if (LOADER_TYPE && INITRD_START) {
933 if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) { 934 if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) {
934 reserve_bootmem(INITRD_START, INITRD_SIZE); 935 reserve_bootmem(INITRD_START, INITRD_SIZE,
936 BOOTMEM_DEFAULT);
935 initrd_start = INITRD_START + PAGE_OFFSET; 937 initrd_start = INITRD_START + PAGE_OFFSET;
936 initrd_end = initrd_start + INITRD_SIZE; 938 initrd_end = initrd_start + INITRD_SIZE;
937 } 939 }
@@ -986,9 +988,10 @@ static void __init setup_uclinux_memory(void)
986 988
987 /* now take back the bits the core kernel is occupying */ 989 /* now take back the bits the core kernel is occupying */
988#ifndef CONFIG_PROTECT_KERNEL 990#ifndef CONFIG_PROTECT_KERNEL
989 reserve_bootmem(kend, bootmap_size); 991 reserve_bootmem(kend, bootmap_size, BOOTMEM_DEFAULT);
990 reserve_bootmem((unsigned long) &__kernel_image_start, 992 reserve_bootmem((unsigned long) &__kernel_image_start,
991 kend - (unsigned long) &__kernel_image_start); 993 kend - (unsigned long) &__kernel_image_start,
994 BOOTMEM_DEFAULT);
992 995
993#else 996#else
994 dampr = __get_DAMPR(0); 997 dampr = __get_DAMPR(0);
@@ -996,14 +999,15 @@ static void __init setup_uclinux_memory(void)
996 dampr = (dampr >> 4) + 17; 999 dampr = (dampr >> 4) + 17;
997 dampr = 1 << dampr; 1000 dampr = 1 << dampr;
998 1001
999 reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr); 1002 reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr, BOOTMEM_DEFAULT);
1000#endif 1003#endif
1001 1004
1002 /* reserve some memory to do uncached DMA through if requested */ 1005 /* reserve some memory to do uncached DMA through if requested */
1003#ifdef CONFIG_RESERVE_DMA_COHERENT 1006#ifdef CONFIG_RESERVE_DMA_COHERENT
1004 if (dma_coherent_mem_start) 1007 if (dma_coherent_mem_start)
1005 reserve_bootmem(dma_coherent_mem_start, 1008 reserve_bootmem(dma_coherent_mem_start,
1006 dma_coherent_mem_end - dma_coherent_mem_start); 1009 dma_coherent_mem_end - dma_coherent_mem_start,
1010 BOOTMEM_DEFAULT);
1007#endif 1011#endif
1008 1012
1009} /* end setup_uclinux_memory() */ 1013} /* end setup_uclinux_memory() */
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index 8dec4dd57b4e..5a1b4cfea05b 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -14,6 +14,7 @@
14#include <linux/random.h> 14#include <linux/random.h>
15#include <linux/bootmem.h> 15#include <linux/bootmem.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/interrupt.h>
17 18
18#include <asm/system.h> 19#include <asm/system.h>
19#include <asm/traps.h> 20#include <asm/traps.h>
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
index b2e86d0255e6..cd3734614d9d 100644
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -173,7 +173,7 @@ void __init setup_arch(char **cmdline_p)
173 * the bootmem bitmap so we then reserve it after freeing it :-) 173 * the bootmem bitmap so we then reserve it after freeing it :-)
174 */ 174 */
175 free_bootmem(memory_start, memory_end - memory_start); 175 free_bootmem(memory_start, memory_end - memory_start);
176 reserve_bootmem(memory_start, bootmap_size); 176 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
177 /* 177 /*
178 * get kmalloc into gear 178 * get kmalloc into gear
179 */ 179 */
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index d6cd45f4c6c7..0823de1f6ebe 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -129,13 +129,14 @@ void machine_kexec(struct kimage *image)
129 129
130void arch_crash_save_vmcoreinfo(void) 130void arch_crash_save_vmcoreinfo(void)
131{ 131{
132#if defined(CONFIG_ARCH_DISCONTIGMEM_ENABLE) && defined(CONFIG_NUMA) 132#if defined(CONFIG_DISCONTIGMEM) || defined(CONFIG_SPARSEMEM)
133 VMCOREINFO_SYMBOL(pgdat_list); 133 VMCOREINFO_SYMBOL(pgdat_list);
134 VMCOREINFO_LENGTH(pgdat_list, MAX_NUMNODES); 134 VMCOREINFO_LENGTH(pgdat_list, MAX_NUMNODES);
135 135#endif
136#ifdef CONFIG_NUMA
136 VMCOREINFO_SYMBOL(node_memblk); 137 VMCOREINFO_SYMBOL(node_memblk);
137 VMCOREINFO_LENGTH(node_memblk, NR_NODE_MEMBLKS); 138 VMCOREINFO_LENGTH(node_memblk, NR_NODE_MEMBLKS);
138 VMCOREINFO_SIZE(node_memblk_s); 139 VMCOREINFO_STRUCT_SIZE(node_memblk_s);
139 VMCOREINFO_OFFSET(node_memblk_s, start_paddr); 140 VMCOREINFO_OFFSET(node_memblk_s, start_paddr);
140 VMCOREINFO_OFFSET(node_memblk_s, size); 141 VMCOREINFO_OFFSET(node_memblk_s, size);
141#endif 142#endif
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 480b1a5085d5..32ee5979a042 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -120,7 +120,6 @@ static volatile unsigned long go[SLAVE + 1];
120 120
121#define DEBUG_ITC_SYNC 0 121#define DEBUG_ITC_SYNC 0
122 122
123extern void __devinit calibrate_delay (void);
124extern void start_ap (void); 123extern void start_ap (void);
125extern unsigned long ia64_iobase; 124extern unsigned long ia64_iobase;
126 125
@@ -477,7 +476,7 @@ start_secondary (void *unused)
477 return 0; 476 return 0;
478} 477}
479 478
480struct pt_regs * __devinit idle_regs(struct pt_regs *regs) 479struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
481{ 480{
482 return NULL; 481 return NULL;
483} 482}
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 7e9c275ea148..344f64eca7a9 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -218,7 +218,7 @@ find_memory (void)
218 218
219 /* Free all available memory, then mark bootmem-map as being in use. */ 219 /* Free all available memory, then mark bootmem-map as being in use. */
220 efi_memmap_walk(filter_rsvd_memory, free_bootmem); 220 efi_memmap_walk(filter_rsvd_memory, free_bootmem);
221 reserve_bootmem(bootmap_start, bootmap_size); 221 reserve_bootmem(bootmap_start, bootmap_size, BOOTMEM_DEFAULT);
222 222
223 find_initrd(); 223 find_initrd();
224 224
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 0b567398f38e..ee5e68b2af94 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -299,12 +299,12 @@ static void __init reserve_pernode_space(void)
299 pages = bdp->node_low_pfn - (bdp->node_boot_start>>PAGE_SHIFT); 299 pages = bdp->node_low_pfn - (bdp->node_boot_start>>PAGE_SHIFT);
300 size = bootmem_bootmap_pages(pages) << PAGE_SHIFT; 300 size = bootmem_bootmap_pages(pages) << PAGE_SHIFT;
301 base = __pa(bdp->node_bootmem_map); 301 base = __pa(bdp->node_bootmem_map);
302 reserve_bootmem_node(pdp, base, size); 302 reserve_bootmem_node(pdp, base, size, BOOTMEM_DEFAULT);
303 303
304 /* Now the per-node space */ 304 /* Now the per-node space */
305 size = mem_data[node].pernode_size; 305 size = mem_data[node].pernode_size;
306 base = __pa(mem_data[node].pernode_addr); 306 base = __pa(mem_data[node].pernode_addr);
307 reserve_bootmem_node(pdp, base, size); 307 reserve_bootmem_node(pdp, base, size, BOOTMEM_DEFAULT);
308 } 308 }
309} 309}
310 310
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index ab3eaf85fe4d..2c676cc05418 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -100,11 +100,11 @@ u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus)
100static irqreturn_t 100static irqreturn_t
101pcibr_error_intr_handler(int irq, void *arg) 101pcibr_error_intr_handler(int irq, void *arg)
102{ 102{
103 struct pcibus_info *soft = (struct pcibus_info *)arg; 103 struct pcibus_info *soft = arg;
104 104
105 if (sal_pcibr_error_interrupt(soft) < 0) { 105 if (sal_pcibr_error_interrupt(soft) < 0)
106 panic("pcibr_error_intr_handler(): Fatal Bridge Error"); 106 panic("pcibr_error_intr_handler(): Fatal Bridge Error");
107 } 107
108 return IRQ_HANDLED; 108 return IRQ_HANDLED;
109} 109}
110 110
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index d64814385d70..f1f5db0c4084 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -177,25 +177,28 @@ static unsigned long __init setup_memory(void)
177 */ 177 */
178 reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE, 178 reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE,
179 (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1) 179 (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1)
180 - CONFIG_MEMORY_START); 180 - CONFIG_MEMORY_START,
181 BOOTMEM_DEFAULT);
181 182
182 /* 183 /*
183 * reserve physical page 0 - it's a special BIOS page on many boxes, 184 * reserve physical page 0 - it's a special BIOS page on many boxes,
184 * enabling clean reboots, SMP operation, laptop functions. 185 * enabling clean reboots, SMP operation, laptop functions.
185 */ 186 */
186 reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE); 187 reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT);
187 188
188 /* 189 /*
189 * reserve memory hole 190 * reserve memory hole
190 */ 191 */
191#ifdef CONFIG_MEMHOLE 192#ifdef CONFIG_MEMHOLE
192 reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE); 193 reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE,
194 BOOTMEM_DEFAULT);
193#endif 195#endif
194 196
195#ifdef CONFIG_BLK_DEV_INITRD 197#ifdef CONFIG_BLK_DEV_INITRD
196 if (LOADER_TYPE && INITRD_START) { 198 if (LOADER_TYPE && INITRD_START) {
197 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 199 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
198 reserve_bootmem(INITRD_START, INITRD_SIZE); 200 reserve_bootmem(INITRD_START, INITRD_SIZE,
201 BOOTMEM_DEFAULT);
199 initrd_start = INITRD_START + PAGE_OFFSET; 202 initrd_start = INITRD_START + PAGE_OFFSET;
200 initrd_end = initrd_start + INITRD_SIZE; 203 initrd_end = initrd_start + INITRD_SIZE;
201 printk("initrd:start[%08lx],size[%08lx]\n", 204 printk("initrd:start[%08lx],size[%08lx]\n",
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 0e383da158e9..2c03ac1d005f 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -43,6 +43,7 @@
43#include <linux/init.h> 43#include <linux/init.h>
44#include <linux/kernel.h> 44#include <linux/kernel.h>
45#include <linux/mm.h> 45#include <linux/mm.h>
46#include <linux/sched.h>
46#include <linux/err.h> 47#include <linux/err.h>
47#include <linux/irq.h> 48#include <linux/irq.h>
48#include <linux/bootmem.h> 49#include <linux/bootmem.h>
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index c7efdb0aefc5..07c1af7dc0e2 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -91,7 +91,8 @@ unsigned long __init setup_memory(void)
91 PFN_PHYS(mp->pages)); 91 PFN_PHYS(mp->pages));
92 92
93 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), 93 reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn),
94 PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size); 94 PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size,
95 BOOTMEM_DEFAULT);
95 96
96 if (max_low_pfn < max_pfn) 97 if (max_low_pfn < max_pfn)
97 max_low_pfn = max_pfn; 98 max_low_pfn = max_pfn;
@@ -104,7 +105,7 @@ unsigned long __init setup_memory(void)
104 if (LOADER_TYPE && INITRD_START) { 105 if (LOADER_TYPE && INITRD_START) {
105 if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) { 106 if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) {
106 reserve_bootmem_node(NODE_DATA(0), INITRD_START, 107 reserve_bootmem_node(NODE_DATA(0), INITRD_START,
107 INITRD_SIZE); 108 INITRD_SIZE, BOOTMEM_DEFAULT);
108 initrd_start = INITRD_START + PAGE_OFFSET; 109 initrd_start = INITRD_START + PAGE_OFFSET;
109 initrd_end = initrd_start + INITRD_SIZE; 110 initrd_end = initrd_start + INITRD_SIZE;
110 printk("initrd:start[%08lx],size[%08lx]\n", 111 printk("initrd:start[%08lx],size[%08lx]\n",
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
index d10726f9038b..cbe36538af47 100644
--- a/arch/m68k/amiga/chipram.c
+++ b/arch/m68k/amiga/chipram.c
@@ -32,12 +32,10 @@ void __init amiga_chip_init(void)
32 if (!AMIGAHW_PRESENT(CHIP_RAM)) 32 if (!AMIGAHW_PRESENT(CHIP_RAM))
33 return; 33 return;
34 34
35#ifndef CONFIG_APUS_FAST_EXCEPT
36 /* 35 /*
37 * Remove the first 4 pages where PPC exception handlers will be located 36 * Remove the first 4 pages where PPC exception handlers will be located
38 */ 37 */
39 amiga_chip_size -= 0x4000; 38 amiga_chip_size -= 0x4000;
40#endif
41 chipram_res.end = amiga_chip_size-1; 39 chipram_res.end = amiga_chip_size-1;
42 request_resource(&iomem_resource, &chipram_res); 40 request_resource(&iomem_resource, &chipram_res);
43 41
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index c4a4ffd45bc0..343fab49bd9a 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -84,7 +84,7 @@ unsigned char cia_able_irq(struct ciabase *base, unsigned char mask)
84 84
85static irqreturn_t cia_handler(int irq, void *dev_id) 85static irqreturn_t cia_handler(int irq, void *dev_id)
86{ 86{
87 struct ciabase *base = (struct ciabase *)dev_id; 87 struct ciabase *base = dev_id;
88 int mach_irq; 88 int mach_irq;
89 unsigned char ints; 89 unsigned char ints;
90 90
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 8dda6515887a..0055a6c06f75 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -154,7 +154,7 @@ void __init atari_stram_reserve_pages(void *start_mem)
154 /* always reserve first page of ST-RAM, the first 2 kB are 154 /* always reserve first page of ST-RAM, the first 2 kB are
155 * supervisor-only! */ 155 * supervisor-only! */
156 if (!kernel_in_stram) 156 if (!kernel_in_stram)
157 reserve_bootmem (0, PAGE_SIZE); 157 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
158 158
159} 159}
160 160
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index ed3a4caec620..9a06c48edcb3 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -323,7 +323,8 @@ void __init setup_arch(char **cmdline_p)
323#ifdef CONFIG_BLK_DEV_INITRD 323#ifdef CONFIG_BLK_DEV_INITRD
324 if (m68k_ramdisk.size) { 324 if (m68k_ramdisk.size) {
325 reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)), 325 reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)),
326 m68k_ramdisk.addr, m68k_ramdisk.size); 326 m68k_ramdisk.addr, m68k_ramdisk.size,
327 BOOTMEM_DEFAULT);
327 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 328 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
328 initrd_end = initrd_start + m68k_ramdisk.size; 329 initrd_end = initrd_start + m68k_ramdisk.size;
329 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 330 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index 81507c53d4a9..156c6c662c7e 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -203,7 +203,7 @@ void __init setup_arch(char **cmdline_p)
203 * the bootmem bitmap so we then reserve it after freeing it :-) 203 * the bootmem bitmap so we then reserve it after freeing it :-)
204 */ 204 */
205 free_bootmem(memory_start, memory_end - memory_start); 205 free_bootmem(memory_start, memory_end - memory_start);
206 reserve_bootmem(memory_start, bootmap_size); 206 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
207 207
208 /* 208 /*
209 * Get kmalloc into gear. 209 * Get kmalloc into gear.
diff --git a/arch/m68knommu/lib/memcpy.c b/arch/m68knommu/lib/memcpy.c
index 0d5577569e4c..b50dbcad4746 100644
--- a/arch/m68knommu/lib/memcpy.c
+++ b/arch/m68knommu/lib/memcpy.c
@@ -1,6 +1,5 @@
1 1
2#include <linux/types.h> 2#include <linux/types.h>
3#include <linux/autoconf.h>
4 3
5void * memcpy(void * to, const void * from, size_t n) 4void * memcpy(void * to, const void * from, size_t n)
6{ 5{
diff --git a/arch/mips/au1000/common/gpio.c b/arch/mips/au1000/common/gpio.c
index 8527856aec45..0b658f1db4ce 100644
--- a/arch/mips/au1000/common/gpio.c
+++ b/arch/mips/au1000/common/gpio.c
@@ -27,7 +27,6 @@
27 * others have a second one : GPIO2 27 * others have a second one : GPIO2
28 */ 28 */
29 29
30#include <linux/autoconf.h>
31#include <linux/init.h> 30#include <linux/init.h>
32#include <linux/io.h> 31#include <linux/io.h>
33#include <linux/types.h> 32#include <linux/types.h>
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c032409cba9b..39f3dfe134fb 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -232,7 +232,7 @@ static void __init finalize_initrd(void)
232 goto disable; 232 goto disable;
233 } 233 }
234 234
235 reserve_bootmem(__pa(initrd_start), size); 235 reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
236 initrd_below_start_ok = 1; 236 initrd_below_start_ok = 1;
237 237
238 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n", 238 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n",
@@ -413,7 +413,7 @@ static void __init bootmem_init(void)
413 /* 413 /*
414 * Reserve the bootmap memory. 414 * Reserve the bootmap memory.
415 */ 415 */
416 reserve_bootmem(PFN_PHYS(mapstart), bootmap_size); 416 reserve_bootmem(PFN_PHYS(mapstart), bootmap_size, BOOTMEM_DEFAULT);
417 417
418 /* 418 /*
419 * Reserve initrd memory if needed. 419 * Reserve initrd memory if needed.
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 1e5dfc28294a..9d41dab90a80 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -52,7 +52,6 @@ int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
52EXPORT_SYMBOL(phys_cpu_present_map); 52EXPORT_SYMBOL(phys_cpu_present_map);
53EXPORT_SYMBOL(cpu_online_map); 53EXPORT_SYMBOL(cpu_online_map);
54 54
55extern void __init calibrate_delay(void);
56extern void cpu_idle(void); 55extern void cpu_idle(void);
57 56
58/* Number of TCs (or siblings in Intel speak) per CPU core */ 57/* Number of TCs (or siblings in Intel speak) per CPU core */
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 4c477c7ff74a..22fd41e946b2 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -356,7 +356,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
356 retval = NGROUPS_MAX; 356 retval = NGROUPS_MAX;
357 goto out; 357 goto out;
358 case 5: 358 case 5:
359 retval = NR_OPEN; 359 retval = sysctl_nr_open;
360 goto out; 360 goto out;
361 case 6: 361 case 6:
362 retval = 1; 362 retval = 1;
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index e5e023f50a07..bf438d02366e 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -465,7 +465,8 @@ static void __init node_mem_init(cnodeid_t node)
465 free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 465 free_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
466 (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT); 466 (slot_lastpfn - slot_firstpfn) << PAGE_SHIFT);
467 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT, 467 reserve_bootmem_node(NODE_DATA(node), slot_firstpfn << PAGE_SHIFT,
468 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size); 468 ((slot_freepfn - slot_firstpfn) << PAGE_SHIFT) + bootmap_size,
469 BOOTMEM_DEFAULT);
469} 470}
470 471
471/* 472/*
diff --git a/arch/parisc/Kconfig.debug b/arch/parisc/Kconfig.debug
index 9166bd117267..bc989e522a04 100644
--- a/arch/parisc/Kconfig.debug
+++ b/arch/parisc/Kconfig.debug
@@ -2,15 +2,6 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_RWLOCK
6 bool "Read-write spinlock debugging"
7 depends on DEBUG_KERNEL && SMP
8 help
9 If you say Y here then read-write lock processing will count how many
10 times it has tried to get the lock and issue an error message after
11 too many attempts. If you suspect a rwlock problem or a kernel
12 hacker asks for this option then say Y. Otherwise say N.
13
14config DEBUG_RODATA 5config DEBUG_RODATA
15 bool "Write protect kernel read-only data structures" 6 bool "Write protect kernel read-only data structures"
16 depends on DEBUG_KERNEL 7 depends on DEBUG_KERNEL
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index ea071218a3ed..ddacc72e38fb 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -1050,7 +1050,6 @@ CONFIG_SCHED_DEBUG=y
1050CONFIG_FORCED_INLINING=y 1050CONFIG_FORCED_INLINING=y
1051# CONFIG_RCU_TORTURE_TEST is not set 1051# CONFIG_RCU_TORTURE_TEST is not set
1052# CONFIG_FAULT_INJECTION is not set 1052# CONFIG_FAULT_INJECTION is not set
1053# CONFIG_DEBUG_RWLOCK is not set
1054# CONFIG_DEBUG_RODATA is not set 1053# CONFIG_DEBUG_RODATA is not set
1055 1054
1056# 1055#
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index aa875fa43488..eb80f5e33d7d 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -315,11 +315,13 @@ static void __init setup_bootmem(void)
315#define PDC_CONSOLE_IO_IODC_SIZE 32768 315#define PDC_CONSOLE_IO_IODC_SIZE 32768
316 316
317 reserve_bootmem_node(NODE_DATA(0), 0UL, 317 reserve_bootmem_node(NODE_DATA(0), 0UL,
318 (unsigned long)(PAGE0->mem_free + PDC_CONSOLE_IO_IODC_SIZE)); 318 (unsigned long)(PAGE0->mem_free +
319 PDC_CONSOLE_IO_IODC_SIZE), BOOTMEM_DEFAULT);
319 reserve_bootmem_node(NODE_DATA(0), __pa((unsigned long)_text), 320 reserve_bootmem_node(NODE_DATA(0), __pa((unsigned long)_text),
320 (unsigned long)(_end - _text)); 321 (unsigned long)(_end - _text), BOOTMEM_DEFAULT);
321 reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT), 322 reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT),
322 ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT)); 323 ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT),
324 BOOTMEM_DEFAULT);
323 325
324#ifndef CONFIG_DISCONTIGMEM 326#ifndef CONFIG_DISCONTIGMEM
325 327
@@ -328,7 +330,8 @@ static void __init setup_bootmem(void)
328 for (i = 0; i < npmem_holes; i++) { 330 for (i = 0; i < npmem_holes; i++) {
329 reserve_bootmem_node(NODE_DATA(0), 331 reserve_bootmem_node(NODE_DATA(0),
330 (pmem_holes[i].start_pfn << PAGE_SHIFT), 332 (pmem_holes[i].start_pfn << PAGE_SHIFT),
331 (pmem_holes[i].pages << PAGE_SHIFT)); 333 (pmem_holes[i].pages << PAGE_SHIFT),
334 BOOTMEM_DEFAULT);
332 } 335 }
333#endif 336#endif
334 337
@@ -346,7 +349,8 @@ static void __init setup_bootmem(void)
346 initrd_below_start_ok = 1; 349 initrd_below_start_ok = 1;
347 printk(KERN_INFO "initrd: reserving %08lx-%08lx (mem_max %08lx)\n", __pa(initrd_start), __pa(initrd_start) + initrd_reserve, mem_max); 350 printk(KERN_INFO "initrd: reserving %08lx-%08lx (mem_max %08lx)\n", __pa(initrd_start), __pa(initrd_start) + initrd_reserve, mem_max);
348 351
349 reserve_bootmem_node(NODE_DATA(0),__pa(initrd_start), initrd_reserve); 352 reserve_bootmem_node(NODE_DATA(0), __pa(initrd_start),
353 initrd_reserve, BOOTMEM_DEFAULT);
350 } 354 }
351 } 355 }
352#endif 356#endif
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 5cd3db5cae41..3b26fbd6bec9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -66,6 +66,7 @@
66#include <asm/smp.h> 66#include <asm/smp.h>
67#include <asm/vdso_datapage.h> 67#include <asm/vdso_datapage.h>
68#include <asm/firmware.h> 68#include <asm/firmware.h>
69#include <asm/cputime.h>
69#ifdef CONFIG_PPC_ISERIES 70#ifdef CONFIG_PPC_ISERIES
70#include <asm/iseries/it_lp_queue.h> 71#include <asm/iseries/it_lp_queue.h>
71#include <asm/iseries/hv_call_xm.h> 72#include <asm/iseries/hv_call_xm.h>
@@ -189,6 +190,8 @@ u64 __cputime_sec_factor;
189EXPORT_SYMBOL(__cputime_sec_factor); 190EXPORT_SYMBOL(__cputime_sec_factor);
190u64 __cputime_clockt_factor; 191u64 __cputime_clockt_factor;
191EXPORT_SYMBOL(__cputime_clockt_factor); 192EXPORT_SYMBOL(__cputime_clockt_factor);
193DEFINE_PER_CPU(unsigned long, cputime_last_delta);
194DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta);
192 195
193static void calc_cputime_factors(void) 196static void calc_cputime_factors(void)
194{ 197{
@@ -257,8 +260,8 @@ void account_system_vtime(struct task_struct *tsk)
257 } 260 }
258 account_system_time(tsk, 0, delta); 261 account_system_time(tsk, 0, delta);
259 account_system_time_scaled(tsk, deltascaled); 262 account_system_time_scaled(tsk, deltascaled);
260 get_paca()->purrdelta = delta; 263 per_cpu(cputime_last_delta, smp_processor_id()) = delta;
261 get_paca()->spurrdelta = deltascaled; 264 per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
262 local_irq_restore(flags); 265 local_irq_restore(flags);
263} 266}
264 267
@@ -276,10 +279,7 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
276 get_paca()->user_time = 0; 279 get_paca()->user_time = 0;
277 account_user_time(tsk, utime); 280 account_user_time(tsk, utime);
278 281
279 /* Estimate the scaled utime by scaling the real utime based 282 utimescaled = cputime_to_scaled(utime);
280 * on the last spurr to purr ratio */
281 utimescaled = utime * get_paca()->spurrdelta / get_paca()->purrdelta;
282 get_paca()->spurrdelta = get_paca()->purrdelta = 0;
283 account_user_time_scaled(tsk, utimescaled); 283 account_user_time_scaled(tsk, utimescaled);
284} 284}
285 285
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index c7d7bd43a251..93a5c53e3423 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -220,12 +220,13 @@ void __init do_init_bootmem(void)
220 lmb_size_bytes(&lmb.reserved, i) - 1; 220 lmb_size_bytes(&lmb.reserved, i) - 1;
221 if (addr < total_lowmem) 221 if (addr < total_lowmem)
222 reserve_bootmem(lmb.reserved.region[i].base, 222 reserve_bootmem(lmb.reserved.region[i].base,
223 lmb_size_bytes(&lmb.reserved, i)); 223 lmb_size_bytes(&lmb.reserved, i),
224 BOOTMEM_DEFAULT);
224 else if (lmb.reserved.region[i].base < total_lowmem) { 225 else if (lmb.reserved.region[i].base < total_lowmem) {
225 unsigned long adjusted_size = total_lowmem - 226 unsigned long adjusted_size = total_lowmem -
226 lmb.reserved.region[i].base; 227 lmb.reserved.region[i].base;
227 reserve_bootmem(lmb.reserved.region[i].base, 228 reserve_bootmem(lmb.reserved.region[i].base,
228 adjusted_size); 229 adjusted_size, BOOTMEM_DEFAULT);
229 } 230 }
230 } 231 }
231#else 232#else
@@ -234,7 +235,8 @@ void __init do_init_bootmem(void)
234 /* reserve the sections we're already using */ 235 /* reserve the sections we're already using */
235 for (i = 0; i < lmb.reserved.cnt; i++) 236 for (i = 0; i < lmb.reserved.cnt; i++)
236 reserve_bootmem(lmb.reserved.region[i].base, 237 reserve_bootmem(lmb.reserved.region[i].base,
237 lmb_size_bytes(&lmb.reserved, i)); 238 lmb_size_bytes(&lmb.reserved, i),
239 BOOTMEM_DEFAULT);
238 240
239#endif 241#endif
240 /* XXX need to clip this if using highmem? */ 242 /* XXX need to clip this if using highmem? */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index e9139d267ea4..a300d254aac6 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -731,7 +731,7 @@ void __init do_init_bootmem(void)
731 dbg("reserve_bootmem %lx %lx\n", physbase, 731 dbg("reserve_bootmem %lx %lx\n", physbase,
732 size); 732 size);
733 reserve_bootmem_node(NODE_DATA(nid), physbase, 733 reserve_bootmem_node(NODE_DATA(nid), physbase,
734 size); 734 size, BOOTMEM_DEFAULT);
735 } 735 }
736 } 736 }
737 737
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index c04abcc28a7a..792d3ce8112e 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -113,8 +113,6 @@ static inline void debug_calc_bogomips(void)
113 * result. We backup/restore the value to avoid affecting the 113 * result. We backup/restore the value to avoid affecting the
114 * core cpufreq framework's own calculation. 114 * core cpufreq framework's own calculation.
115 */ 115 */
116 extern void calibrate_delay(void);
117
118 unsigned long save_lpj = loops_per_jiffy; 116 unsigned long save_lpj = loops_per_jiffy;
119 calibrate_delay(); 117 calibrate_delay();
120 loops_per_jiffy = save_lpj; 118 loops_per_jiffy = save_lpj;
diff --git a/arch/ppc/8260_io/enet.c b/arch/ppc/8260_io/enet.c
index 25ef55bacd99..ec1defea9c1e 100644
--- a/arch/ppc/8260_io/enet.c
+++ b/arch/ppc/8260_io/enet.c
@@ -418,7 +418,7 @@ scc_enet_rx(struct net_device *dev)
418 struct sk_buff *skb; 418 struct sk_buff *skb;
419 ushort pkt_len; 419 ushort pkt_len;
420 420
421 cep = (struct scc_enet_private *)dev->priv; 421 cep = dev->priv;
422 422
423 /* First, grab all of the stats for the incoming packet. 423 /* First, grab all of the stats for the incoming packet.
424 * These get messed up if we get called due to a busy condition. 424 * These get messed up if we get called due to a busy condition.
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c
index a3a27dafff1f..bcc3aa9d04f3 100644
--- a/arch/ppc/8260_io/fcc_enet.c
+++ b/arch/ppc/8260_io/fcc_enet.c
@@ -682,7 +682,7 @@ fcc_enet_rx(struct net_device *dev)
682 struct sk_buff *skb; 682 struct sk_buff *skb;
683 ushort pkt_len; 683 ushort pkt_len;
684 684
685 cep = (struct fcc_enet_private *)dev->priv; 685 cep = dev->priv;
686 686
687 /* First, grab all of the stats for the incoming packet. 687 /* First, grab all of the stats for the incoming packet.
688 * These get messed up if we get called due to a busy condition. 688 * These get messed up if we get called due to a busy condition.
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 52b64fcbdfc5..8a24bc47eb6c 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -143,11 +143,6 @@ SECTIONS
143 143
144 . = ALIGN(4096); 144 . = ALIGN(4096);
145 __init_end = .; 145 __init_end = .;
146
147 . = ALIGN(4096);
148 _sextratext = .;
149 _eextratext = .;
150
151 __bss_start = .; 146 __bss_start = .;
152 .bss : 147 .bss :
153 { 148 {
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
index 3c56654bfc6f..38449855d5ff 100644
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -91,20 +91,11 @@ extern void prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi
91#define cached_21 (((char *)(ppc_cached_irq_mask))[3]) 91#define cached_21 (((char *)(ppc_cached_irq_mask))[3])
92#define cached_A1 (((char *)(ppc_cached_irq_mask))[2]) 92#define cached_A1 (((char *)(ppc_cached_irq_mask))[2])
93 93
94#ifdef CONFIG_SOUND_CS4232
95long ppc_cs4232_dma, ppc_cs4232_dma2;
96#endif
97
98extern PTE *Hash, *Hash_end; 94extern PTE *Hash, *Hash_end;
99extern unsigned long Hash_size, Hash_mask; 95extern unsigned long Hash_size, Hash_mask;
100extern int probingmem; 96extern int probingmem;
101extern unsigned long loops_per_jiffy; 97extern unsigned long loops_per_jiffy;
102 98
103#ifdef CONFIG_SOUND_CS4232
104EXPORT_SYMBOL(ppc_cs4232_dma);
105EXPORT_SYMBOL(ppc_cs4232_dma2);
106#endif
107
108/* useful ISA ports */ 99/* useful ISA ports */
109#define PREP_SYSCTL 0x81c 100#define PREP_SYSCTL 0x81c
110/* present in the IBM reference design; possibly identical in Mot boxes: */ 101/* present in the IBM reference design; possibly identical in Mot boxes: */
@@ -569,74 +560,6 @@ prep_show_percpuinfo(struct seq_file *m, int i)
569 return 0; 560 return 0;
570} 561}
571 562
572#ifdef CONFIG_SOUND_CS4232
573static long __init masktoint(unsigned int i)
574{
575 int t = -1;
576 while (i >> ++t)
577 ;
578 return (t-1);
579}
580
581/*
582 * ppc_cs4232_dma and ppc_cs4232_dma2 are used in include/asm/dma.h
583 * to distinguish sound dma-channels from others. This is because
584 * blocksize on 16 bit dma-channels 5,6,7 is 128k, but
585 * the cs4232.c uses 64k like on 8 bit dma-channels 0,1,2,3
586 */
587
588static void __init prep_init_sound(void)
589{
590 PPC_DEVICE *audiodevice = NULL;
591
592 /*
593 * Get the needed resource information from residual data.
594 *
595 */
596 if (have_residual_data)
597 audiodevice = residual_find_device(~0, NULL,
598 MultimediaController, AudioController, -1, 0);
599
600 if (audiodevice != NULL) {
601 PnP_TAG_PACKET *pkt;
602
603 pkt = PnP_find_packet((unsigned char *)&res->DevicePnPHeap[audiodevice->AllocatedOffset],
604 S5_Packet, 0);
605 if (pkt != NULL)
606 ppc_cs4232_dma = masktoint(pkt->S5_Pack.DMAMask);
607 pkt = PnP_find_packet((unsigned char*)&res->DevicePnPHeap[audiodevice->AllocatedOffset],
608 S5_Packet, 1);
609 if (pkt != NULL)
610 ppc_cs4232_dma2 = masktoint(pkt->S5_Pack.DMAMask);
611 }
612
613 /*
614 * These are the PReP specs' defaults for the cs4231. We use these
615 * as fallback incase we don't have residual data.
616 * At least the IBM Thinkpad 850 with IDE DMA Channels at 6 and 7
617 * will use the other values.
618 */
619 if (audiodevice == NULL) {
620 switch (_prep_type) {
621 case _PREP_IBM:
622 ppc_cs4232_dma = 1;
623 ppc_cs4232_dma2 = -1;
624 break;
625 default:
626 ppc_cs4232_dma = 6;
627 ppc_cs4232_dma2 = 7;
628 }
629 }
630
631 /*
632 * Find a way to push this information to the cs4232 driver
633 * Give it out with printk, when not in cmd_line?
634 * Append it to cmd_line and boot_command_line?
635 * Format is cs4232=io,irq,dma,dma2
636 */
637}
638#endif /* CONFIG_SOUND_CS4232 */
639
640/* 563/*
641 * Fill out screen_info according to the residual data. This allows us to use 564 * Fill out screen_info according to the residual data. This allows us to use
642 * at least vesafb. 565 * at least vesafb.
@@ -898,10 +821,6 @@ prep_setup_arch(void)
898 } 821 }
899 } 822 }
900 823
901#ifdef CONFIG_SOUND_CS4232
902 prep_init_sound();
903#endif /* CONFIG_SOUND_CS4232 */
904
905 prep_init_vesa(); 824 prep_init_vesa();
906 825
907 switch (_prep_type) { 826 switch (_prep_type) {
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 29ae165d1749..f9f8779022a0 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -649,21 +649,24 @@ setup_memory(void)
649 /* 649 /*
650 * Reserve memory used for lowcore/command line/kernel image. 650 * Reserve memory used for lowcore/command line/kernel image.
651 */ 651 */
652 reserve_bootmem(0, (unsigned long)_ehead); 652 reserve_bootmem(0, (unsigned long)_ehead, BOOTMEM_DEFAULT);
653 reserve_bootmem((unsigned long)_stext, 653 reserve_bootmem((unsigned long)_stext,
654 PFN_PHYS(start_pfn) - (unsigned long)_stext); 654 PFN_PHYS(start_pfn) - (unsigned long)_stext,
655 BOOTMEM_DEFAULT);
655 /* 656 /*
656 * Reserve the bootmem bitmap itself as well. We do this in two 657 * Reserve the bootmem bitmap itself as well. We do this in two
657 * steps (first step was init_bootmem()) because this catches 658 * steps (first step was init_bootmem()) because this catches
658 * the (very unlikely) case of us accidentally initializing the 659 * the (very unlikely) case of us accidentally initializing the
659 * bootmem allocator with an invalid RAM area. 660 * bootmem allocator with an invalid RAM area.
660 */ 661 */
661 reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size); 662 reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size,
663 BOOTMEM_DEFAULT);
662 664
663#ifdef CONFIG_BLK_DEV_INITRD 665#ifdef CONFIG_BLK_DEV_INITRD
664 if (INITRD_START && INITRD_SIZE) { 666 if (INITRD_START && INITRD_SIZE) {
665 if (INITRD_START + INITRD_SIZE <= memory_end) { 667 if (INITRD_START + INITRD_SIZE <= memory_end) {
666 reserve_bootmem(INITRD_START, INITRD_SIZE); 668 reserve_bootmem(INITRD_START, INITRD_SIZE,
669 BOOTMEM_DEFAULT);
667 initrd_start = INITRD_START; 670 initrd_start = INITRD_START;
668 initrd_end = initrd_start + INITRD_SIZE; 671 initrd_end = initrd_start + INITRD_SIZE;
669 } else { 672 } else {
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c
index eda71763ecc5..2b708ec72558 100644
--- a/arch/sh/boards/landisk/setup.c
+++ b/arch/sh/boards/landisk/setup.c
@@ -14,7 +14,7 @@
14 */ 14 */
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/pata_platform.h> 17#include <linux/ata_platform.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <asm/machvec.h> 20#include <asm/machvec.h>
diff --git a/arch/sh/boards/lboxre2/setup.c b/arch/sh/boards/lboxre2/setup.c
index 9c830fdc411b..c74440d38ee9 100644
--- a/arch/sh/boards/lboxre2/setup.c
+++ b/arch/sh/boards/lboxre2/setup.c
@@ -13,7 +13,7 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/pata_platform.h> 16#include <linux/ata_platform.h>
17#include <asm/machvec.h> 17#include <asm/machvec.h>
18#include <asm/addrspace.h> 18#include <asm/addrspace.h>
19#include <asm/lboxre2.h> 19#include <asm/lboxre2.h>
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index a43b47726f54..f7a8d5c9d510 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -15,7 +15,7 @@
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/pata_platform.h> 18#include <linux/ata_platform.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <net/ax88796.h> 20#include <net/ax88796.h>
21#include <asm/machvec.h> 21#include <asm/machvec.h>
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 3452b072adde..a0ef81b7de37 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -10,7 +10,7 @@
10 */ 10 */
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/pata_platform.h> 13#include <linux/ata_platform.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/sm501.h> 15#include <linux/sm501.h>
16#include <linux/sm501-regs.h> 16#include <linux/sm501-regs.h>
diff --git a/arch/sh/boards/renesas/sdk7780/setup.c b/arch/sh/boards/renesas/sdk7780/setup.c
index 5df32f201870..acc5932587f1 100644
--- a/arch/sh/boards/renesas/sdk7780/setup.c
+++ b/arch/sh/boards/renesas/sdk7780/setup.c
@@ -11,7 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/pata_platform.h> 14#include <linux/ata_platform.h>
15#include <asm/machvec.h> 15#include <asm/machvec.h>
16#include <asm/sdk7780.h> 16#include <asm/sdk7780.h>
17#include <asm/heartbeat.h> 17#include <asm/heartbeat.h>
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c
index eb97dca5b736..b1a3d9d0172f 100644
--- a/arch/sh/boards/se/7722/setup.c
+++ b/arch/sh/boards/se/7722/setup.c
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/pata_platform.h> 15#include <linux/ata_platform.h>
16#include <asm/machvec.h> 16#include <asm/machvec.h>
17#include <asm/se7722.h> 17#include <asm/se7722.h>
18#include <asm/io.h> 18#include <asm/io.h>
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 855cdf9d85b1..18a5baf2cbad 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -140,18 +140,26 @@ static void __init reserve_crashkernel(void)
140 ret = parse_crashkernel(boot_command_line, free_mem, 140 ret = parse_crashkernel(boot_command_line, free_mem,
141 &crash_size, &crash_base); 141 &crash_size, &crash_base);
142 if (ret == 0 && crash_size) { 142 if (ret == 0 && crash_size) {
143 if (crash_base > 0) { 143 if (crash_base <= 0) {
144 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
145 "for crashkernel (System RAM: %ldMB)\n",
146 (unsigned long)(crash_size >> 20),
147 (unsigned long)(crash_base >> 20),
148 (unsigned long)(free_mem >> 20));
149 crashk_res.start = crash_base;
150 crashk_res.end = crash_base + crash_size - 1;
151 reserve_bootmem(crash_base, crash_size);
152 } else
153 printk(KERN_INFO "crashkernel reservation failed - " 144 printk(KERN_INFO "crashkernel reservation failed - "
154 "you have to specify a base address\n"); 145 "you have to specify a base address\n");
146 return;
147 }
148
149 if (reserve_bootmem(crash_base, crash_size,
150 BOOTMEM_EXCLUSIVE) < 0) {
151 printk(KERN_INFO "crashkernel reservation failed - "
152 "memory is in use\n");
153 return;
154 }
155
156 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
157 "for crashkernel (System RAM: %ldMB)\n",
158 (unsigned long)(crash_size >> 20),
159 (unsigned long)(crash_base >> 20),
160 (unsigned long)(free_mem >> 20));
161 crashk_res.start = crash_base;
162 crashk_res.end = crash_base + crash_size - 1;
155 } 163 }
156} 164}
157#else 165#else
@@ -184,13 +192,14 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
184 * an invalid RAM area. 192 * an invalid RAM area.
185 */ 193 */
186 reserve_bootmem(__MEMORY_START+PAGE_SIZE, 194 reserve_bootmem(__MEMORY_START+PAGE_SIZE,
187 (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START); 195 (PFN_PHYS(free_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START,
196 BOOTMEM_DEFAULT);
188 197
189 /* 198 /*
190 * reserve physical page 0 - it's a special BIOS page on many boxes, 199 * reserve physical page 0 - it's a special BIOS page on many boxes,
191 * enabling clean reboots, SMP operation, laptop functions. 200 * enabling clean reboots, SMP operation, laptop functions.
192 */ 201 */
193 reserve_bootmem(__MEMORY_START, PAGE_SIZE); 202 reserve_bootmem(__MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT);
194 203
195 sparse_memory_present_with_active_regions(0); 204 sparse_memory_present_with_active_regions(0);
196 205
@@ -200,7 +209,7 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
200 if (LOADER_TYPE && INITRD_START) { 209 if (LOADER_TYPE && INITRD_START) {
201 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 210 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
202 reserve_bootmem(INITRD_START + __MEMORY_START, 211 reserve_bootmem(INITRD_START + __MEMORY_START,
203 INITRD_SIZE); 212 INITRD_SIZE, BOOTMEM_DEFAULT);
204 initrd_start = INITRD_START + PAGE_OFFSET + 213 initrd_start = INITRD_START + PAGE_OFFSET +
205 __MEMORY_START; 214 __MEMORY_START;
206 initrd_end = initrd_start + INITRD_SIZE; 215 initrd_end = initrd_start + INITRD_SIZE;
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 8aff065dd307..2de7302724fc 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -80,9 +80,9 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
80 80
81 /* Reserve the pgdat and bootmap space with the bootmem allocator */ 81 /* Reserve the pgdat and bootmap space with the bootmem allocator */
82 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT, 82 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
83 sizeof(struct pglist_data)); 83 sizeof(struct pglist_data), BOOTMEM_DEFAULT);
84 reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT, 84 reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT,
85 bootmap_pages << PAGE_SHIFT); 85 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
86 86
87 /* It's up */ 87 /* It's up */
88 node_set_online(nid); 88 node_set_online(nid);
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index 89a6de95070c..0def48158c7d 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -19,12 +19,12 @@
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/swap.h> 20#include <linux/swap.h>
21#include <linux/profile.h> 21#include <linux/profile.h>
22#include <linux/delay.h>
22 23
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
24#include <asm/atomic.h> 25#include <asm/atomic.h>
25#include <asm/irq_regs.h> 26#include <asm/irq_regs.h>
26 27
27#include <asm/delay.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/pgalloc.h> 30#include <asm/pgalloc.h>
@@ -41,8 +41,6 @@
41 41
42extern ctxd_t *srmmu_ctx_table_phys; 42extern ctxd_t *srmmu_ctx_table_phys;
43 43
44extern void calibrate_delay(void);
45
46static volatile int smp_processors_ready = 0; 44static volatile int smp_processors_ready = 0;
47static int smp_highest_cpu; 45static int smp_highest_cpu;
48extern volatile unsigned long cpu_callin_map[NR_CPUS]; 46extern volatile unsigned long cpu_callin_map[NR_CPUS];
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 730eb5796f8e..0b9407267162 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -16,6 +16,8 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18#include <linux/profile.h> 18#include <linux/profile.h>
19#include <linux/delay.h>
20
19#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
20#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
21#include <asm/irq_regs.h> 23#include <asm/irq_regs.h>
@@ -23,7 +25,6 @@
23#include <asm/ptrace.h> 25#include <asm/ptrace.h>
24#include <asm/atomic.h> 26#include <asm/atomic.h>
25 27
26#include <asm/delay.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
28#include <asm/page.h> 29#include <asm/page.h>
29#include <asm/pgalloc.h> 30#include <asm/pgalloc.h>
@@ -39,8 +40,6 @@
39 40
40extern ctxd_t *srmmu_ctx_table_phys; 41extern ctxd_t *srmmu_ctx_table_phys;
41 42
42extern void calibrate_delay(void);
43
44extern volatile unsigned long cpu_callin_map[NR_CPUS]; 43extern volatile unsigned long cpu_callin_map[NR_CPUS];
45extern unsigned char boot_cpu_id; 44extern unsigned char boot_cpu_id;
46 45
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index ee010f4532a0..9064485dc40b 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -79,7 +79,8 @@ sys_call_table:
79/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 79/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
80/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy 80/*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
81/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait 81/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
82/*310*/ .long sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate 82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime
83 84
84#ifdef CONFIG_SUNOS_EMUL 85#ifdef CONFIG_SUNOS_EMUL
85 /* Now the SunOS syscall table. */ 86 /* Now the SunOS syscall table. */
@@ -197,6 +198,7 @@ sunos_sys_table:
197 .long sunos_nosys, sunos_nosys, sunos_nosys 198 .long sunos_nosys, sunos_nosys, sunos_nosys
198 .long sunos_nosys 199 .long sunos_nosys
199/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys 200/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys
200 .long sunos_nosys, sunos_nosys 201 .long sunos_nosys, sunos_nosys, sunos_nosys
202 .long sunos_nosys
201 203
202#endif 204#endif
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
index a1bef07755a9..b89837accc88 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init.c
@@ -259,7 +259,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
259 if (initrd_start) { 259 if (initrd_start) {
260 /* Reserve the initrd image area. */ 260 /* Reserve the initrd image area. */
261 size = initrd_end - initrd_start; 261 size = initrd_end - initrd_start;
262 reserve_bootmem(initrd_start, size); 262 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
263 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; 263 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
264 264
265 initrd_start = (initrd_start - phys_base) + PAGE_OFFSET; 265 initrd_start = (initrd_start - phys_base) + PAGE_OFFSET;
@@ -268,7 +268,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
268#endif 268#endif
269 /* Reserve the kernel text/data/bss. */ 269 /* Reserve the kernel text/data/bss. */
270 size = (start_pfn << PAGE_SHIFT) - phys_base; 270 size = (start_pfn << PAGE_SHIFT) - phys_base;
271 reserve_bootmem(phys_base, size); 271 reserve_bootmem(phys_base, size, BOOTMEM_DEFAULT);
272 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; 272 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
273 273
274 /* Reserve the bootmem map. We do not account for it 274 /* Reserve the bootmem map. We do not account for it
@@ -276,7 +276,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
276 * in free_all_bootmem. 276 * in free_all_bootmem.
277 */ 277 */
278 size = bootmap_size; 278 size = bootmap_size;
279 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size); 279 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
280 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; 280 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
281 281
282 return max_pfn; 282 return max_pfn;
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index f62d9f6c5e2a..833d74b2b192 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc4 3# Linux kernel version: 2.6.24
4# Tue Dec 4 00:37:59 2007 4# Tue Feb 5 17:28:19 2008
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -17,6 +17,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 17# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 18# CONFIG_ARCH_HAS_ILOG2_U64 is not set
19CONFIG_AUDIT_ARCH=y 19CONFIG_AUDIT_ARCH=y
20CONFIG_HAVE_SETUP_PER_CPU_AREA=y
20CONFIG_ARCH_NO_VIRT_TO_BUS=y 21CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_OF=y 22CONFIG_OF=y
22CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
@@ -30,13 +31,15 @@ CONFIG_HZ_100=y
30# CONFIG_HZ_300 is not set 31# CONFIG_HZ_300 is not set
31# CONFIG_HZ_1000 is not set 32# CONFIG_HZ_1000 is not set
32CONFIG_HZ=100 33CONFIG_HZ=100
34# CONFIG_SCHED_HRTICK is not set
35CONFIG_HOTPLUG_CPU=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34 37
35# 38#
36# General setup 39# General setup
37# 40#
38CONFIG_EXPERIMENTAL=y 41CONFIG_EXPERIMENTAL=y
39CONFIG_BROKEN_ON_SMP=y 42CONFIG_LOCK_KERNEL=y
40CONFIG_INIT_ENV_ARG_LIMIT=32 43CONFIG_INIT_ENV_ARG_LIMIT=32
41CONFIG_LOCALVERSION="" 44CONFIG_LOCALVERSION=""
42# CONFIG_LOCALVERSION_AUTO is not set 45# CONFIG_LOCALVERSION_AUTO is not set
@@ -76,6 +79,7 @@ CONFIG_FUTEX=y
76CONFIG_ANON_INODES=y 79CONFIG_ANON_INODES=y
77CONFIG_EPOLL=y 80CONFIG_EPOLL=y
78CONFIG_SIGNALFD=y 81CONFIG_SIGNALFD=y
82CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y 83CONFIG_EVENTFD=y
80CONFIG_SHMEM=y 84CONFIG_SHMEM=y
81CONFIG_VM_EVENT_COUNTERS=y 85CONFIG_VM_EVENT_COUNTERS=y
@@ -83,6 +87,14 @@ CONFIG_SLUB_DEBUG=y
83# CONFIG_SLAB is not set 87# CONFIG_SLAB is not set
84CONFIG_SLUB=y 88CONFIG_SLUB=y
85# CONFIG_SLOB is not set 89# CONFIG_SLOB is not set
90CONFIG_PROFILING=y
91# CONFIG_MARKERS is not set
92CONFIG_OPROFILE=m
93CONFIG_HAVE_OPROFILE=y
94CONFIG_KPROBES=y
95CONFIG_HAVE_KPROBES=y
96CONFIG_PROC_PAGE_MONITOR=y
97CONFIG_SLABINFO=y
86CONFIG_RT_MUTEXES=y 98CONFIG_RT_MUTEXES=y
87# CONFIG_TINY_SHMEM is not set 99# CONFIG_TINY_SHMEM is not set
88CONFIG_BASE_SMALL=0 100CONFIG_BASE_SMALL=0
@@ -92,6 +104,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
92CONFIG_MODVERSIONS=y 104CONFIG_MODVERSIONS=y
93CONFIG_MODULE_SRCVERSION_ALL=y 105CONFIG_MODULE_SRCVERSION_ALL=y
94CONFIG_KMOD=y 106CONFIG_KMOD=y
107CONFIG_STOP_MACHINE=y
95CONFIG_BLOCK=y 108CONFIG_BLOCK=y
96CONFIG_BLK_DEV_IO_TRACE=y 109CONFIG_BLK_DEV_IO_TRACE=y
97CONFIG_BLK_DEV_BSG=y 110CONFIG_BLK_DEV_BSG=y
@@ -109,6 +122,8 @@ CONFIG_DEFAULT_AS=y
109# CONFIG_DEFAULT_CFQ is not set 122# CONFIG_DEFAULT_CFQ is not set
110# CONFIG_DEFAULT_NOOP is not set 123# CONFIG_DEFAULT_NOOP is not set
111CONFIG_DEFAULT_IOSCHED="anticipatory" 124CONFIG_DEFAULT_IOSCHED="anticipatory"
125CONFIG_CLASSIC_RCU=y
126# CONFIG_PREEMPT_RCU is not set
112CONFIG_SYSVIPC_COMPAT=y 127CONFIG_SYSVIPC_COMPAT=y
113CONFIG_GENERIC_HARDIRQS=y 128CONFIG_GENERIC_HARDIRQS=y
114 129
@@ -119,7 +134,8 @@ CONFIG_TICK_ONESHOT=y
119CONFIG_NO_HZ=y 134CONFIG_NO_HZ=y
120CONFIG_HIGH_RES_TIMERS=y 135CONFIG_HIGH_RES_TIMERS=y
121CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 136CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
122# CONFIG_SMP is not set 137CONFIG_SMP=y
138CONFIG_NR_CPUS=64
123# CONFIG_CPU_FREQ is not set 139# CONFIG_CPU_FREQ is not set
124CONFIG_RWSEM_XCHGADD_ALGORITHM=y 140CONFIG_RWSEM_XCHGADD_ALGORITHM=y
125CONFIG_GENERIC_FIND_NEXT_BIT=y 141CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -169,9 +185,12 @@ CONFIG_BINFMT_ELF32=y
169CONFIG_BINFMT_ELF=y 185CONFIG_BINFMT_ELF=y
170CONFIG_BINFMT_MISC=m 186CONFIG_BINFMT_MISC=m
171CONFIG_SOLARIS_EMUL=y 187CONFIG_SOLARIS_EMUL=y
188CONFIG_SCHED_SMT=y
189CONFIG_SCHED_MC=y
172# CONFIG_PREEMPT_NONE is not set 190# CONFIG_PREEMPT_NONE is not set
173CONFIG_PREEMPT_VOLUNTARY=y 191CONFIG_PREEMPT_VOLUNTARY=y
174# CONFIG_PREEMPT is not set 192# CONFIG_PREEMPT is not set
193# CONFIG_RCU_TRACE is not set
175# CONFIG_CMDLINE_BOOL is not set 194# CONFIG_CMDLINE_BOOL is not set
176 195
177# 196#
@@ -189,6 +208,7 @@ CONFIG_XFRM=y
189CONFIG_XFRM_USER=m 208CONFIG_XFRM_USER=m
190# CONFIG_XFRM_SUB_POLICY is not set 209# CONFIG_XFRM_SUB_POLICY is not set
191CONFIG_XFRM_MIGRATE=y 210CONFIG_XFRM_MIGRATE=y
211# CONFIG_XFRM_STATISTICS is not set
192CONFIG_NET_KEY=m 212CONFIG_NET_KEY=m
193CONFIG_NET_KEY_MIGRATE=y 213CONFIG_NET_KEY_MIGRATE=y
194CONFIG_INET=y 214CONFIG_INET=y
@@ -249,9 +269,9 @@ CONFIG_IP_DCCP_ACKVEC=y
249CONFIG_IP_DCCP_CCID2=m 269CONFIG_IP_DCCP_CCID2=m
250# CONFIG_IP_DCCP_CCID2_DEBUG is not set 270# CONFIG_IP_DCCP_CCID2_DEBUG is not set
251CONFIG_IP_DCCP_CCID3=m 271CONFIG_IP_DCCP_CCID3=m
252CONFIG_IP_DCCP_TFRC_LIB=m
253# CONFIG_IP_DCCP_CCID3_DEBUG is not set 272# CONFIG_IP_DCCP_CCID3_DEBUG is not set
254CONFIG_IP_DCCP_CCID3_RTO=100 273CONFIG_IP_DCCP_CCID3_RTO=100
274CONFIG_IP_DCCP_TFRC_LIB=m
255 275
256# 276#
257# DCCP Kernel Hacking 277# DCCP Kernel Hacking
@@ -279,6 +299,7 @@ CONFIG_VLAN_8021Q=m
279CONFIG_NET_PKTGEN=m 299CONFIG_NET_PKTGEN=m
280CONFIG_NET_TCPPROBE=m 300CONFIG_NET_TCPPROBE=m
281# CONFIG_HAMRADIO is not set 301# CONFIG_HAMRADIO is not set
302# CONFIG_CAN is not set
282# CONFIG_IRDA is not set 303# CONFIG_IRDA is not set
283# CONFIG_BT is not set 304# CONFIG_BT is not set
284# CONFIG_AF_RXRPC is not set 305# CONFIG_AF_RXRPC is not set
@@ -343,6 +364,7 @@ CONFIG_BLK_DEV_IDE=y
343CONFIG_BLK_DEV_IDEDISK=y 364CONFIG_BLK_DEV_IDEDISK=y
344# CONFIG_IDEDISK_MULTI_MODE is not set 365# CONFIG_IDEDISK_MULTI_MODE is not set
345CONFIG_BLK_DEV_IDECD=y 366CONFIG_BLK_DEV_IDECD=y
367CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
346# CONFIG_BLK_DEV_IDETAPE is not set 368# CONFIG_BLK_DEV_IDETAPE is not set
347# CONFIG_BLK_DEV_IDEFLOPPY is not set 369# CONFIG_BLK_DEV_IDEFLOPPY is not set
348# CONFIG_BLK_DEV_IDESCSI is not set 370# CONFIG_BLK_DEV_IDESCSI is not set
@@ -359,7 +381,6 @@ CONFIG_IDE_GENERIC=y
359# PCI IDE chipsets support 381# PCI IDE chipsets support
360# 382#
361CONFIG_BLK_DEV_IDEPCI=y 383CONFIG_BLK_DEV_IDEPCI=y
362# CONFIG_IDEPCI_SHARE_IRQ is not set
363CONFIG_IDEPCI_PCIBUS_ORDER=y 384CONFIG_IDEPCI_PCIBUS_ORDER=y
364# CONFIG_BLK_DEV_GENERIC is not set 385# CONFIG_BLK_DEV_GENERIC is not set
365# CONFIG_BLK_DEV_OPTI621 is not set 386# CONFIG_BLK_DEV_OPTI621 is not set
@@ -389,7 +410,6 @@ CONFIG_BLK_DEV_ALI15X3=y
389# CONFIG_BLK_DEV_TRM290 is not set 410# CONFIG_BLK_DEV_TRM290 is not set
390# CONFIG_BLK_DEV_VIA82CXXX is not set 411# CONFIG_BLK_DEV_VIA82CXXX is not set
391# CONFIG_BLK_DEV_TC86C001 is not set 412# CONFIG_BLK_DEV_TC86C001 is not set
392# CONFIG_IDE_ARM is not set
393CONFIG_BLK_DEV_IDEDMA=y 413CONFIG_BLK_DEV_IDEDMA=y
394CONFIG_IDE_ARCH_OBSOLETE_INIT=y 414CONFIG_IDE_ARCH_OBSOLETE_INIT=y
395# CONFIG_BLK_DEV_HD is not set 415# CONFIG_BLK_DEV_HD is not set
@@ -501,7 +521,6 @@ CONFIG_NETDEVICES=y
501# CONFIG_EQUALIZER is not set 521# CONFIG_EQUALIZER is not set
502# CONFIG_TUN is not set 522# CONFIG_TUN is not set
503# CONFIG_VETH is not set 523# CONFIG_VETH is not set
504# CONFIG_IP1000 is not set
505# CONFIG_ARCNET is not set 524# CONFIG_ARCNET is not set
506# CONFIG_PHYLIB is not set 525# CONFIG_PHYLIB is not set
507CONFIG_NET_ETHERNET=y 526CONFIG_NET_ETHERNET=y
@@ -533,6 +552,7 @@ CONFIG_NET_PCI=y
533# CONFIG_NE2K_PCI is not set 552# CONFIG_NE2K_PCI is not set
534# CONFIG_8139CP is not set 553# CONFIG_8139CP is not set
535# CONFIG_8139TOO is not set 554# CONFIG_8139TOO is not set
555# CONFIG_R6040 is not set
536# CONFIG_SIS900 is not set 556# CONFIG_SIS900 is not set
537# CONFIG_EPIC100 is not set 557# CONFIG_EPIC100 is not set
538# CONFIG_SUNDANCE is not set 558# CONFIG_SUNDANCE is not set
@@ -545,6 +565,9 @@ CONFIG_E1000=m
545CONFIG_E1000_NAPI=y 565CONFIG_E1000_NAPI=y
546# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 566# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
547# CONFIG_E1000E is not set 567# CONFIG_E1000E is not set
568# CONFIG_E1000E_ENABLED is not set
569# CONFIG_IP1000 is not set
570# CONFIG_IGB is not set
548# CONFIG_MYRI_SBUS is not set 571# CONFIG_MYRI_SBUS is not set
549# CONFIG_NS83820 is not set 572# CONFIG_NS83820 is not set
550# CONFIG_HAMACHI is not set 573# CONFIG_HAMACHI is not set
@@ -570,6 +593,7 @@ CONFIG_NETDEV_10000=y
570CONFIG_NIU=m 593CONFIG_NIU=m
571# CONFIG_MLX4_CORE is not set 594# CONFIG_MLX4_CORE is not set
572# CONFIG_TEHUTI is not set 595# CONFIG_TEHUTI is not set
596# CONFIG_BNX2X is not set
573# CONFIG_TR is not set 597# CONFIG_TR is not set
574 598
575# 599#
@@ -602,7 +626,6 @@ CONFIG_PPPOE=m
602# CONFIG_SLIP is not set 626# CONFIG_SLIP is not set
603CONFIG_SLHC=m 627CONFIG_SLHC=m
604# CONFIG_NET_FC is not set 628# CONFIG_NET_FC is not set
605# CONFIG_SHAPER is not set
606# CONFIG_NETCONSOLE is not set 629# CONFIG_NETCONSOLE is not set
607# CONFIG_NETPOLL is not set 630# CONFIG_NETPOLL is not set
608# CONFIG_NET_POLL_CONTROLLER is not set 631# CONFIG_NET_POLL_CONTROLLER is not set
@@ -679,6 +702,7 @@ CONFIG_VT_CONSOLE=y
679CONFIG_HW_CONSOLE=y 702CONFIG_HW_CONSOLE=y
680# CONFIG_VT_HW_CONSOLE_BINDING is not set 703# CONFIG_VT_HW_CONSOLE_BINDING is not set
681# CONFIG_SERIAL_NONSTANDARD is not set 704# CONFIG_SERIAL_NONSTANDARD is not set
705# CONFIG_NOZOMI is not set
682 706
683# 707#
684# Serial drivers 708# Serial drivers
@@ -747,13 +771,13 @@ CONFIG_I2C_ALGOBIT=y
747# 771#
748# Miscellaneous I2C Chip support 772# Miscellaneous I2C Chip support
749# 773#
750# CONFIG_SENSORS_DS1337 is not set
751# CONFIG_SENSORS_DS1374 is not set
752# CONFIG_DS1682 is not set 774# CONFIG_DS1682 is not set
753# CONFIG_SENSORS_EEPROM is not set 775# CONFIG_SENSORS_EEPROM is not set
754# CONFIG_SENSORS_PCF8574 is not set 776# CONFIG_SENSORS_PCF8574 is not set
777# CONFIG_PCF8575 is not set
755# CONFIG_SENSORS_PCA9539 is not set 778# CONFIG_SENSORS_PCA9539 is not set
756# CONFIG_SENSORS_PCF8591 is not set 779# CONFIG_SENSORS_PCF8591 is not set
780# CONFIG_TPS65010 is not set
757# CONFIG_SENSORS_MAX6875 is not set 781# CONFIG_SENSORS_MAX6875 is not set
758# CONFIG_SENSORS_TSL2550 is not set 782# CONFIG_SENSORS_TSL2550 is not set
759# CONFIG_I2C_DEBUG_CORE is not set 783# CONFIG_I2C_DEBUG_CORE is not set
@@ -990,6 +1014,7 @@ CONFIG_SND_ALI5451=m
990# CONFIG_SND_BT87X is not set 1014# CONFIG_SND_BT87X is not set
991# CONFIG_SND_CA0106 is not set 1015# CONFIG_SND_CA0106 is not set
992# CONFIG_SND_CMIPCI is not set 1016# CONFIG_SND_CMIPCI is not set
1017# CONFIG_SND_OXYGEN is not set
993# CONFIG_SND_CS4281 is not set 1018# CONFIG_SND_CS4281 is not set
994# CONFIG_SND_CS46XX is not set 1019# CONFIG_SND_CS46XX is not set
995# CONFIG_SND_DARLA20 is not set 1020# CONFIG_SND_DARLA20 is not set
@@ -1014,6 +1039,7 @@ CONFIG_SND_ALI5451=m
1014# CONFIG_SND_HDA_INTEL is not set 1039# CONFIG_SND_HDA_INTEL is not set
1015# CONFIG_SND_HDSP is not set 1040# CONFIG_SND_HDSP is not set
1016# CONFIG_SND_HDSPM is not set 1041# CONFIG_SND_HDSPM is not set
1042# CONFIG_SND_HIFIER is not set
1017# CONFIG_SND_ICE1712 is not set 1043# CONFIG_SND_ICE1712 is not set
1018# CONFIG_SND_ICE1724 is not set 1044# CONFIG_SND_ICE1724 is not set
1019# CONFIG_SND_INTEL8X0 is not set 1045# CONFIG_SND_INTEL8X0 is not set
@@ -1031,6 +1057,7 @@ CONFIG_SND_ALI5451=m
1031# CONFIG_SND_TRIDENT is not set 1057# CONFIG_SND_TRIDENT is not set
1032# CONFIG_SND_VIA82XX is not set 1058# CONFIG_SND_VIA82XX is not set
1033# CONFIG_SND_VIA82XX_MODEM is not set 1059# CONFIG_SND_VIA82XX_MODEM is not set
1060# CONFIG_SND_VIRTUOSO is not set
1034# CONFIG_SND_VX222 is not set 1061# CONFIG_SND_VX222 is not set
1035# CONFIG_SND_YMFPCI is not set 1062# CONFIG_SND_YMFPCI is not set
1036# CONFIG_SND_AC97_POWER_SAVE is not set 1063# CONFIG_SND_AC97_POWER_SAVE is not set
@@ -1058,6 +1085,10 @@ CONFIG_SND_SUN_CS4231=m
1058# 1085#
1059 1086
1060# 1087#
1088# ALSA SoC audio for Freescale SOCs
1089#
1090
1091#
1061# Open Sound System 1092# Open Sound System
1062# 1093#
1063# CONFIG_SOUND_PRIME is not set 1094# CONFIG_SOUND_PRIME is not set
@@ -1080,6 +1111,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
1080CONFIG_USB_ARCH_HAS_EHCI=y 1111CONFIG_USB_ARCH_HAS_EHCI=y
1081CONFIG_USB=y 1112CONFIG_USB=y
1082# CONFIG_USB_DEBUG is not set 1113# CONFIG_USB_DEBUG is not set
1114# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1083 1115
1084# 1116#
1085# Miscellaneous USB options 1117# Miscellaneous USB options
@@ -1093,7 +1125,6 @@ CONFIG_USB_DEVICEFS=y
1093# USB Host Controller Drivers 1125# USB Host Controller Drivers
1094# 1126#
1095CONFIG_USB_EHCI_HCD=m 1127CONFIG_USB_EHCI_HCD=m
1096# CONFIG_USB_EHCI_SPLIT_ISO is not set
1097# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1128# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1098# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1129# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1099# CONFIG_USB_ISP116X_HCD is not set 1130# CONFIG_USB_ISP116X_HCD is not set
@@ -1143,10 +1174,6 @@ CONFIG_USB_STORAGE=m
1143# 1174#
1144# USB port drivers 1175# USB port drivers
1145# 1176#
1146
1147#
1148# USB Serial Converter support
1149#
1150# CONFIG_USB_SERIAL is not set 1177# CONFIG_USB_SERIAL is not set
1151 1178
1152# 1179#
@@ -1172,14 +1199,6 @@ CONFIG_USB_STORAGE=m
1172# CONFIG_USB_TRANCEVIBRATOR is not set 1199# CONFIG_USB_TRANCEVIBRATOR is not set
1173# CONFIG_USB_IOWARRIOR is not set 1200# CONFIG_USB_IOWARRIOR is not set
1174# CONFIG_USB_TEST is not set 1201# CONFIG_USB_TEST is not set
1175
1176#
1177# USB DSL modem support
1178#
1179
1180#
1181# USB Gadget Support
1182#
1183# CONFIG_USB_GADGET is not set 1202# CONFIG_USB_GADGET is not set
1184# CONFIG_MMC is not set 1203# CONFIG_MMC is not set
1185# CONFIG_NEW_LEDS is not set 1204# CONFIG_NEW_LEDS is not set
@@ -1332,11 +1351,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1332# CONFIG_NLS_KOI8_U is not set 1351# CONFIG_NLS_KOI8_U is not set
1333# CONFIG_NLS_UTF8 is not set 1352# CONFIG_NLS_UTF8 is not set
1334# CONFIG_DLM is not set 1353# CONFIG_DLM is not set
1335CONFIG_INSTRUMENTATION=y
1336CONFIG_PROFILING=y
1337CONFIG_OPROFILE=m
1338CONFIG_KPROBES=y
1339# CONFIG_MARKERS is not set
1340 1354
1341# 1355#
1342# Kernel hacking 1356# Kernel hacking
@@ -1374,6 +1388,8 @@ CONFIG_DEBUG_BUGVERBOSE=y
1374CONFIG_FORCED_INLINING=y 1388CONFIG_FORCED_INLINING=y
1375# CONFIG_BOOT_PRINTK_DELAY is not set 1389# CONFIG_BOOT_PRINTK_DELAY is not set
1376# CONFIG_RCU_TORTURE_TEST is not set 1390# CONFIG_RCU_TORTURE_TEST is not set
1391# CONFIG_KPROBES_SANITY_TEST is not set
1392# CONFIG_BACKTRACE_SELF_TEST is not set
1377# CONFIG_LKDTM is not set 1393# CONFIG_LKDTM is not set
1378# CONFIG_FAULT_INJECTION is not set 1394# CONFIG_FAULT_INJECTION is not set
1379# CONFIG_SAMPLES is not set 1395# CONFIG_SAMPLES is not set
@@ -1396,8 +1412,9 @@ CONFIG_ASYNC_MEMCPY=m
1396CONFIG_ASYNC_XOR=m 1412CONFIG_ASYNC_XOR=m
1397CONFIG_CRYPTO=y 1413CONFIG_CRYPTO=y
1398CONFIG_CRYPTO_ALGAPI=y 1414CONFIG_CRYPTO_ALGAPI=y
1399CONFIG_CRYPTO_AEAD=m 1415CONFIG_CRYPTO_AEAD=y
1400CONFIG_CRYPTO_BLKCIPHER=y 1416CONFIG_CRYPTO_BLKCIPHER=y
1417# CONFIG_CRYPTO_SEQIV is not set
1401CONFIG_CRYPTO_HASH=y 1418CONFIG_CRYPTO_HASH=y
1402CONFIG_CRYPTO_MANAGER=y 1419CONFIG_CRYPTO_MANAGER=y
1403CONFIG_CRYPTO_HMAC=y 1420CONFIG_CRYPTO_HMAC=y
@@ -1416,6 +1433,9 @@ CONFIG_CRYPTO_CBC=y
1416CONFIG_CRYPTO_PCBC=m 1433CONFIG_CRYPTO_PCBC=m
1417CONFIG_CRYPTO_LRW=m 1434CONFIG_CRYPTO_LRW=m
1418CONFIG_CRYPTO_XTS=m 1435CONFIG_CRYPTO_XTS=m
1436# CONFIG_CRYPTO_CTR is not set
1437# CONFIG_CRYPTO_GCM is not set
1438# CONFIG_CRYPTO_CCM is not set
1419# CONFIG_CRYPTO_CRYPTD is not set 1439# CONFIG_CRYPTO_CRYPTD is not set
1420CONFIG_CRYPTO_DES=y 1440CONFIG_CRYPTO_DES=y
1421CONFIG_CRYPTO_FCRYPT=m 1441CONFIG_CRYPTO_FCRYPT=m
@@ -1431,13 +1451,16 @@ CONFIG_CRYPTO_ARC4=m
1431CONFIG_CRYPTO_KHAZAD=m 1451CONFIG_CRYPTO_KHAZAD=m
1432CONFIG_CRYPTO_ANUBIS=m 1452CONFIG_CRYPTO_ANUBIS=m
1433CONFIG_CRYPTO_SEED=m 1453CONFIG_CRYPTO_SEED=m
1454# CONFIG_CRYPTO_SALSA20 is not set
1434CONFIG_CRYPTO_DEFLATE=y 1455CONFIG_CRYPTO_DEFLATE=y
1435CONFIG_CRYPTO_MICHAEL_MIC=m 1456CONFIG_CRYPTO_MICHAEL_MIC=m
1436CONFIG_CRYPTO_CRC32C=m 1457CONFIG_CRYPTO_CRC32C=m
1437CONFIG_CRYPTO_CAMELLIA=m 1458CONFIG_CRYPTO_CAMELLIA=m
1438CONFIG_CRYPTO_TEST=m 1459CONFIG_CRYPTO_TEST=m
1439CONFIG_CRYPTO_AUTHENC=m 1460CONFIG_CRYPTO_AUTHENC=m
1461# CONFIG_CRYPTO_LZO is not set
1440CONFIG_CRYPTO_HW=y 1462CONFIG_CRYPTO_HW=y
1463# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1441 1464
1442# 1465#
1443# Library routines 1466# Library routines
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index ef50d217432f..4b78b24ef413 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y := process.o setup.o cpu.o idprom.o \
11 traps.o auxio.o una_asm.o sysfs.o iommu.o \ 11 traps.o auxio.o una_asm.o sysfs.o iommu.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o pci.o starfire.o semaphore.o \ 13 unaligned.o central.o pci.o starfire.o semaphore.o \
14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o sparc64_ksyms.o chmc.o \
15 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o 15 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o
16 16
17obj-$(CONFIG_STACKTRACE) += stacktrace.o 17obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index 4b9115a4d92e..5623a4d59dff 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -472,94 +472,15 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr,
472 spin_unlock_irqrestore(&iommu->lock, flags); 472 spin_unlock_irqrestore(&iommu->lock, flags);
473} 473}
474 474
475#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
476
477static void fill_sg(iopte_t *iopte, struct scatterlist *sg,
478 int nused, int nelems,
479 unsigned long iopte_protection)
480{
481 struct scatterlist *dma_sg = sg;
482 int i;
483
484 for (i = 0; i < nused; i++) {
485 unsigned long pteval = ~0UL;
486 u32 dma_npages;
487
488 dma_npages = ((dma_sg->dma_address & (IO_PAGE_SIZE - 1UL)) +
489 dma_sg->dma_length +
490 ((IO_PAGE_SIZE - 1UL))) >> IO_PAGE_SHIFT;
491 do {
492 unsigned long offset;
493 signed int len;
494
495 /* If we are here, we know we have at least one
496 * more page to map. So walk forward until we
497 * hit a page crossing, and begin creating new
498 * mappings from that spot.
499 */
500 for (;;) {
501 unsigned long tmp;
502
503 tmp = SG_ENT_PHYS_ADDRESS(sg);
504 len = sg->length;
505 if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) {
506 pteval = tmp & IO_PAGE_MASK;
507 offset = tmp & (IO_PAGE_SIZE - 1UL);
508 break;
509 }
510 if (((tmp ^ (tmp + len - 1UL)) >> IO_PAGE_SHIFT) != 0UL) {
511 pteval = (tmp + IO_PAGE_SIZE) & IO_PAGE_MASK;
512 offset = 0UL;
513 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
514 break;
515 }
516 sg = sg_next(sg);
517 nelems--;
518 }
519
520 pteval = iopte_protection | (pteval & IOPTE_PAGE);
521 while (len > 0) {
522 *iopte++ = __iopte(pteval);
523 pteval += IO_PAGE_SIZE;
524 len -= (IO_PAGE_SIZE - offset);
525 offset = 0;
526 dma_npages--;
527 }
528
529 pteval = (pteval & IOPTE_PAGE) + len;
530 sg = sg_next(sg);
531 nelems--;
532
533 /* Skip over any tail mappings we've fully mapped,
534 * adjusting pteval along the way. Stop when we
535 * detect a page crossing event.
536 */
537 while (nelems &&
538 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
539 (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
540 ((pteval ^
541 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
542 pteval += sg->length;
543 sg = sg_next(sg);
544 nelems--;
545 }
546 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
547 pteval = ~0UL;
548 } while (dma_npages != 0);
549 dma_sg = sg_next(dma_sg);
550 }
551}
552
553static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, 475static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
554 int nelems, enum dma_data_direction direction) 476 int nelems, enum dma_data_direction direction)
555{ 477{
556 struct iommu *iommu; 478 unsigned long flags, ctx, i, npages, iopte_protection;
479 struct scatterlist *sg;
557 struct strbuf *strbuf; 480 struct strbuf *strbuf;
558 unsigned long flags, ctx, npages, iopte_protection; 481 struct iommu *iommu;
559 iopte_t *base; 482 iopte_t *base;
560 u32 dma_base; 483 u32 dma_base;
561 struct scatterlist *sgtmp;
562 int used;
563 484
564 /* Fast path single entry scatterlists. */ 485 /* Fast path single entry scatterlists. */
565 if (nelems == 1) { 486 if (nelems == 1) {
@@ -578,11 +499,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
578 if (unlikely(direction == DMA_NONE)) 499 if (unlikely(direction == DMA_NONE))
579 goto bad_no_ctx; 500 goto bad_no_ctx;
580 501
581 /* Step 1: Prepare scatter list. */ 502 npages = calc_npages(sglist, nelems);
582
583 npages = prepare_sg(dev, sglist, nelems);
584
585 /* Step 2: Allocate a cluster and context, if necessary. */
586 503
587 spin_lock_irqsave(&iommu->lock, flags); 504 spin_lock_irqsave(&iommu->lock, flags);
588 505
@@ -599,18 +516,6 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
599 dma_base = iommu->page_table_map_base + 516 dma_base = iommu->page_table_map_base +
600 ((base - iommu->page_table) << IO_PAGE_SHIFT); 517 ((base - iommu->page_table) << IO_PAGE_SHIFT);
601 518
602 /* Step 3: Normalize DMA addresses. */
603 used = nelems;
604
605 sgtmp = sglist;
606 while (used && sgtmp->dma_length) {
607 sgtmp->dma_address += dma_base;
608 sgtmp = sg_next(sgtmp);
609 used--;
610 }
611 used = nelems - used;
612
613 /* Step 4: Create the mappings. */
614 if (strbuf->strbuf_enabled) 519 if (strbuf->strbuf_enabled)
615 iopte_protection = IOPTE_STREAMING(ctx); 520 iopte_protection = IOPTE_STREAMING(ctx);
616 else 521 else
@@ -618,13 +523,27 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
618 if (direction != DMA_TO_DEVICE) 523 if (direction != DMA_TO_DEVICE)
619 iopte_protection |= IOPTE_WRITE; 524 iopte_protection |= IOPTE_WRITE;
620 525
621 fill_sg(base, sglist, used, nelems, iopte_protection); 526 for_each_sg(sglist, sg, nelems, i) {
527 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
528 unsigned long slen = sg->length;
529 unsigned long this_npages;
622 530
623#ifdef VERIFY_SG 531 this_npages = iommu_num_pages(paddr, slen);
624 verify_sglist(sglist, nelems, base, npages);
625#endif
626 532
627 return used; 533 sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK);
534 sg->dma_length = slen;
535
536 paddr &= IO_PAGE_MASK;
537 while (this_npages--) {
538 iopte_val(*base) = iopte_protection | paddr;
539
540 base++;
541 paddr += IO_PAGE_SIZE;
542 dma_base += IO_PAGE_SIZE;
543 }
544 }
545
546 return nelems;
628 547
629bad: 548bad:
630 iommu_free_ctx(iommu, ctx); 549 iommu_free_ctx(iommu, ctx);
@@ -637,11 +556,10 @@ bad_no_ctx:
637static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, 556static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
638 int nelems, enum dma_data_direction direction) 557 int nelems, enum dma_data_direction direction)
639{ 558{
640 struct iommu *iommu; 559 unsigned long flags, ctx, i, npages;
641 struct strbuf *strbuf; 560 struct strbuf *strbuf;
561 struct iommu *iommu;
642 iopte_t *base; 562 iopte_t *base;
643 unsigned long flags, ctx, i, npages;
644 struct scatterlist *sg, *sgprv;
645 u32 bus_addr; 563 u32 bus_addr;
646 564
647 if (unlikely(direction == DMA_NONE)) { 565 if (unlikely(direction == DMA_NONE)) {
@@ -654,15 +572,7 @@ static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
654 572
655 bus_addr = sglist->dma_address & IO_PAGE_MASK; 573 bus_addr = sglist->dma_address & IO_PAGE_MASK;
656 574
657 sgprv = NULL; 575 npages = calc_npages(sglist, nelems);
658 for_each_sg(sglist, sg, nelems, i) {
659 if (sg->dma_length == 0)
660 break;
661 sgprv = sg;
662 }
663
664 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length) -
665 bus_addr) >> IO_PAGE_SHIFT;
666 576
667 base = iommu->page_table + 577 base = iommu->page_table +
668 ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); 578 ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c
deleted file mode 100644
index 72a4acfe8c7b..000000000000
--- a/arch/sparc64/kernel/iommu_common.c
+++ /dev/null
@@ -1,248 +0,0 @@
1/* $Id: iommu_common.c,v 1.9 2001/12/17 07:05:09 davem Exp $
2 * iommu_common.c: UltraSparc SBUS/PCI common iommu code.
3 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */
6
7#include <linux/dma-mapping.h>
8#include "iommu_common.h"
9
10/* You are _strongly_ advised to enable the following debugging code
11 * any time you make changes to the sg code below, run it for a while
12 * with filesystems mounted read-only before buying the farm... -DaveM
13 */
14
15#ifdef VERIFY_SG
16static int verify_lengths(struct scatterlist *sglist, int nents, int npages)
17{
18 int sg_len, dma_len;
19 int i, pgcount;
20 struct scatterlist *sg;
21
22 sg_len = 0;
23 for_each_sg(sglist, sg, nents, i)
24 sg_len += sg->length;
25
26 dma_len = 0;
27 for_each_sg(sglist, sg, nents, i) {
28 if (!sg->dma_length)
29 break;
30 dma_len += sg->dma_length;
31 }
32
33 if (sg_len != dma_len) {
34 printk("verify_lengths: Error, different, sg[%d] dma[%d]\n",
35 sg_len, dma_len);
36 return -1;
37 }
38
39 pgcount = 0;
40 for_each_sg(sglist, sg, nents, i) {
41 unsigned long start, end;
42
43 if (!sg->dma_length)
44 break;
45
46 start = sg->dma_address;
47 start = start & IO_PAGE_MASK;
48
49 end = sg->dma_address + sg->dma_length;
50 end = (end + (IO_PAGE_SIZE - 1)) & IO_PAGE_MASK;
51
52 pgcount += ((end - start) >> IO_PAGE_SHIFT);
53 }
54
55 if (pgcount != npages) {
56 printk("verify_lengths: Error, page count wrong, "
57 "npages[%d] pgcount[%d]\n",
58 npages, pgcount);
59 return -1;
60 }
61
62 /* This test passes... */
63 return 0;
64}
65
66static int verify_one_map(struct scatterlist *dma_sg, struct scatterlist **__sg, int nents, iopte_t **__iopte)
67{
68 struct scatterlist *sg = *__sg;
69 iopte_t *iopte = *__iopte;
70 u32 dlen = dma_sg->dma_length;
71 u32 daddr;
72 unsigned int sglen;
73 unsigned long sgaddr;
74
75 daddr = dma_sg->dma_address;
76 sglen = sg->length;
77 sgaddr = (unsigned long) sg_virt(sg);
78 while (dlen > 0) {
79 unsigned long paddr;
80
81 /* SG and DMA_SG must begin at the same sub-page boundary. */
82 if ((sgaddr & ~IO_PAGE_MASK) != (daddr & ~IO_PAGE_MASK)) {
83 printk("verify_one_map: Wrong start offset "
84 "sg[%08lx] dma[%08x]\n",
85 sgaddr, daddr);
86 nents = -1;
87 goto out;
88 }
89
90 /* Verify the IOPTE points to the right page. */
91 paddr = iopte_val(*iopte) & IOPTE_PAGE;
92 if ((paddr + PAGE_OFFSET) != (sgaddr & IO_PAGE_MASK)) {
93 printk("verify_one_map: IOPTE[%08lx] maps the "
94 "wrong page, should be [%08lx]\n",
95 iopte_val(*iopte), (sgaddr & IO_PAGE_MASK) - PAGE_OFFSET);
96 nents = -1;
97 goto out;
98 }
99
100 /* If this SG crosses a page, adjust to that next page
101 * boundary and loop.
102 */
103 if ((sgaddr & IO_PAGE_MASK) ^ ((sgaddr + sglen - 1) & IO_PAGE_MASK)) {
104 unsigned long next_page, diff;
105
106 next_page = (sgaddr + IO_PAGE_SIZE) & IO_PAGE_MASK;
107 diff = next_page - sgaddr;
108 sgaddr += diff;
109 daddr += diff;
110 sglen -= diff;
111 dlen -= diff;
112 if (dlen > 0)
113 iopte++;
114 continue;
115 }
116
117 /* SG wholly consumed within this page. */
118 daddr += sglen;
119 dlen -= sglen;
120
121 if (dlen > 0 && ((daddr & ~IO_PAGE_MASK) == 0))
122 iopte++;
123
124 sg = sg_next(sg);
125 if (--nents <= 0)
126 break;
127 sgaddr = (unsigned long) sg_virt(sg);
128 sglen = sg->length;
129 }
130 if (dlen < 0) {
131 /* Transfer overrun, big problems. */
132 printk("verify_one_map: Transfer overrun by %d bytes.\n",
133 -dlen);
134 nents = -1;
135 } else {
136 /* Advance to next dma_sg implies that the next iopte will
137 * begin it.
138 */
139 iopte++;
140 }
141
142out:
143 *__sg = sg;
144 *__iopte = iopte;
145 return nents;
146}
147
148static int verify_maps(struct scatterlist *sg, int nents, iopte_t *iopte)
149{
150 struct scatterlist *dma_sg = sg;
151 struct scatterlist *orig_dma_sg = dma_sg;
152 int orig_nents = nents;
153
154 for (;;) {
155 nents = verify_one_map(dma_sg, &sg, nents, &iopte);
156 if (nents <= 0)
157 break;
158 dma_sg = sg_next(dma_sg);
159 if (dma_sg->dma_length == 0)
160 break;
161 }
162
163 if (nents > 0) {
164 printk("verify_maps: dma maps consumed by some sgs remain (%d)\n",
165 nents);
166 return -1;
167 }
168
169 if (nents < 0) {
170 printk("verify_maps: Error, messed up mappings, "
171 "at sg %d dma_sg %d\n",
172 (int) (orig_nents + nents), (int) (dma_sg - orig_dma_sg));
173 return -1;
174 }
175
176 /* This test passes... */
177 return 0;
178}
179
180void verify_sglist(struct scatterlist *sglist, int nents, iopte_t *iopte, int npages)
181{
182 struct scatterlist *sg;
183
184 if (verify_lengths(sglist, nents, npages) < 0 ||
185 verify_maps(sglist, nents, iopte) < 0) {
186 int i;
187
188 printk("verify_sglist: Crap, messed up mappings, dumping, iodma at ");
189 printk("%016lx.\n", sglist->dma_address & IO_PAGE_MASK);
190
191 for_each_sg(sglist, sg, nents, i) {
192 printk("sg(%d): page_addr(%p) off(%x) length(%x) "
193 "dma_address[%016x] dma_length[%016x]\n",
194 i,
195 page_address(sg_page(sg)), sg->offset,
196 sg->length,
197 sg->dma_address, sg->dma_length);
198 }
199 }
200
201 /* Seems to be ok */
202}
203#endif
204
205unsigned long prepare_sg(struct device *dev, struct scatterlist *sg, int nents)
206{
207 struct scatterlist *dma_sg = sg;
208 unsigned long prev;
209 u32 dent_addr, dent_len;
210 unsigned int max_seg_size;
211
212 prev = (unsigned long) sg_virt(sg);
213 prev += (unsigned long) (dent_len = sg->length);
214 dent_addr = (u32) ((unsigned long)(sg_virt(sg)) & (IO_PAGE_SIZE - 1UL));
215 max_seg_size = dma_get_max_seg_size(dev);
216 while (--nents) {
217 unsigned long addr;
218
219 sg = sg_next(sg);
220 addr = (unsigned long) sg_virt(sg);
221 if (! VCONTIG(prev, addr) ||
222 dent_len + sg->length > max_seg_size) {
223 dma_sg->dma_address = dent_addr;
224 dma_sg->dma_length = dent_len;
225 dma_sg = sg_next(dma_sg);
226
227 dent_addr = ((dent_addr +
228 dent_len +
229 (IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT);
230 dent_addr <<= IO_PAGE_SHIFT;
231 dent_addr += addr & (IO_PAGE_SIZE - 1UL);
232 dent_len = 0;
233 }
234 dent_len += sg->length;
235 prev = addr + sg->length;
236 }
237 dma_sg->dma_address = dent_addr;
238 dma_sg->dma_length = dent_len;
239
240 if (dma_sg != sg) {
241 dma_sg = sg_next(dma_sg);
242 dma_sg->dma_length = 0;
243 }
244
245 return ((unsigned long) dent_addr +
246 (unsigned long) dent_len +
247 (IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT;
248}
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h
index a90d046e8024..4b5cafa2877a 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc64/kernel/iommu_common.h
@@ -30,6 +30,32 @@
30 */ 30 */
31#define IOMMU_PAGE_SHIFT 13 31#define IOMMU_PAGE_SHIFT 13
32 32
33#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
34
35static inline unsigned long iommu_num_pages(unsigned long vaddr,
36 unsigned long slen)
37{
38 unsigned long npages;
39
40 npages = IO_PAGE_ALIGN(vaddr + slen) - (vaddr & IO_PAGE_MASK);
41 npages >>= IO_PAGE_SHIFT;
42
43 return npages;
44}
45
46static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems)
47{
48 unsigned long i, npages = 0;
49 struct scatterlist *sg;
50
51 for_each_sg(sglist, sg, nelems, i) {
52 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
53 npages += iommu_num_pages(paddr, sg->length);
54 }
55
56 return npages;
57}
58
33/* You are _strongly_ advised to enable the following debugging code 59/* You are _strongly_ advised to enable the following debugging code
34 * any time you make changes to the sg code below, run it for a while 60 * any time you make changes to the sg code below, run it for a while
35 * with filesystems mounted read-only before buying the farm... -DaveM 61 * with filesystems mounted read-only before buying the farm... -DaveM
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 5ea2eab1ccda..61baf8dc095e 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -365,113 +365,14 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr,
365 spin_unlock_irqrestore(&iommu->lock, flags); 365 spin_unlock_irqrestore(&iommu->lock, flags);
366} 366}
367 367
368#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
369
370static long fill_sg(long entry, struct device *dev,
371 struct scatterlist *sg,
372 int nused, int nelems, unsigned long prot)
373{
374 struct scatterlist *dma_sg = sg;
375 unsigned long flags;
376 int i;
377
378 local_irq_save(flags);
379
380 iommu_batch_start(dev, prot, entry);
381
382 for (i = 0; i < nused; i++) {
383 unsigned long pteval = ~0UL;
384 u32 dma_npages;
385
386 dma_npages = ((dma_sg->dma_address & (IO_PAGE_SIZE - 1UL)) +
387 dma_sg->dma_length +
388 ((IO_PAGE_SIZE - 1UL))) >> IO_PAGE_SHIFT;
389 do {
390 unsigned long offset;
391 signed int len;
392
393 /* If we are here, we know we have at least one
394 * more page to map. So walk forward until we
395 * hit a page crossing, and begin creating new
396 * mappings from that spot.
397 */
398 for (;;) {
399 unsigned long tmp;
400
401 tmp = SG_ENT_PHYS_ADDRESS(sg);
402 len = sg->length;
403 if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) {
404 pteval = tmp & IO_PAGE_MASK;
405 offset = tmp & (IO_PAGE_SIZE - 1UL);
406 break;
407 }
408 if (((tmp ^ (tmp + len - 1UL)) >> IO_PAGE_SHIFT) != 0UL) {
409 pteval = (tmp + IO_PAGE_SIZE) & IO_PAGE_MASK;
410 offset = 0UL;
411 len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
412 break;
413 }
414 sg = sg_next(sg);
415 nelems--;
416 }
417
418 pteval = (pteval & IOPTE_PAGE);
419 while (len > 0) {
420 long err;
421
422 err = iommu_batch_add(pteval);
423 if (unlikely(err < 0L))
424 goto iommu_map_failed;
425
426 pteval += IO_PAGE_SIZE;
427 len -= (IO_PAGE_SIZE - offset);
428 offset = 0;
429 dma_npages--;
430 }
431
432 pteval = (pteval & IOPTE_PAGE) + len;
433 sg = sg_next(sg);
434 nelems--;
435
436 /* Skip over any tail mappings we've fully mapped,
437 * adjusting pteval along the way. Stop when we
438 * detect a page crossing event.
439 */
440 while (nelems &&
441 (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
442 (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
443 ((pteval ^
444 (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
445 pteval += sg->length;
446 sg = sg_next(sg);
447 nelems--;
448 }
449 if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
450 pteval = ~0UL;
451 } while (dma_npages != 0);
452 dma_sg = sg_next(dma_sg);
453 }
454
455 if (unlikely(iommu_batch_end() < 0L))
456 goto iommu_map_failed;
457
458 local_irq_restore(flags);
459 return 0;
460
461iommu_map_failed:
462 local_irq_restore(flags);
463 return -1L;
464}
465
466static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, 368static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
467 int nelems, enum dma_data_direction direction) 369 int nelems, enum dma_data_direction direction)
468{ 370{
371 unsigned long flags, npages, i, prot;
372 struct scatterlist *sg;
469 struct iommu *iommu; 373 struct iommu *iommu;
470 unsigned long flags, npages, prot;
471 u32 dma_base;
472 struct scatterlist *sgtmp;
473 long entry, err; 374 long entry, err;
474 int used; 375 u32 dma_base;
475 376
476 /* Fast path single entry scatterlists. */ 377 /* Fast path single entry scatterlists. */
477 if (nelems == 1) { 378 if (nelems == 1) {
@@ -489,10 +390,8 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
489 if (unlikely(direction == DMA_NONE)) 390 if (unlikely(direction == DMA_NONE))
490 goto bad; 391 goto bad;
491 392
492 /* Step 1: Prepare scatter list. */ 393 npages = calc_npages(sglist, nelems);
493 npages = prepare_sg(dev, sglist, nelems);
494 394
495 /* Step 2: Allocate a cluster and context, if necessary. */
496 spin_lock_irqsave(&iommu->lock, flags); 395 spin_lock_irqsave(&iommu->lock, flags);
497 entry = arena_alloc(&iommu->arena, npages); 396 entry = arena_alloc(&iommu->arena, npages);
498 spin_unlock_irqrestore(&iommu->lock, flags); 397 spin_unlock_irqrestore(&iommu->lock, flags);
@@ -503,27 +402,45 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
503 dma_base = iommu->page_table_map_base + 402 dma_base = iommu->page_table_map_base +
504 (entry << IO_PAGE_SHIFT); 403 (entry << IO_PAGE_SHIFT);
505 404
506 /* Step 3: Normalize DMA addresses. */
507 used = nelems;
508
509 sgtmp = sglist;
510 while (used && sgtmp->dma_length) {
511 sgtmp->dma_address += dma_base;
512 sgtmp = sg_next(sgtmp);
513 used--;
514 }
515 used = nelems - used;
516
517 /* Step 4: Create the mappings. */
518 prot = HV_PCI_MAP_ATTR_READ; 405 prot = HV_PCI_MAP_ATTR_READ;
519 if (direction != DMA_TO_DEVICE) 406 if (direction != DMA_TO_DEVICE)
520 prot |= HV_PCI_MAP_ATTR_WRITE; 407 prot |= HV_PCI_MAP_ATTR_WRITE;
521 408
522 err = fill_sg(entry, dev, sglist, used, nelems, prot); 409 local_irq_save(flags);
410
411 iommu_batch_start(dev, prot, entry);
412
413 for_each_sg(sglist, sg, nelems, i) {
414 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
415 unsigned long slen = sg->length;
416 unsigned long this_npages;
417
418 this_npages = iommu_num_pages(paddr, slen);
419
420 sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK);
421 sg->dma_length = slen;
422
423 paddr &= IO_PAGE_MASK;
424 while (this_npages--) {
425 err = iommu_batch_add(paddr);
426 if (unlikely(err < 0L)) {
427 local_irq_restore(flags);
428 goto iommu_map_failed;
429 }
430
431 paddr += IO_PAGE_SIZE;
432 dma_base += IO_PAGE_SIZE;
433 }
434 }
435
436 err = iommu_batch_end();
437
438 local_irq_restore(flags);
439
523 if (unlikely(err < 0L)) 440 if (unlikely(err < 0L))
524 goto iommu_map_failed; 441 goto iommu_map_failed;
525 442
526 return used; 443 return nelems;
527 444
528bad: 445bad:
529 if (printk_ratelimit()) 446 if (printk_ratelimit())
@@ -541,12 +458,11 @@ iommu_map_failed:
541static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, 458static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
542 int nelems, enum dma_data_direction direction) 459 int nelems, enum dma_data_direction direction)
543{ 460{
461 unsigned long flags, npages;
544 struct pci_pbm_info *pbm; 462 struct pci_pbm_info *pbm;
463 u32 devhandle, bus_addr;
545 struct iommu *iommu; 464 struct iommu *iommu;
546 unsigned long flags, i, npages;
547 struct scatterlist *sg, *sgprv;
548 long entry; 465 long entry;
549 u32 devhandle, bus_addr;
550 466
551 if (unlikely(direction == DMA_NONE)) { 467 if (unlikely(direction == DMA_NONE)) {
552 if (printk_ratelimit()) 468 if (printk_ratelimit())
@@ -558,16 +474,8 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
558 devhandle = pbm->devhandle; 474 devhandle = pbm->devhandle;
559 475
560 bus_addr = sglist->dma_address & IO_PAGE_MASK; 476 bus_addr = sglist->dma_address & IO_PAGE_MASK;
561 sgprv = NULL;
562 for_each_sg(sglist, sg, nelems, i) {
563 if (sg->dma_length == 0)
564 break;
565
566 sgprv = sg;
567 }
568 477
569 npages = (IO_PAGE_ALIGN(sgprv->dma_address + sgprv->dma_length) - 478 npages = calc_npages(sglist, nelems);
570 bus_addr) >> IO_PAGE_SHIFT;
571 479
572 entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); 480 entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
573 481
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index c39944927f1a..a8052b76df41 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -46,8 +46,6 @@
46#include <asm/ldc.h> 46#include <asm/ldc.h>
47#include <asm/hypervisor.h> 47#include <asm/hypervisor.h>
48 48
49extern void calibrate_delay(void);
50
51int sparc64_multi_core __read_mostly; 49int sparc64_multi_core __read_mostly;
52 50
53cpumask_t cpu_possible_map __read_mostly = CPU_MASK_NONE; 51cpumask_t cpu_possible_map __read_mostly = CPU_MASK_NONE;
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 60765e314bd8..8649635d6d74 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -277,6 +277,7 @@ EXPORT_SYMBOL(sys_getpid);
277EXPORT_SYMBOL(sys_geteuid); 277EXPORT_SYMBOL(sys_geteuid);
278EXPORT_SYMBOL(sys_getuid); 278EXPORT_SYMBOL(sys_getuid);
279EXPORT_SYMBOL(sys_getegid); 279EXPORT_SYMBOL(sys_getegid);
280EXPORT_SYMBOL(sysctl_nr_open);
280EXPORT_SYMBOL(sys_getgid); 281EXPORT_SYMBOL(sys_getgid);
281EXPORT_SYMBOL(svr4_getcontext); 282EXPORT_SYMBOL(svr4_getcontext);
282EXPORT_SYMBOL(svr4_setcontext); 283EXPORT_SYMBOL(svr4_setcontext);
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index b8058906e727..adc62f490f36 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -80,7 +80,8 @@ sys_call_table32:
80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
81/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy 81/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy
82 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait 82 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait
83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_ni_syscall, sys_eventfd, compat_sys_fallocate 83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate
84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime
84 85
85#endif /* CONFIG_COMPAT */ 86#endif /* CONFIG_COMPAT */
86 87
@@ -152,7 +153,8 @@ sys_call_table:
152 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 153 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
153/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy 154/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
154 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait 155 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
155/*310*/ .word sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate 156/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
157 .word sys_timerfd_settime, sys_timerfd_gettime
156 158
157#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 159#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
158 defined(CONFIG_SOLARIS_EMUL_MODULE) 160 defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -271,6 +273,7 @@ sunos_sys_table:
271 .word sunos_nosys, sunos_nosys, sunos_nosys 273 .word sunos_nosys, sunos_nosys, sunos_nosys
272 .word sunos_nosys 274 .word sunos_nosys
273/*310*/ .word sunos_nosys, sunos_nosys, sunos_nosys 275/*310*/ .word sunos_nosys, sunos_nosys, sunos_nosys
274 .word sunos_nosys, sunos_nosys 276 .word sunos_nosys, sunos_nosys, sunos_nosys
277 .word sunos_nosys
275 278
276#endif 279#endif
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 4352ee4d8dac..d204f1ab1d4c 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -1707,6 +1707,11 @@ static void __exit rtc_mini_exit(void)
1707 misc_deregister(&rtc_mini_dev); 1707 misc_deregister(&rtc_mini_dev);
1708} 1708}
1709 1709
1710int __devinit read_current_timer(unsigned long *timer_val)
1711{
1712 *timer_val = tick_ops->get_tick();
1713 return 0;
1714}
1710 1715
1711module_init(rtc_mini_init); 1716module_init(rtc_mini_init);
1712module_exit(rtc_mini_exit); 1717module_exit(rtc_mini_exit);
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 523e993ee90c..e726c45645ff 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -997,7 +997,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
997 prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n", 997 prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n",
998 initrd_start, initrd_end); 998 initrd_start, initrd_end);
999#endif 999#endif
1000 reserve_bootmem(initrd_start, size); 1000 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
1001 1001
1002 initrd_start += PAGE_OFFSET; 1002 initrd_start += PAGE_OFFSET;
1003 initrd_end += PAGE_OFFSET; 1003 initrd_end += PAGE_OFFSET;
@@ -1007,7 +1007,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1007#ifdef CONFIG_DEBUG_BOOTMEM 1007#ifdef CONFIG_DEBUG_BOOTMEM
1008 prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size); 1008 prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size);
1009#endif 1009#endif
1010 reserve_bootmem(kern_base, kern_size); 1010 reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT);
1011 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT; 1011 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT;
1012 1012
1013 /* Add back in the initmem pages. */ 1013 /* Add back in the initmem pages. */
@@ -1024,7 +1024,7 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1024 prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n", 1024 prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n",
1025 (bootmap_pfn << PAGE_SHIFT), size); 1025 (bootmap_pfn << PAGE_SHIFT), size);
1026#endif 1026#endif
1027 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size); 1027 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
1028 1028
1029 for (i = 0; i < pavail_ents; i++) { 1029 for (i = 0; i < pavail_ents; i++) {
1030 unsigned long start_pfn, end_pfn; 1030 unsigned long start_pfn, end_pfn;
@@ -1489,7 +1489,7 @@ static void __init taint_real_pages(void)
1489 goto do_next_page; 1489 goto do_next_page;
1490 } 1490 }
1491 } 1491 }
1492 reserve_bootmem(old_start, PAGE_SIZE); 1492 reserve_bootmem(old_start, PAGE_SIZE, BOOTMEM_DEFAULT);
1493 1493
1494 do_next_page: 1494 do_next_page:
1495 old_start += PAGE_SIZE; 1495 old_start += PAGE_SIZE;
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 61be597bf430..9311bfe4f2f7 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -624,7 +624,7 @@ asmlinkage int solaris_ulimit(int cmd, int val)
624 case 3: /* UL_GMEMLIM */ 624 case 3: /* UL_GMEMLIM */
625 return current->signal->rlim[RLIMIT_DATA].rlim_cur; 625 return current->signal->rlim[RLIMIT_DATA].rlim_cur;
626 case 4: /* UL_GDESLIM */ 626 case 4: /* UL_GDESLIM */
627 return NR_OPEN; 627 return sysctl_nr_open;
628 } 628 }
629 return -EINVAL; 629 return -EINVAL;
630} 630}
diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c
index a9d32ceabf26..f53123c02c2b 100644
--- a/arch/sparc64/solaris/timod.c
+++ b/arch/sparc64/solaris/timod.c
@@ -859,7 +859,8 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
859 859
860 SOLD("entry"); 860 SOLD("entry");
861 lock_kernel(); 861 lock_kernel();
862 if(fd >= NR_OPEN) goto out; 862 if (fd >= sysctl_nr_open)
863 goto out;
863 864
864 fdt = files_fdtable(current->files); 865 fdt = files_fdtable(current->files);
865 filp = fdt->fd[fd]; 866 filp = fdt->fd[fd];
@@ -927,7 +928,8 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3)
927 928
928 SOLD("entry"); 929 SOLD("entry");
929 lock_kernel(); 930 lock_kernel();
930 if(fd >= NR_OPEN) goto out; 931 if (fd >= sysctl_nr_open)
932 goto out;
931 933
932 fdt = files_fdtable(current->files); 934 fdt = files_fdtable(current->files);
933 filp = fdt->fd[fd]; 935 filp = fdt->fd[fd];
diff --git a/arch/v850/kernel/anna.c b/arch/v850/kernel/anna.c
index 0e429041a117..5978a25170fb 100644
--- a/arch/v850/kernel/anna.c
+++ b/arch/v850/kernel/anna.c
@@ -85,7 +85,8 @@ void __init mach_reserve_bootmem ()
85 /* The space between SRAM and SDRAM is filled with duplicate 85 /* The space between SRAM and SDRAM is filled with duplicate
86 images of SRAM. Prevent the kernel from using them. */ 86 images of SRAM. Prevent the kernel from using them. */
87 reserve_bootmem (SRAM_ADDR + SRAM_SIZE, 87 reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
88 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE)); 88 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE),
89 BOOTMEM_DEFAULT);
89} 90}
90 91
91void mach_gettimeofday (struct timespec *tv) 92void mach_gettimeofday (struct timespec *tv)
diff --git a/arch/v850/kernel/as85ep1.c b/arch/v850/kernel/as85ep1.c
index 18437bc5c3ad..b525ecf3aea4 100644
--- a/arch/v850/kernel/as85ep1.c
+++ b/arch/v850/kernel/as85ep1.c
@@ -116,7 +116,8 @@ void __init mach_reserve_bootmem ()
116 if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START) 116 if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START)
117 /* We can't use the space between SRAM and SDRAM, so 117 /* We can't use the space between SRAM and SDRAM, so
118 prevent the kernel from trying. */ 118 prevent the kernel from trying. */
119 reserve_bootmem (SRAM_END, SDRAM_ADDR - SRAM_END); 119 reserve_bootmem(SRAM_END, SDRAM_ADDR - SRAM_END,
120 BOOTMEM_DEFAULT);
120} 121}
121 122
122void mach_gettimeofday (struct timespec *tv) 123void mach_gettimeofday (struct timespec *tv)
diff --git a/arch/v850/kernel/rte_ma1_cb.c b/arch/v850/kernel/rte_ma1_cb.c
index 9a716f946421..08abf3d5f8df 100644
--- a/arch/v850/kernel/rte_ma1_cb.c
+++ b/arch/v850/kernel/rte_ma1_cb.c
@@ -46,13 +46,15 @@ void __init mach_reserve_bootmem ()
46{ 46{
47#ifdef CONFIG_RTE_CB_MULTI 47#ifdef CONFIG_RTE_CB_MULTI
48 /* Prevent the kernel from touching the monitor's scratch RAM. */ 48 /* Prevent the kernel from touching the monitor's scratch RAM. */
49 reserve_bootmem (MON_SCRATCH_ADDR, MON_SCRATCH_SIZE); 49 reserve_bootmem(MON_SCRATCH_ADDR, MON_SCRATCH_SIZE,
50 BOOTMEM_DEFAULT);
50#endif 51#endif
51 52
52 /* The space between SRAM and SDRAM is filled with duplicate 53 /* The space between SRAM and SDRAM is filled with duplicate
53 images of SRAM. Prevent the kernel from using them. */ 54 images of SRAM. Prevent the kernel from using them. */
54 reserve_bootmem (SRAM_ADDR + SRAM_SIZE, 55 reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
55 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE)); 56 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE),
57 BOOTMEM_DEFAULT);
56} 58}
57 59
58void mach_gettimeofday (struct timespec *tv) 60void mach_gettimeofday (struct timespec *tv)
diff --git a/arch/v850/kernel/setup.c b/arch/v850/kernel/setup.c
index a914f244f494..a0a8456a8430 100644
--- a/arch/v850/kernel/setup.c
+++ b/arch/v850/kernel/setup.c
@@ -241,15 +241,18 @@ init_bootmem_alloc (unsigned long ram_start, unsigned long ram_len)
241 if (kram_end > kram_start) 241 if (kram_end > kram_start)
242 /* Reserve the RAM part of the kernel's address space, so it 242 /* Reserve the RAM part of the kernel's address space, so it
243 doesn't get allocated. */ 243 doesn't get allocated. */
244 reserve_bootmem (kram_start, kram_end - kram_start); 244 reserve_bootmem(kram_start, kram_end - kram_start,
245 BOOTMEM_DEFAULT);
245 246
246 if (intv_in_ram && !intv_in_kram) 247 if (intv_in_ram && !intv_in_kram)
247 /* Reserve the interrupt vector space. */ 248 /* Reserve the interrupt vector space. */
248 reserve_bootmem (intv_start, intv_end - intv_start); 249 reserve_bootmem(intv_start, intv_end - intv_start,
250 BOOTMEM_DEFAULT);
249 251
250 if (bootmap >= ram_start && bootmap < ram_end) 252 if (bootmap >= ram_start && bootmap < ram_end)
251 /* Reserve the bootmap space. */ 253 /* Reserve the bootmap space. */
252 reserve_bootmem (bootmap, bootmap_len); 254 reserve_bootmem(bootmap, bootmap_len,
255 BOOTMEM_DEFAULT);
253 256
254 /* Reserve the memory used by the root filesystem image if it's 257 /* Reserve the memory used by the root filesystem image if it's
255 in RAM. */ 258 in RAM. */
@@ -257,7 +260,8 @@ init_bootmem_alloc (unsigned long ram_start, unsigned long ram_len)
257 && (unsigned long)&_root_fs_image_start >= ram_start 260 && (unsigned long)&_root_fs_image_start >= ram_start
258 && (unsigned long)&_root_fs_image_start < ram_end) 261 && (unsigned long)&_root_fs_image_start < ram_end)
259 reserve_bootmem ((unsigned long)&_root_fs_image_start, 262 reserve_bootmem ((unsigned long)&_root_fs_image_start,
260 &_root_fs_image_end - &_root_fs_image_start); 263 &_root_fs_image_end - &_root_fs_image_start,
264 BOOTMEM_DEFAULT);
261 265
262 /* Let the platform-dependent code reserve some too. */ 266 /* Let the platform-dependent code reserve some too. */
263 if (mrb) 267 if (mrb)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 434821187cfc..923c3babd667 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -415,7 +415,7 @@ config HPET_TIMER
415 415
416config HPET_EMULATE_RTC 416config HPET_EMULATE_RTC
417 def_bool y 417 def_bool y
418 depends on HPET_TIMER && (RTC=y || RTC=m) 418 depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || RTC_DRV_CMOS=y)
419 419
420# Mark as embedded because too many people got it wrong. 420# Mark as embedded because too many people got it wrong.
421# The code disables itself when not needed. 421# The code disables itself when not needed.
@@ -631,7 +631,6 @@ config TOSHIBA
631 631
632config I8K 632config I8K
633 tristate "Dell laptop support" 633 tristate "Dell laptop support"
634 depends on X86_32
635 ---help--- 634 ---help---
636 This adds a driver to safely access the System Management Mode 635 This adds a driver to safely access the System Management Mode
637 of the CPU on the Dell Inspiron 8000. The System Management Mode 636 of the CPU on the Dell Inspiron 8000. The System Management Mode
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 2e1e3af28c3a..fa555148823d 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -220,9 +220,9 @@ config DEBUG_BOOT_PARAMS
220 This option will cause struct boot_params to be exported via debugfs. 220 This option will cause struct boot_params to be exported via debugfs.
221 221
222config CPA_DEBUG 222config CPA_DEBUG
223 bool "CPA self test code" 223 bool "CPA self-test code"
224 depends on DEBUG_KERNEL 224 depends on DEBUG_KERNEL
225 help 225 help
226 Do change_page_attr self tests at boot. 226 Do change_page_attr() self-tests every 30 seconds.
227 227
228endmenu 228endmenu
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index e4c12079171b..58cccb6483b0 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -172,8 +172,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
172 has_dumped = 1; 172 has_dumped = 1;
173 current->flags |= PF_DUMPCORE; 173 current->flags |= PF_DUMPCORE;
174 strncpy(dump.u_comm, current->comm, sizeof(current->comm)); 174 strncpy(dump.u_comm, current->comm, sizeof(current->comm));
175 dump.u_ar0 = (u32)(((unsigned long)(&dump.regs)) - 175 dump.u_ar0 = offsetof(struct user32, regs);
176 ((unsigned long)(&dump)));
177 dump.signal = signr; 176 dump.signal = signr;
178 dump_thread32(regs, &dump); 177 dump_thread32(regs, &dump);
179 178
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d9313d9adced..f86a3c4a2669 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -637,7 +637,7 @@ void __init early_cpu_init(void)
637} 637}
638 638
639/* Make sure %fs is initialized properly in idle threads */ 639/* Make sure %fs is initialized properly in idle threads */
640struct pt_regs * __devinit idle_regs(struct pt_regs *regs) 640struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
641{ 641{
642 memset(regs, 0, sizeof(struct pt_regs)); 642 memset(regs, 0, sizeof(struct pt_regs));
643 regs->fs = __KERNEL_PERCPU; 643 regs->fs = __KERNEL_PERCPU;
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index a0522735dd9d..5affe91ca1e5 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -827,7 +827,6 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf
827 827
828 for (i = 0; i < data->acpi_data.state_count; i++) { 828 for (i = 0; i < data->acpi_data.state_count; i++) {
829 u32 index; 829 u32 index;
830 u32 hi = 0, lo = 0;
831 830
832 index = data->acpi_data.states[i].control & HW_PSTATE_MASK; 831 index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
833 if (index > data->max_hw_pstate) { 832 if (index > data->max_hw_pstate) {
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 404a6a2d4016..7139b0262703 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -83,8 +83,6 @@ static char cyrix_model_mult2[] __cpuinitdata = "12233445";
83 * FIXME: our newer udelay uses the tsc. We don't need to frob with SLOP 83 * FIXME: our newer udelay uses the tsc. We don't need to frob with SLOP
84 */ 84 */
85 85
86extern void calibrate_delay(void) __init;
87
88static void __cpuinit check_cx686_slop(struct cpuinfo_x86 *c) 86static void __cpuinit check_cx686_slop(struct cpuinfo_x86 *c)
89{ 87{
90 unsigned long flags; 88 unsigned long flags;
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 1e27b69a7a0e..b6e136f23d3d 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -659,7 +659,7 @@ static __init int amd_special_default_mtrr(void)
659 */ 659 */
660int __init mtrr_trim_uncached_memory(unsigned long end_pfn) 660int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
661{ 661{
662 unsigned long i, base, size, highest_addr = 0, def, dummy; 662 unsigned long i, base, size, highest_pfn = 0, def, dummy;
663 mtrr_type type; 663 mtrr_type type;
664 u64 trim_start, trim_size; 664 u64 trim_start, trim_size;
665 665
@@ -682,28 +682,27 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
682 mtrr_if->get(i, &base, &size, &type); 682 mtrr_if->get(i, &base, &size, &type);
683 if (type != MTRR_TYPE_WRBACK) 683 if (type != MTRR_TYPE_WRBACK)
684 continue; 684 continue;
685 base <<= PAGE_SHIFT; 685 if (highest_pfn < base + size)
686 size <<= PAGE_SHIFT; 686 highest_pfn = base + size;
687 if (highest_addr < base + size)
688 highest_addr = base + size;
689 } 687 }
690 688
691 /* kvm/qemu doesn't have mtrr set right, don't trim them all */ 689 /* kvm/qemu doesn't have mtrr set right, don't trim them all */
692 if (!highest_addr) { 690 if (!highest_pfn) {
693 printk(KERN_WARNING "WARNING: strange, CPU MTRRs all blank?\n"); 691 printk(KERN_WARNING "WARNING: strange, CPU MTRRs all blank?\n");
694 WARN_ON(1); 692 WARN_ON(1);
695 return 0; 693 return 0;
696 } 694 }
697 695
698 if ((highest_addr >> PAGE_SHIFT) < end_pfn) { 696 if (highest_pfn < end_pfn) {
699 printk(KERN_WARNING "WARNING: BIOS bug: CPU MTRRs don't cover" 697 printk(KERN_WARNING "WARNING: BIOS bug: CPU MTRRs don't cover"
700 " all of memory, losing %LdMB of RAM.\n", 698 " all of memory, losing %luMB of RAM.\n",
701 (((u64)end_pfn << PAGE_SHIFT) - highest_addr) >> 20); 699 (end_pfn - highest_pfn) >> (20 - PAGE_SHIFT));
702 700
703 WARN_ON(1); 701 WARN_ON(1);
704 702
705 printk(KERN_INFO "update e820 for mtrr\n"); 703 printk(KERN_INFO "update e820 for mtrr\n");
706 trim_start = highest_addr; 704 trim_start = highest_pfn;
705 trim_start <<= PAGE_SHIFT;
707 trim_size = end_pfn; 706 trim_size = end_pfn;
708 trim_size <<= PAGE_SHIFT; 707 trim_size <<= PAGE_SHIFT;
709 trim_size -= trim_start; 708 trim_size -= trim_start;
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index bea8474744ff..c7341e81941c 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -582,7 +582,6 @@ retint_restore_args: /* return to kernel space */
582 TRACE_IRQS_IRETQ 582 TRACE_IRQS_IRETQ
583restore_args: 583restore_args:
584 RESTORE_ARGS 0,8,0 584 RESTORE_ARGS 0,8,0
585iret_label:
586#ifdef CONFIG_PARAVIRT 585#ifdef CONFIG_PARAVIRT
587 INTERRUPT_RETURN 586 INTERRUPT_RETURN
588#endif 587#endif
@@ -593,13 +592,22 @@ ENTRY(native_iret)
593 .quad native_iret, bad_iret 592 .quad native_iret, bad_iret
594 .previous 593 .previous
595 .section .fixup,"ax" 594 .section .fixup,"ax"
596 /* force a signal here? this matches i386 behaviour */
597 /* running with kernel gs */
598bad_iret: 595bad_iret:
599 movq $11,%rdi /* SIGSEGV */ 596 /*
600 TRACE_IRQS_ON 597 * The iret traps when the %cs or %ss being restored is bogus.
601 ENABLE_INTERRUPTS(CLBR_ANY | ~(CLBR_RDI)) 598 * We've lost the original trap vector and error code.
602 jmp do_exit 599 * #GPF is the most likely one to get for an invalid selector.
600 * So pretend we completed the iret and took the #GPF in user mode.
601 *
602 * We are now running with the kernel GS after exception recovery.
603 * But error_entry expects us to have user GS to match the user %cs,
604 * so swap back.
605 */
606 pushq $0
607
608 SWAPGS
609 jmp general_protection
610
603 .previous 611 .previous
604 612
605 /* edi: workmask, edx: work */ 613 /* edi: workmask, edx: work */
@@ -911,7 +919,7 @@ error_kernelspace:
911 iret run with kernel gs again, so don't set the user space flag. 919 iret run with kernel gs again, so don't set the user space flag.
912 B stepping K8s sometimes report an truncated RIP for IRET 920 B stepping K8s sometimes report an truncated RIP for IRET
913 exceptions returning to compat mode. Check for these here too. */ 921 exceptions returning to compat mode. Check for these here too. */
914 leaq iret_label(%rip),%rbp 922 leaq native_iret(%rip),%rbp
915 cmpq %rbp,RIP(%rsp) 923 cmpq %rbp,RIP(%rsp)
916 je error_swapgs 924 je error_swapgs
917 movl %ebp,%ebp /* zero extend */ 925 movl %ebp,%ebp /* zero extend */
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 4f283ad215ec..09b38d539b09 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -250,18 +250,13 @@ ENTRY(secondary_startup_64)
250 lretq 250 lretq
251 251
252 /* SMP bootup changes these two */ 252 /* SMP bootup changes these two */
253#ifndef CONFIG_HOTPLUG_CPU 253 __CPUINITDATA
254 .pushsection .init.data
255#endif
256 .align 8 254 .align 8
257 .globl initial_code 255 ENTRY(initial_code)
258initial_code:
259 .quad x86_64_start_kernel 256 .quad x86_64_start_kernel
260#ifndef CONFIG_HOTPLUG_CPU 257 __FINITDATA
261 .popsection 258
262#endif 259 ENTRY(init_rsp)
263 .globl init_rsp
264init_rsp:
265 .quad init_thread_union+THREAD_SIZE-8 260 .quad init_thread_union+THREAD_SIZE-8
266 261
267bad_address: 262bad_address:
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index c1cfd60639d4..d0b234c9fc31 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -151,7 +151,7 @@ NORET_TYPE void machine_kexec(struct kimage *image)
151 151
152void arch_crash_save_vmcoreinfo(void) 152void arch_crash_save_vmcoreinfo(void)
153{ 153{
154#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE 154#ifdef CONFIG_NUMA
155 VMCOREINFO_SYMBOL(node_data); 155 VMCOREINFO_SYMBOL(node_data);
156 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); 156 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
157#endif 157#endif
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index a1fef42f8cdb..236d2f8f7ddc 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -234,5 +234,10 @@ NORET_TYPE void machine_kexec(struct kimage *image)
234void arch_crash_save_vmcoreinfo(void) 234void arch_crash_save_vmcoreinfo(void)
235{ 235{
236 VMCOREINFO_SYMBOL(init_level4_pgt); 236 VMCOREINFO_SYMBOL(init_level4_pgt);
237
238#ifdef CONFIG_NUMA
239 VMCOREINFO_SYMBOL(node_data);
240 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
241#endif
237} 242}
238 243
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index 67009cdd5eca..f349e68e45a0 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -736,7 +736,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
736 smp_found_config = 1; 736 smp_found_config = 1;
737 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n", 737 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
738 mpf, virt_to_phys(mpf)); 738 mpf, virt_to_phys(mpf));
739 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE); 739 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
740 BOOTMEM_DEFAULT);
740 if (mpf->mpf_physptr) { 741 if (mpf->mpf_physptr) {
741 /* 742 /*
742 * We cannot access to MPC table to compute 743 * We cannot access to MPC table to compute
@@ -751,7 +752,8 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
751 unsigned long end = max_low_pfn * PAGE_SIZE; 752 unsigned long end = max_low_pfn * PAGE_SIZE;
752 if (mpf->mpf_physptr + size > end) 753 if (mpf->mpf_physptr + size > end)
753 size = end - mpf->mpf_physptr; 754 size = end - mpf->mpf_physptr;
754 reserve_bootmem(mpf->mpf_physptr, size); 755 reserve_bootmem(mpf->mpf_physptr, size,
756 BOOTMEM_DEFAULT);
755 } 757 }
756 758
757 mpf_found = mpf; 759 mpf_found = mpf;
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 96286df1bb81..702c33efea84 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -103,9 +103,26 @@ static int set_segment_reg(struct task_struct *task,
103 if (invalid_selector(value)) 103 if (invalid_selector(value))
104 return -EIO; 104 return -EIO;
105 105
106 if (offset != offsetof(struct user_regs_struct, gs)) 106 /*
107 * For %cs and %ss we cannot permit a null selector.
108 * We can permit a bogus selector as long as it has USER_RPL.
109 * Null selectors are fine for other segment registers, but
110 * we will never get back to user mode with invalid %cs or %ss
111 * and will take the trap in iret instead. Much code relies
112 * on user_mode() to distinguish a user trap frame (which can
113 * safely use invalid selectors) from a kernel trap frame.
114 */
115 switch (offset) {
116 case offsetof(struct user_regs_struct, cs):
117 case offsetof(struct user_regs_struct, ss):
118 if (unlikely(value == 0))
119 return -EIO;
120
121 default:
107 *pt_regs_access(task_pt_regs(task), offset) = value; 122 *pt_regs_access(task_pt_regs(task), offset) = value;
108 else { 123 break;
124
125 case offsetof(struct user_regs_struct, gs):
109 task->thread.gs = value; 126 task->thread.gs = value;
110 if (task == current) 127 if (task == current)
111 /* 128 /*
@@ -227,12 +244,16 @@ static int set_segment_reg(struct task_struct *task,
227 * Can't actually change these in 64-bit mode. 244 * Can't actually change these in 64-bit mode.
228 */ 245 */
229 case offsetof(struct user_regs_struct,cs): 246 case offsetof(struct user_regs_struct,cs):
247 if (unlikely(value == 0))
248 return -EIO;
230#ifdef CONFIG_IA32_EMULATION 249#ifdef CONFIG_IA32_EMULATION
231 if (test_tsk_thread_flag(task, TIF_IA32)) 250 if (test_tsk_thread_flag(task, TIF_IA32))
232 task_pt_regs(task)->cs = value; 251 task_pt_regs(task)->cs = value;
233#endif 252#endif
234 break; 253 break;
235 case offsetof(struct user_regs_struct,ss): 254 case offsetof(struct user_regs_struct,ss):
255 if (unlikely(value == 0))
256 return -EIO;
236#ifdef CONFIG_IA32_EMULATION 257#ifdef CONFIG_IA32_EMULATION
237 if (test_tsk_thread_flag(task, TIF_IA32)) 258 if (test_tsk_thread_flag(task, TIF_IA32))
238 task_pt_regs(task)->ss = value; 259 task_pt_regs(task)->ss = value;
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 3cd7a2dcd4fe..6ba33ca8715a 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -380,19 +380,19 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0367,
380void force_hpet_resume(void) 380void force_hpet_resume(void)
381{ 381{
382 switch (force_hpet_resume_type) { 382 switch (force_hpet_resume_type) {
383 case ICH_FORCE_HPET_RESUME: 383 case ICH_FORCE_HPET_RESUME:
384 return ich_force_hpet_resume(); 384 ich_force_hpet_resume();
385 385 return;
386 case OLD_ICH_FORCE_HPET_RESUME: 386 case OLD_ICH_FORCE_HPET_RESUME:
387 return old_ich_force_hpet_resume(); 387 old_ich_force_hpet_resume();
388 388 return;
389 case VT8237_FORCE_HPET_RESUME: 389 case VT8237_FORCE_HPET_RESUME:
390 return vt8237_force_hpet_resume(); 390 vt8237_force_hpet_resume();
391 391 return;
392 case NVIDIA_FORCE_HPET_RESUME: 392 case NVIDIA_FORCE_HPET_RESUME:
393 return nvidia_force_hpet_resume(); 393 nvidia_force_hpet_resume();
394 394 return;
395 default: 395 default:
396 break; 396 break;
397 } 397 }
398} 398}
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 62adc5f20be5..d1d8c347cc0b 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -390,7 +390,7 @@ static void __init reserve_ebda_region(void)
390 unsigned int addr; 390 unsigned int addr;
391 addr = get_bios_ebda(); 391 addr = get_bios_ebda();
392 if (addr) 392 if (addr)
393 reserve_bootmem(addr, PAGE_SIZE); 393 reserve_bootmem(addr, PAGE_SIZE, BOOTMEM_DEFAULT);
394} 394}
395 395
396#ifndef CONFIG_NEED_MULTIPLE_NODES 396#ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -484,7 +484,8 @@ static void __init reserve_crashkernel(void)
484 (unsigned long)(total_mem >> 20)); 484 (unsigned long)(total_mem >> 20));
485 crashk_res.start = crash_base; 485 crashk_res.start = crash_base;
486 crashk_res.end = crash_base + crash_size - 1; 486 crashk_res.end = crash_base + crash_size - 1;
487 reserve_bootmem(crash_base, crash_size); 487 reserve_bootmem(crash_base, crash_size,
488 BOOTMEM_DEFAULT);
488 } else 489 } else
489 printk(KERN_INFO "crashkernel reservation failed - " 490 printk(KERN_INFO "crashkernel reservation failed - "
490 "you have to specify a base address\n"); 491 "you have to specify a base address\n");
@@ -525,7 +526,7 @@ static void __init reserve_initrd(void)
525 } 526 }
526 if (ramdisk_end <= end_of_lowmem) { 527 if (ramdisk_end <= end_of_lowmem) {
527 /* All in lowmem, easy case */ 528 /* All in lowmem, easy case */
528 reserve_bootmem(ramdisk_image, ramdisk_size); 529 reserve_bootmem(ramdisk_image, ramdisk_size, BOOTMEM_DEFAULT);
529 initrd_start = ramdisk_image + PAGE_OFFSET; 530 initrd_start = ramdisk_image + PAGE_OFFSET;
530 initrd_end = initrd_start+ramdisk_size; 531 initrd_end = initrd_start+ramdisk_size;
531 return; 532 return;
@@ -536,7 +537,7 @@ static void __init reserve_initrd(void)
536 537
537 /* Note: this includes all the lowmem currently occupied by 538 /* Note: this includes all the lowmem currently occupied by
538 the initrd, we rely on that fact to keep the data intact. */ 539 the initrd, we rely on that fact to keep the data intact. */
539 reserve_bootmem(ramdisk_here, ramdisk_size); 540 reserve_bootmem(ramdisk_here, ramdisk_size, BOOTMEM_DEFAULT);
540 initrd_start = ramdisk_here + PAGE_OFFSET; 541 initrd_start = ramdisk_here + PAGE_OFFSET;
541 initrd_end = initrd_start + ramdisk_size; 542 initrd_end = initrd_start + ramdisk_size;
542 543
@@ -606,13 +607,14 @@ void __init setup_bootmem_allocator(void)
606 * bootmem allocator with an invalid RAM area. 607 * bootmem allocator with an invalid RAM area.
607 */ 608 */
608 reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) + 609 reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) +
609 bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text)); 610 bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text),
611 BOOTMEM_DEFAULT);
610 612
611 /* 613 /*
612 * reserve physical page 0 - it's a special BIOS page on many boxes, 614 * reserve physical page 0 - it's a special BIOS page on many boxes,
613 * enabling clean reboots, SMP operation, laptop functions. 615 * enabling clean reboots, SMP operation, laptop functions.
614 */ 616 */
615 reserve_bootmem(0, PAGE_SIZE); 617 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
616 618
617 /* reserve EBDA region, it's a 4K region */ 619 /* reserve EBDA region, it's a 4K region */
618 reserve_ebda_region(); 620 reserve_ebda_region();
@@ -622,7 +624,7 @@ void __init setup_bootmem_allocator(void)
622 unless you have no PS/2 mouse plugged in. */ 624 unless you have no PS/2 mouse plugged in. */
623 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD && 625 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
624 boot_cpu_data.x86 == 6) 626 boot_cpu_data.x86 == 6)
625 reserve_bootmem(0xa0000 - 4096, 4096); 627 reserve_bootmem(0xa0000 - 4096, 4096, BOOTMEM_DEFAULT);
626 628
627#ifdef CONFIG_SMP 629#ifdef CONFIG_SMP
628 /* 630 /*
@@ -630,7 +632,7 @@ void __init setup_bootmem_allocator(void)
630 * FIXME: Don't need the extra page at 4K, but need to fix 632 * FIXME: Don't need the extra page at 4K, but need to fix
631 * trampoline before removing it. (see the GDT stuff) 633 * trampoline before removing it. (see the GDT stuff)
632 */ 634 */
633 reserve_bootmem(PAGE_SIZE, PAGE_SIZE); 635 reserve_bootmem(PAGE_SIZE, PAGE_SIZE, BOOTMEM_DEFAULT);
634#endif 636#endif
635#ifdef CONFIG_ACPI_SLEEP 637#ifdef CONFIG_ACPI_SLEEP
636 /* 638 /*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index c8939dfddfba..a49f5f734a5e 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -189,7 +189,7 @@ contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
189 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn); 189 bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
190 e820_register_active_regions(0, start_pfn, end_pfn); 190 e820_register_active_regions(0, start_pfn, end_pfn);
191 free_bootmem_with_active_regions(0, end_pfn); 191 free_bootmem_with_active_regions(0, end_pfn);
192 reserve_bootmem(bootmap, bootmap_size); 192 reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
193} 193}
194#endif 194#endif
195 195
@@ -220,28 +220,35 @@ static inline void copy_edd(void)
220#ifdef CONFIG_KEXEC 220#ifdef CONFIG_KEXEC
221static void __init reserve_crashkernel(void) 221static void __init reserve_crashkernel(void)
222{ 222{
223 unsigned long long free_mem; 223 unsigned long long total_mem;
224 unsigned long long crash_size, crash_base; 224 unsigned long long crash_size, crash_base;
225 int ret; 225 int ret;
226 226
227 free_mem = 227 total_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
228 ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
229 228
230 ret = parse_crashkernel(boot_command_line, free_mem, 229 ret = parse_crashkernel(boot_command_line, total_mem,
231 &crash_size, &crash_base); 230 &crash_size, &crash_base);
232 if (ret == 0 && crash_size) { 231 if (ret == 0 && crash_size) {
233 if (crash_base > 0) { 232 if (crash_base <= 0) {
234 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
235 "for crashkernel (System RAM: %ldMB)\n",
236 (unsigned long)(crash_size >> 20),
237 (unsigned long)(crash_base >> 20),
238 (unsigned long)(free_mem >> 20));
239 crashk_res.start = crash_base;
240 crashk_res.end = crash_base + crash_size - 1;
241 reserve_bootmem(crash_base, crash_size);
242 } else
243 printk(KERN_INFO "crashkernel reservation failed - " 233 printk(KERN_INFO "crashkernel reservation failed - "
244 "you have to specify a base address\n"); 234 "you have to specify a base address\n");
235 return;
236 }
237
238 if (reserve_bootmem(crash_base, crash_size,
239 BOOTMEM_EXCLUSIVE) < 0) {
240 printk(KERN_INFO "crashkernel reservation failed - "
241 "memory is in use\n");
242 return;
243 }
244
245 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
246 "for crashkernel (System RAM: %ldMB)\n",
247 (unsigned long)(crash_size >> 20),
248 (unsigned long)(crash_base >> 20),
249 (unsigned long)(total_mem >> 20));
250 crashk_res.start = crash_base;
251 crashk_res.end = crash_base + crash_size - 1;
245 } 252 }
246} 253}
247#else 254#else
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index 5787a0c3e296..579b9b740c7c 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -202,8 +202,6 @@ valid_k7:
202 ; 202 ;
203} 203}
204 204
205extern void calibrate_delay(void);
206
207static atomic_t init_deasserted; 205static atomic_t init_deasserted;
208 206
209static void __cpuinit smp_callin(void) 207static void __cpuinit smp_callin(void)
diff --git a/arch/x86/kernel/test_nx.c b/arch/x86/kernel/test_nx.c
index 36c100c323aa..10b8a6f69f84 100644
--- a/arch/x86/kernel/test_nx.c
+++ b/arch/x86/kernel/test_nx.c
@@ -139,7 +139,6 @@ static int test_NX(void)
139 * Until then, don't run them to avoid too many people getting scared 139 * Until then, don't run them to avoid too many people getting scared
140 * by the error message 140 * by the error message
141 */ 141 */
142#if 0
143 142
144#ifdef CONFIG_DEBUG_RODATA 143#ifdef CONFIG_DEBUG_RODATA
145 /* Test 3: Check if the .rodata section is executable */ 144 /* Test 3: Check if the .rodata section is executable */
@@ -152,6 +151,7 @@ static int test_NX(void)
152 } 151 }
153#endif 152#endif
154 153
154#if 0
155 /* Test 4: Check if the .data section of a module is executable */ 155 /* Test 4: Check if the .data section of a module is executable */
156 if (test_address(&test_data)) { 156 if (test_address(&test_data)) {
157 printk(KERN_ERR "test_nx: .data section is executable\n"); 157 printk(KERN_ERR "test_nx: .data section is executable\n");
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 3cf72977d012..b22c01e05a18 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -1176,17 +1176,12 @@ void __init trap_init(void)
1176#endif 1176#endif
1177 set_trap_gate(19,&simd_coprocessor_error); 1177 set_trap_gate(19,&simd_coprocessor_error);
1178 1178
1179 /*
1180 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
1181 * Generate a build-time error if the alignment is wrong.
1182 */
1183 BUILD_BUG_ON(offsetof(struct task_struct, thread.i387.fxsave) & 15);
1179 if (cpu_has_fxsr) { 1184 if (cpu_has_fxsr) {
1180 /*
1181 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
1182 * Generates a compile-time "error: zero width for bit-field" if
1183 * the alignment is wrong.
1184 */
1185 struct fxsrAlignAssert {
1186 int _:!(offsetof(struct task_struct,
1187 thread.i387.fxsave) & 15);
1188 };
1189
1190 printk(KERN_INFO "Enabling fast FPU save and restore... "); 1185 printk(KERN_INFO "Enabling fast FPU save and restore... ");
1191 set_in_cr4(X86_CR4_OSFXSR); 1186 set_in_cr4(X86_CR4_OSFXSR);
1192 printk("done.\n"); 1187 printk("done.\n");
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c
index aad9d95469dc..4535e6d147ad 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay_32.c
@@ -12,8 +12,10 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/timex.h>
15#include <linux/preempt.h> 16#include <linux/preempt.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/init.h>
17 19
18#include <asm/processor.h> 20#include <asm/processor.h>
19#include <asm/delay.h> 21#include <asm/delay.h>
@@ -63,7 +65,7 @@ void use_tsc_delay(void)
63 delay_fn = delay_tsc; 65 delay_fn = delay_tsc;
64} 66}
65 67
66int read_current_timer(unsigned long *timer_val) 68int __devinit read_current_timer(unsigned long *timer_val)
67{ 69{
68 if (delay_fn == delay_tsc) { 70 if (delay_fn == delay_tsc) {
69 rdtscl(*timer_val); 71 rdtscl(*timer_val);
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
index 45cdd3fbd91c..bbc610518516 100644
--- a/arch/x86/lib/delay_64.c
+++ b/arch/x86/lib/delay_64.c
@@ -10,8 +10,10 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/timex.h>
13#include <linux/preempt.h> 14#include <linux/preempt.h>
14#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/init.h>
15 17
16#include <asm/delay.h> 18#include <asm/delay.h>
17#include <asm/msr.h> 19#include <asm/msr.h>
@@ -20,7 +22,7 @@
20#include <asm/smp.h> 22#include <asm/smp.h>
21#endif 23#endif
22 24
23int read_current_timer(unsigned long *timer_value) 25int __devinit read_current_timer(unsigned long *timer_value)
24{ 26{
25 rdtscll(*timer_value); 27 rdtscll(*timer_value);
26 return 0; 28 return 0;
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index dffa786f61fe..3cc8eb2f36a9 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -444,8 +444,6 @@ static __u32 __init setup_trampoline(void)
444static void __init start_secondary(void *unused) 444static void __init start_secondary(void *unused)
445{ 445{
446 __u8 cpuid = hard_smp_processor_id(); 446 __u8 cpuid = hard_smp_processor_id();
447 /* external functions not defined in the headers */
448 extern void calibrate_delay(void);
449 447
450 cpu_init(); 448 cpu_init();
451 449
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 04b1d20e2613..c394ca0720b8 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -391,7 +391,8 @@ unsigned long __init setup_memory(void)
391void __init numa_kva_reserve(void) 391void __init numa_kva_reserve(void)
392{ 392{
393 if (kva_pages) 393 if (kva_pages)
394 reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages)); 394 reserve_bootmem(PFN_PHYS(kva_start_pfn), PFN_PHYS(kva_pages),
395 BOOTMEM_DEFAULT);
395} 396}
396 397
397void __init zone_sizes_init(void) 398void __init zone_sizes_init(void)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index ad8b9733d6b3..621afb6343dc 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -428,6 +428,16 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
428} 428}
429#endif 429#endif
430 430
431static int spurious_fault_check(unsigned long error_code, pte_t *pte)
432{
433 if ((error_code & PF_WRITE) && !pte_write(*pte))
434 return 0;
435 if ((error_code & PF_INSTR) && !pte_exec(*pte))
436 return 0;
437
438 return 1;
439}
440
431/* 441/*
432 * Handle a spurious fault caused by a stale TLB entry. This allows 442 * Handle a spurious fault caused by a stale TLB entry. This allows
433 * us to lazily refresh the TLB when increasing the permissions of a 443 * us to lazily refresh the TLB when increasing the permissions of a
@@ -457,20 +467,21 @@ static int spurious_fault(unsigned long address,
457 if (!pud_present(*pud)) 467 if (!pud_present(*pud))
458 return 0; 468 return 0;
459 469
470 if (pud_large(*pud))
471 return spurious_fault_check(error_code, (pte_t *) pud);
472
460 pmd = pmd_offset(pud, address); 473 pmd = pmd_offset(pud, address);
461 if (!pmd_present(*pmd)) 474 if (!pmd_present(*pmd))
462 return 0; 475 return 0;
463 476
477 if (pmd_large(*pmd))
478 return spurious_fault_check(error_code, (pte_t *) pmd);
479
464 pte = pte_offset_kernel(pmd, address); 480 pte = pte_offset_kernel(pmd, address);
465 if (!pte_present(*pte)) 481 if (!pte_present(*pte))
466 return 0; 482 return 0;
467 483
468 if ((error_code & PF_WRITE) && !pte_write(*pte)) 484 return spurious_fault_check(error_code, pte);
469 return 0;
470 if ((error_code & PF_INSTR) && !pte_exec(*pte))
471 return 0;
472
473 return 1;
474} 485}
475 486
476/* 487/*
@@ -947,11 +958,12 @@ void vmalloc_sync_all(void)
947 for (address = start; address <= VMALLOC_END; address += PGDIR_SIZE) { 958 for (address = start; address <= VMALLOC_END; address += PGDIR_SIZE) {
948 if (!test_bit(pgd_index(address), insync)) { 959 if (!test_bit(pgd_index(address), insync)) {
949 const pgd_t *pgd_ref = pgd_offset_k(address); 960 const pgd_t *pgd_ref = pgd_offset_k(address);
961 unsigned long flags;
950 struct page *page; 962 struct page *page;
951 963
952 if (pgd_none(*pgd_ref)) 964 if (pgd_none(*pgd_ref))
953 continue; 965 continue;
954 spin_lock(&pgd_lock); 966 spin_lock_irqsave(&pgd_lock, flags);
955 list_for_each_entry(page, &pgd_list, lru) { 967 list_for_each_entry(page, &pgd_list, lru) {
956 pgd_t *pgd; 968 pgd_t *pgd;
957 pgd = (pgd_t *)page_address(page) + pgd_index(address); 969 pgd = (pgd_t *)page_address(page) + pgd_index(address);
@@ -960,7 +972,7 @@ void vmalloc_sync_all(void)
960 else 972 else
961 BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); 973 BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref));
962 } 974 }
963 spin_unlock(&pgd_lock); 975 spin_unlock_irqrestore(&pgd_lock, flags);
964 set_bit(pgd_index(address), insync); 976 set_bit(pgd_index(address), insync);
965 } 977 }
966 if (address == start) 978 if (address == start)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 3a98d6f724ab..5fe880fc305d 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -591,10 +591,17 @@ void mark_rodata_ro(void)
591 if (end <= start) 591 if (end <= start)
592 return; 592 return;
593 593
594 set_memory_ro(start, (end - start) >> PAGE_SHIFT);
595 594
596 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 595 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
597 (end - start) >> 10); 596 (end - start) >> 10);
597 set_memory_ro(start, (end - start) >> PAGE_SHIFT);
598
599 /*
600 * The rodata section (but not the kernel text!) should also be
601 * not-executable.
602 */
603 start = ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK;
604 set_memory_nx(start, (end - start) >> PAGE_SHIFT);
598 605
599 rodata_test(); 606 rodata_test();
600 607
@@ -637,9 +644,9 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len)
637 644
638 /* Should check here against the e820 map to avoid double free */ 645 /* Should check here against the e820 map to avoid double free */
639#ifdef CONFIG_NUMA 646#ifdef CONFIG_NUMA
640 reserve_bootmem_node(NODE_DATA(nid), phys, len); 647 reserve_bootmem_node(NODE_DATA(nid), phys, len, BOOTMEM_DEFAULT);
641#else 648#else
642 reserve_bootmem(phys, len); 649 reserve_bootmem(phys, len, BOOTMEM_DEFAULT);
643#endif 650#endif
644 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { 651 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
645 dma_reserve += len / PAGE_SIZE; 652 dma_reserve += len / PAGE_SIZE;
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 5a02bf4c91ec..1aecc658cd7d 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -238,9 +238,10 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
238 238
239 free_bootmem_with_active_regions(nodeid, end); 239 free_bootmem_with_active_regions(nodeid, end);
240 240
241 reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); 241 reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size,
242 BOOTMEM_DEFAULT);
242 reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, 243 reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start,
243 bootmap_pages<<PAGE_SHIFT); 244 bootmap_pages<<PAGE_SHIFT, BOOTMEM_DEFAULT);
244#ifdef CONFIG_ACPI_NUMA 245#ifdef CONFIG_ACPI_NUMA
245 srat_reserve_add_area(nodeid); 246 srat_reserve_add_area(nodeid);
246#endif 247#endif
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 398f3a578dde..ed8201600354 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -5,6 +5,7 @@
5 * and compares page tables forwards and afterwards. 5 * and compares page tables forwards and afterwards.
6 */ 6 */
7#include <linux/bootmem.h> 7#include <linux/bootmem.h>
8#include <linux/kthread.h>
8#include <linux/random.h> 9#include <linux/random.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
10#include <linux/init.h> 11#include <linux/init.h>
@@ -14,8 +15,13 @@
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/kdebug.h> 16#include <asm/kdebug.h>
16 17
18/*
19 * Only print the results of the first pass:
20 */
21static __read_mostly int print = 1;
22
17enum { 23enum {
18 NTEST = 4000, 24 NTEST = 400,
19#ifdef CONFIG_X86_64 25#ifdef CONFIG_X86_64
20 LPS = (1 << PMD_SHIFT), 26 LPS = (1 << PMD_SHIFT),
21#elif defined(CONFIG_X86_PAE) 27#elif defined(CONFIG_X86_PAE)
@@ -31,7 +37,7 @@ struct split_state {
31 long min_exec, max_exec; 37 long min_exec, max_exec;
32}; 38};
33 39
34static __init int print_split(struct split_state *s) 40static int print_split(struct split_state *s)
35{ 41{
36 long i, expected, missed = 0; 42 long i, expected, missed = 0;
37 int printed = 0; 43 int printed = 0;
@@ -82,10 +88,13 @@ static __init int print_split(struct split_state *s)
82 s->max_exec = addr; 88 s->max_exec = addr;
83 } 89 }
84 } 90 }
85 printk(KERN_INFO 91 if (print) {
86 "CPA mapping 4k %lu large %lu gb %lu x %lu[%lx-%lx] miss %lu\n", 92 printk(KERN_INFO
87 s->spg, s->lpg, s->gpg, s->exec, 93 " 4k %lu large %lu gb %lu x %lu[%lx-%lx] miss %lu\n",
88 s->min_exec != ~0UL ? s->min_exec : 0, s->max_exec, missed); 94 s->spg, s->lpg, s->gpg, s->exec,
95 s->min_exec != ~0UL ? s->min_exec : 0,
96 s->max_exec, missed);
97 }
89 98
90 expected = (s->gpg*GPS + s->lpg*LPS)/PAGE_SIZE + s->spg + missed; 99 expected = (s->gpg*GPS + s->lpg*LPS)/PAGE_SIZE + s->spg + missed;
91 if (expected != i) { 100 if (expected != i) {
@@ -96,11 +105,11 @@ static __init int print_split(struct split_state *s)
96 return err; 105 return err;
97} 106}
98 107
99static unsigned long __initdata addr[NTEST]; 108static unsigned long addr[NTEST];
100static unsigned int __initdata len[NTEST]; 109static unsigned int len[NTEST];
101 110
102/* Change the global bit on random pages in the direct mapping */ 111/* Change the global bit on random pages in the direct mapping */
103static __init int exercise_pageattr(void) 112static int pageattr_test(void)
104{ 113{
105 struct split_state sa, sb, sc; 114 struct split_state sa, sb, sc;
106 unsigned long *bm; 115 unsigned long *bm;
@@ -110,7 +119,8 @@ static __init int exercise_pageattr(void)
110 int i, k; 119 int i, k;
111 int err; 120 int err;
112 121
113 printk(KERN_INFO "CPA exercising pageattr\n"); 122 if (print)
123 printk(KERN_INFO "CPA self-test:\n");
114 124
115 bm = vmalloc((max_pfn_mapped + 7) / 8); 125 bm = vmalloc((max_pfn_mapped + 7) / 8);
116 if (!bm) { 126 if (!bm) {
@@ -186,7 +196,6 @@ static __init int exercise_pageattr(void)
186 196
187 failed += print_split(&sb); 197 failed += print_split(&sb);
188 198
189 printk(KERN_INFO "CPA reverting everything\n");
190 for (i = 0; i < NTEST; i++) { 199 for (i = 0; i < NTEST; i++) {
191 if (!addr[i]) 200 if (!addr[i])
192 continue; 201 continue;
@@ -214,12 +223,40 @@ static __init int exercise_pageattr(void)
214 failed += print_split(&sc); 223 failed += print_split(&sc);
215 224
216 if (failed) { 225 if (failed) {
217 printk(KERN_ERR "CPA selftests NOT PASSED. Please report.\n"); 226 printk(KERN_ERR "NOT PASSED. Please report.\n");
218 WARN_ON(1); 227 WARN_ON(1);
228 return -EINVAL;
219 } else { 229 } else {
220 printk(KERN_INFO "CPA selftests PASSED\n"); 230 if (print)
231 printk(KERN_INFO "ok.\n");
221 } 232 }
222 233
223 return 0; 234 return 0;
224} 235}
225module_init(exercise_pageattr); 236
237static int do_pageattr_test(void *__unused)
238{
239 while (!kthread_should_stop()) {
240 schedule_timeout_interruptible(HZ*30);
241 if (pageattr_test() < 0)
242 break;
243 if (print)
244 print--;
245 }
246 return 0;
247}
248
249static int start_pageattr_test(void)
250{
251 struct task_struct *p;
252
253 p = kthread_create(do_pageattr_test, NULL, "pageattr-test");
254 if (!IS_ERR(p))
255 wake_up_process(p);
256 else
257 WARN_ON(1);
258
259 return 0;
260}
261
262module_init(start_pageattr_test);
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 16ce841f08d6..8493c855582b 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -167,8 +167,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address)
167 if (within(address, virt_to_highmap(_text), virt_to_highmap(_etext))) 167 if (within(address, virt_to_highmap(_text), virt_to_highmap(_etext)))
168 pgprot_val(forbidden) |= _PAGE_NX; 168 pgprot_val(forbidden) |= _PAGE_NX;
169 169
170
171#ifdef CONFIG_DEBUG_RODATA
172 /* The .rodata section needs to be read-only */ 170 /* The .rodata section needs to be read-only */
173 if (within(address, (unsigned long)__start_rodata, 171 if (within(address, (unsigned long)__start_rodata,
174 (unsigned long)__end_rodata)) 172 (unsigned long)__end_rodata))
@@ -179,7 +177,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address)
179 if (within(address, virt_to_highmap(__start_rodata), 177 if (within(address, virt_to_highmap(__start_rodata),
180 virt_to_highmap(__end_rodata))) 178 virt_to_highmap(__end_rodata)))
181 pgprot_val(forbidden) |= _PAGE_RW; 179 pgprot_val(forbidden) |= _PAGE_RW;
182#endif
183 180
184 prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); 181 prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden));
185 182
@@ -260,17 +257,6 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
260 pgprot_t old_prot, new_prot; 257 pgprot_t old_prot, new_prot;
261 int level, do_split = 1; 258 int level, do_split = 1;
262 259
263 /*
264 * An Athlon 64 X2 showed hard hangs if we tried to preserve
265 * largepages and changed the PSE entry from RW to RO.
266 *
267 * As AMD CPUs have a long series of erratas in this area,
268 * (and none of the known ones seem to explain this hang),
269 * disable this code until the hang can be debugged:
270 */
271 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
272 return 1;
273
274 spin_lock_irqsave(&pgd_lock, flags); 260 spin_lock_irqsave(&pgd_lock, flags);
275 /* 261 /*
276 * Check for races, another CPU might have split this page 262 * Check for races, another CPU might have split this page
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 65416f843e59..ecd91ea8a8ae 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -488,7 +488,8 @@ void __init srat_reserve_add_area(int nodeid)
488 printk(KERN_INFO "SRAT: This will cost you %Lu MB of " 488 printk(KERN_INFO "SRAT: This will cost you %Lu MB of "
489 "pre-allocated memory.\n", (unsigned long long)total_mb); 489 "pre-allocated memory.\n", (unsigned long long)total_mb);
490 reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start, 490 reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start,
491 nodes_add[nodeid].end - nodes_add[nodeid].start); 491 nodes_add[nodeid].end - nodes_add[nodeid].start,
492 BOOTMEM_DEFAULT);
492 } 493 }
493} 494}
494 495
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 60d29fe0b1bd..8df1e842f6d4 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -204,7 +204,7 @@ again:
204} 204}
205 205
206#ifndef CONFIG_GENERIC_CALIBRATE_DELAY 206#ifndef CONFIG_GENERIC_CALIBRATE_DELAY
207void __devinit calibrate_delay(void) 207void __cpuinit calibrate_delay(void)
208{ 208{
209 loops_per_jiffy = CCOUNT_PER_JIFFY; 209 loops_per_jiffy = CCOUNT_PER_JIFFY;
210 printk("Calibrating delay loop (skipped)... " 210 printk("Calibrating delay loop (skipped)... "