aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-02-28 00:35:24 -0500
committerPaul Mackerras <paulus@samba.org>2006-02-28 00:35:24 -0500
commit6749c5507388f3fc3719f57a54b540ee83f6661a (patch)
treec069f990f86b020a14b50759d0c75475eedde186 /arch
parent2cf82c0256b198ae28c465f2c4d7c12c836ea5ea (diff)
parent56ec6462af9cba56a04439154e5768672d6f390f (diff)
Merge ../powerpc-merge
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-at91rm9200/gpio.c14
-rw-r--r--arch/i386/Kconfig3
-rw-r--r--arch/i386/kernel/Makefile2
-rw-r--r--arch/i386/kernel/cpu/common.c32
-rw-r--r--arch/i386/kernel/efi.c12
-rw-r--r--arch/i386/kernel/head.S2
-rw-r--r--arch/i386/kernel/i386_ksyms.c2
-rw-r--r--arch/i386/kernel/io_apic.c6
-rw-r--r--arch/i386/kernel/kprobes.c16
-rw-r--r--arch/i386/kernel/mpparse.c10
-rw-r--r--arch/i386/kernel/smpboot.c6
-rw-r--r--arch/i386/kernel/topology.c (renamed from arch/i386/mach-default/topology.c)6
-rw-r--r--arch/i386/mach-default/Makefile2
-rw-r--r--arch/i386/mach-voyager/voyager_basic.c3
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c1
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/m32r/Makefile6
-rw-r--r--arch/m32r/kernel/signal.c24
-rw-r--r--arch/m32r/lib/usercopy.c4
-rw-r--r--arch/mips/kernel/linux32.c54
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/kernel/setup.c3
-rw-r--r--arch/mips/kernel/smp.c2
-rw-r--r--arch/mips/kernel/smp_mt.c13
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c24
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c7
-rw-r--r--arch/mips/sibyte/cfe/smp.c10
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/kernel/prom.c54
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S4
-rw-r--r--arch/powerpc/mm/hash_utils_64.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c14
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c36
-rw-r--r--arch/s390/kernel/compat_wrapper.S1
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/sparc64/kernel/setup.c2
-rw-r--r--arch/sparc64/kernel/smp.c28
-rw-r--r--arch/um/drivers/cow.h2
-rw-r--r--arch/um/drivers/cow_sys.h6
-rw-r--r--arch/um/drivers/cow_user.c24
-rw-r--r--arch/um/drivers/net_user.c34
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/include/init.h2
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/os-Linux/file.c19
-rw-r--r--arch/um/os-Linux/process.c16
-rw-r--r--arch/um/sys-i386/ldt.c9
-rw-r--r--arch/x86_64/Kconfig16
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/aperture.c2
-rw-r--r--arch/x86_64/kernel/io_apic.c48
-rw-r--r--arch/x86_64/kernel/pci-gart.c22
-rw-r--r--arch/x86_64/kernel/setup.c6
-rw-r--r--arch/x86_64/kernel/smpboot.c4
-rw-r--r--arch/x86_64/kernel/time.c22
58 files changed, 367 insertions, 291 deletions
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c
index a9f718bf8ba8..0e396feec468 100644
--- a/arch/arm/mach-at91rm9200/gpio.c
+++ b/arch/arm/mach-at91rm9200/gpio.c
@@ -274,8 +274,18 @@ static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs
274 gpio = &irq_desc[pin]; 274 gpio = &irq_desc[pin];
275 275
276 while (isr) { 276 while (isr) {
277 if (isr & 1) 277 if (isr & 1) {
278 gpio->handle(pin, gpio, regs); 278 if (unlikely(gpio->disable_depth)) {
279 /*
280 * The core ARM interrupt handler lazily disables IRQs so
281 * another IRQ must be generated before it actually gets
282 * here to be disabled on the GPIO controller.
283 */
284 gpio_irq_mask(pin);
285 }
286 else
287 gpio->handle(pin, gpio, regs);
288 }
279 pin++; 289 pin++;
280 gpio++; 290 gpio++;
281 isr >>= 1; 291 isr >>= 1;
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 0afec8566e7b..5b1a7d46d1d9 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -733,7 +733,7 @@ config PHYSICAL_START
733 733
734config HOTPLUG_CPU 734config HOTPLUG_CPU
735 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" 735 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
736 depends on SMP && HOTPLUG && EXPERIMENTAL 736 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
737 ---help--- 737 ---help---
738 Say Y here to experiment with turning CPUs off and on. CPUs 738 Say Y here to experiment with turning CPUs off and on. CPUs
739 can be controlled through /sys/devices/system/cpu. 739 can be controlled through /sys/devices/system/cpu.
@@ -1060,6 +1060,7 @@ source "arch/i386/oprofile/Kconfig"
1060 1060
1061config KPROBES 1061config KPROBES
1062 bool "Kprobes (EXPERIMENTAL)" 1062 bool "Kprobes (EXPERIMENTAL)"
1063 depends on EXPERIMENTAL && MODULES
1063 help 1064 help
1064 Kprobes allows you to trap at almost any kernel address and 1065 Kprobes allows you to trap at almost any kernel address and
1065 execute a callback function. register_kprobe() establishes 1066 execute a callback function. register_kprobe() establishes
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 60c3f76dfca4..53bb9a79e274 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.lds
7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ 7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ 9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
10 quirks.o i8237.o 10 quirks.o i8237.o topology.o
11 11
12obj-y += cpu/ 12obj-y += cpu/
13obj-y += timers/ 13obj-y += timers/
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 7eb9213734a3..4ecd4b326ded 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -4,6 +4,7 @@
4#include <linux/smp.h> 4#include <linux/smp.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/bootmem.h>
7#include <asm/semaphore.h> 8#include <asm/semaphore.h>
8#include <asm/processor.h> 9#include <asm/processor.h>
9#include <asm/i387.h> 10#include <asm/i387.h>
@@ -18,6 +19,9 @@
18 19
19#include "cpu.h" 20#include "cpu.h"
20 21
22DEFINE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
23EXPORT_PER_CPU_SYMBOL(cpu_gdt_descr);
24
21DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); 25DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
22EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); 26EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack);
23 27
@@ -571,8 +575,9 @@ void __devinit cpu_init(void)
571 int cpu = smp_processor_id(); 575 int cpu = smp_processor_id();
572 struct tss_struct * t = &per_cpu(init_tss, cpu); 576 struct tss_struct * t = &per_cpu(init_tss, cpu);
573 struct thread_struct *thread = &current->thread; 577 struct thread_struct *thread = &current->thread;
574 struct desc_struct *gdt = get_cpu_gdt_table(cpu); 578 struct desc_struct *gdt;
575 __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu); 579 __u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu);
580 struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
576 581
577 if (cpu_test_and_set(cpu, cpu_initialized)) { 582 if (cpu_test_and_set(cpu, cpu_initialized)) {
578 printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); 583 printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
@@ -590,6 +595,25 @@ void __devinit cpu_init(void)
590 } 595 }
591 596
592 /* 597 /*
598 * This is a horrible hack to allocate the GDT. The problem
599 * is that cpu_init() is called really early for the boot CPU
600 * (and hence needs bootmem) but much later for the secondary
601 * CPUs, when bootmem will have gone away
602 */
603 if (NODE_DATA(0)->bdata->node_bootmem_map) {
604 gdt = (struct desc_struct *)alloc_bootmem_pages(PAGE_SIZE);
605 /* alloc_bootmem_pages panics on failure, so no check */
606 memset(gdt, 0, PAGE_SIZE);
607 } else {
608 gdt = (struct desc_struct *)get_zeroed_page(GFP_KERNEL);
609 if (unlikely(!gdt)) {
610 printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu);
611 for (;;)
612 local_irq_enable();
613 }
614 }
615
616 /*
593 * Initialize the per-CPU GDT with the boot GDT, 617 * Initialize the per-CPU GDT with the boot GDT,
594 * and set up the GDT descriptor: 618 * and set up the GDT descriptor:
595 */ 619 */
@@ -601,10 +625,10 @@ void __devinit cpu_init(void)
601 ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) | 625 ((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) |
602 (CPU_16BIT_STACK_SIZE - 1); 626 (CPU_16BIT_STACK_SIZE - 1);
603 627
604 cpu_gdt_descr[cpu].size = GDT_SIZE - 1; 628 cpu_gdt_descr->size = GDT_SIZE - 1;
605 cpu_gdt_descr[cpu].address = (unsigned long)gdt; 629 cpu_gdt_descr->address = (unsigned long)gdt;
606 630
607 load_gdt(&cpu_gdt_descr[cpu]); 631 load_gdt(cpu_gdt_descr);
608 load_idt(&idt_descr); 632 load_idt(&idt_descr);
609 633
610 /* 634 /*
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c
index ecad519fd395..e3e42fd62401 100644
--- a/arch/i386/kernel/efi.c
+++ b/arch/i386/kernel/efi.c
@@ -103,17 +103,19 @@ static void efi_call_phys_prelog(void)
103 */ 103 */
104 local_flush_tlb(); 104 local_flush_tlb();
105 105
106 cpu_gdt_descr[0].address = __pa(cpu_gdt_descr[0].address); 106 per_cpu(cpu_gdt_descr, 0).address =
107 load_gdt((struct Xgt_desc_struct *) __pa(&cpu_gdt_descr[0])); 107 __pa(per_cpu(cpu_gdt_descr, 0).address);
108 load_gdt((struct Xgt_desc_struct *)__pa(&per_cpu(cpu_gdt_descr, 0)));
108} 109}
109 110
110static void efi_call_phys_epilog(void) 111static void efi_call_phys_epilog(void)
111{ 112{
112 unsigned long cr4; 113 unsigned long cr4;
113 114
114 cpu_gdt_descr[0].address = 115 per_cpu(cpu_gdt_descr, 0).address =
115 (unsigned long) __va(cpu_gdt_descr[0].address); 116 (unsigned long)__va(per_cpu(cpu_gdt_descr, 0).address);
116 load_gdt(&cpu_gdt_descr[0]); 117 load_gdt((struct Xgt_desc_struct *)__va(&per_cpu(cpu_gdt_descr, 0)));
118
117 cr4 = read_cr4(); 119 cr4 = read_cr4();
118 120
119 if (cr4 & X86_CR4_PSE) { 121 if (cr4 & X86_CR4_PSE) {
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 2bee6499edd9..e0b7c632efbc 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -534,5 +534,3 @@ ENTRY(cpu_gdt_table)
534 .quad 0x0000000000000000 /* 0xf0 - unused */ 534 .quad 0x0000000000000000 /* 0xf0 - unused */
535 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ 535 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
536 536
537 /* Be sure this is zeroed to avoid false validations in Xen */
538 .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
index 3999bec50c33..055325056a74 100644
--- a/arch/i386/kernel/i386_ksyms.c
+++ b/arch/i386/kernel/i386_ksyms.c
@@ -3,8 +3,6 @@
3#include <asm/checksum.h> 3#include <asm/checksum.h>
4#include <asm/desc.h> 4#include <asm/desc.h>
5 5
6EXPORT_SYMBOL_GPL(cpu_gdt_descr);
7
8EXPORT_SYMBOL(__down_failed); 6EXPORT_SYMBOL(__down_failed);
9EXPORT_SYMBOL(__down_failed_interruptible); 7EXPORT_SYMBOL(__down_failed_interruptible);
10EXPORT_SYMBOL(__down_failed_trylock); 8EXPORT_SYMBOL(__down_failed_trylock);
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index f2dd218d88cb..235822b3f41b 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -2566,8 +2566,10 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
2566 spin_unlock_irqrestore(&ioapic_lock, flags); 2566 spin_unlock_irqrestore(&ioapic_lock, flags);
2567 2567
2568 /* Sanity check */ 2568 /* Sanity check */
2569 if (reg_00.bits.ID != apic_id) 2569 if (reg_00.bits.ID != apic_id) {
2570 panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic); 2570 printk("IOAPIC[%d]: Unable to change apic_id!\n", ioapic);
2571 return -1;
2572 }
2571 } 2573 }
2572 2574
2573 apic_printk(APIC_VERBOSE, KERN_INFO 2575 apic_printk(APIC_VERBOSE, KERN_INFO
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 6483eeb1a4e8..694a13997637 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -58,6 +58,11 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode)
58 58
59int __kprobes arch_prepare_kprobe(struct kprobe *p) 59int __kprobes arch_prepare_kprobe(struct kprobe *p)
60{ 60{
61 /* insn: must be on special executable page on i386. */
62 p->ainsn.insn = get_insn_slot();
63 if (!p->ainsn.insn)
64 return -ENOMEM;
65
61 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 66 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
62 p->opcode = *p->addr; 67 p->opcode = *p->addr;
63 return 0; 68 return 0;
@@ -77,6 +82,13 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
77 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 82 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
78} 83}
79 84
85void __kprobes arch_remove_kprobe(struct kprobe *p)
86{
87 down(&kprobe_mutex);
88 free_insn_slot(p->ainsn.insn);
89 up(&kprobe_mutex);
90}
91
80static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 92static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
81{ 93{
82 kcb->prev_kprobe.kp = kprobe_running(); 94 kcb->prev_kprobe.kp = kprobe_running();
@@ -111,7 +123,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
111 if (p->opcode == BREAKPOINT_INSTRUCTION) 123 if (p->opcode == BREAKPOINT_INSTRUCTION)
112 regs->eip = (unsigned long)p->addr; 124 regs->eip = (unsigned long)p->addr;
113 else 125 else
114 regs->eip = (unsigned long)&p->ainsn.insn; 126 regs->eip = (unsigned long)p->ainsn.insn;
115} 127}
116 128
117/* Called with kretprobe_lock held */ 129/* Called with kretprobe_lock held */
@@ -351,7 +363,7 @@ static void __kprobes resume_execution(struct kprobe *p,
351{ 363{
352 unsigned long *tos = (unsigned long *)&regs->esp; 364 unsigned long *tos = (unsigned long *)&regs->esp;
353 unsigned long next_eip = 0; 365 unsigned long next_eip = 0;
354 unsigned long copy_eip = (unsigned long)&p->ainsn.insn; 366 unsigned long copy_eip = (unsigned long)p->ainsn.insn;
355 unsigned long orig_eip = (unsigned long)p->addr; 367 unsigned long orig_eip = (unsigned long)p->addr;
356 368
357 switch (p->ainsn.insn[0]) { 369 switch (p->ainsn.insn[0]) {
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index e7609abf3796..e6e2f43db85e 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -915,6 +915,7 @@ void __init mp_register_ioapic (
915 u32 gsi_base) 915 u32 gsi_base)
916{ 916{
917 int idx = 0; 917 int idx = 0;
918 int tmpid;
918 919
919 if (nr_ioapics >= MAX_IO_APICS) { 920 if (nr_ioapics >= MAX_IO_APICS) {
920 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " 921 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
@@ -935,9 +936,14 @@ void __init mp_register_ioapic (
935 936
936 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 937 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
937 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 < 15)) 938 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 < 15))
938 mp_ioapics[idx].mpc_apicid = io_apic_get_unique_id(idx, id); 939 tmpid = io_apic_get_unique_id(idx, id);
939 else 940 else
940 mp_ioapics[idx].mpc_apicid = id; 941 tmpid = id;
942 if (tmpid == -1) {
943 nr_ioapics--;
944 return;
945 }
946 mp_ioapics[idx].mpc_apicid = tmpid;
941 mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); 947 mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx);
942 948
943 /* 949 /*
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index fb00ab7b7612..eba7f53f8b4a 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -898,12 +898,6 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
898 unsigned long start_eip; 898 unsigned long start_eip;
899 unsigned short nmi_high = 0, nmi_low = 0; 899 unsigned short nmi_high = 0, nmi_low = 0;
900 900
901 if (!cpu_gdt_descr[cpu].address &&
902 !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
903 printk("Failed to allocate GDT for CPU %d\n", cpu);
904 return 1;
905 }
906
907 ++cpucount; 901 ++cpucount;
908 902
909 /* 903 /*
diff --git a/arch/i386/mach-default/topology.c b/arch/i386/kernel/topology.c
index b64314069e78..67a0e1baa28b 100644
--- a/arch/i386/mach-default/topology.c
+++ b/arch/i386/kernel/topology.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * arch/i386/mach-generic/topology.c - Populate driverfs with topology information 2 * arch/i386/kernel/topology.c - Populate driverfs with topology information
3 * 3 *
4 * Written by: Matthew Dobson, IBM Corporation 4 * Written by: Matthew Dobson, IBM Corporation
5 * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL 5 * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
6 * 6 *
7 * Copyright (C) 2002, IBM Corp. 7 * Copyright (C) 2002, IBM Corp.
8 * 8 *
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ static struct i386_cpu cpu_devices[NR_CPUS];
34 34
35int arch_register_cpu(int num){ 35int arch_register_cpu(int num){
36 struct node *parent = NULL; 36 struct node *parent = NULL;
37 37
38#ifdef CONFIG_NUMA 38#ifdef CONFIG_NUMA
39 int node = cpu_to_node(num); 39 int node = cpu_to_node(num);
40 if (node_online(node)) 40 if (node_online(node))
diff --git a/arch/i386/mach-default/Makefile b/arch/i386/mach-default/Makefile
index e95bb0237921..012fe34459e6 100644
--- a/arch/i386/mach-default/Makefile
+++ b/arch/i386/mach-default/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := setup.o topology.o 5obj-y := setup.o
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c
index aa49a33a572c..b584060ec004 100644
--- a/arch/i386/mach-voyager/voyager_basic.c
+++ b/arch/i386/mach-voyager/voyager_basic.c
@@ -23,6 +23,8 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25#include <linux/sysrq.h> 25#include <linux/sysrq.h>
26#include <linux/smp.h>
27#include <linux/nodemask.h>
26#include <asm/io.h> 28#include <asm/io.h>
27#include <asm/voyager.h> 29#include <asm/voyager.h>
28#include <asm/vic.h> 30#include <asm/vic.h>
@@ -328,4 +330,3 @@ void machine_power_off(void)
328 if (pm_power_off) 330 if (pm_power_off)
329 pm_power_off(); 331 pm_power_off();
330} 332}
331
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 6e4c3baef6cc..8165626a5c30 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -402,6 +402,7 @@ find_smp_config(void)
402 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; 402 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
403 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16; 403 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 2) << 16;
404 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24; 404 cpus_addr(phys_cpu_present_map)[0] |= voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 3) << 24;
405 cpu_possible_map = phys_cpu_present_map;
405 printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]); 406 printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", cpus_addr(phys_cpu_present_map)[0]);
406 /* Here we set up the VIC to enable SMP */ 407 /* Here we set up the VIC to enable SMP */
407 /* enable the CPIs by writing the base vector to their register */ 408 /* enable the CPIs by writing the base vector to their register */
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 845cd0902a50..a85ea9d37f05 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -453,6 +453,7 @@ source "arch/ia64/oprofile/Kconfig"
453 453
454config KPROBES 454config KPROBES
455 bool "Kprobes (EXPERIMENTAL)" 455 bool "Kprobes (EXPERIMENTAL)"
456 depends on EXPERIMENTAL && MODULES
456 help 457 help
457 Kprobes allows you to trap at almost any kernel address and 458 Kprobes allows you to trap at almost any kernel address and
458 execute a callback function. register_kprobe() establishes 459 execute a callback function. register_kprobe() establishes
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 983d438b14b6..4b3c90ba926c 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -12,14 +12,14 @@ CFLAGS_MODULE += -mmodel=large
12 12
13ifdef CONFIG_CHIP_VDEC2 13ifdef CONFIG_CHIP_VDEC2
14cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 14cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst
15aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 15aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -O2 -Wa,-bitinst -Wa,-no-parallel
16else 16else
17cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 17cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2
18aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 18aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 -O2
19endif 19endif
20 20
21cflags-$(CONFIG_ISA_M32R) += -DNO_FPU 21cflags-$(CONFIG_ISA_M32R) += -DNO_FPU
22aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst 22aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst
23 23
24CFLAGS += $(cflags-y) 24CFLAGS += $(cflags-y)
25AFLAGS += $(aflags-y) 25AFLAGS += $(aflags-y)
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 71763f7a1d19..cb33097fefc4 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -36,7 +36,7 @@ int do_signal(struct pt_regs *, sigset_t *);
36asmlinkage int 36asmlinkage int
37sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, 37sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
38 unsigned long r2, unsigned long r3, unsigned long r4, 38 unsigned long r2, unsigned long r3, unsigned long r4,
39 unsigned long r5, unsigned long r6, struct pt_regs regs) 39 unsigned long r5, unsigned long r6, struct pt_regs *regs)
40{ 40{
41 sigset_t saveset, newset; 41 sigset_t saveset, newset;
42 42
@@ -54,21 +54,21 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
54 recalc_sigpending(); 54 recalc_sigpending();
55 spin_unlock_irq(&current->sighand->siglock); 55 spin_unlock_irq(&current->sighand->siglock);
56 56
57 regs.r0 = -EINTR; 57 regs->r0 = -EINTR;
58 while (1) { 58 while (1) {
59 current->state = TASK_INTERRUPTIBLE; 59 current->state = TASK_INTERRUPTIBLE;
60 schedule(); 60 schedule();
61 if (do_signal(&regs, &saveset)) 61 if (do_signal(regs, &saveset))
62 return regs.r0; 62 return regs->r0;
63 } 63 }
64} 64}
65 65
66asmlinkage int 66asmlinkage int
67sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 67sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
68 unsigned long r2, unsigned long r3, unsigned long r4, 68 unsigned long r2, unsigned long r3, unsigned long r4,
69 unsigned long r5, unsigned long r6, struct pt_regs regs) 69 unsigned long r5, unsigned long r6, struct pt_regs *regs)
70{ 70{
71 return do_sigaltstack(uss, uoss, regs.spu); 71 return do_sigaltstack(uss, uoss, regs->spu);
72} 72}
73 73
74 74
@@ -140,11 +140,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
140asmlinkage int 140asmlinkage int
141sys_rt_sigreturn(unsigned long r0, unsigned long r1, 141sys_rt_sigreturn(unsigned long r0, unsigned long r1,
142 unsigned long r2, unsigned long r3, unsigned long r4, 142 unsigned long r2, unsigned long r3, unsigned long r4,
143 unsigned long r5, unsigned long r6, struct pt_regs regs) 143 unsigned long r5, unsigned long r6, struct pt_regs *regs)
144{ 144{
145 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu; 145 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->spu;
146 sigset_t set; 146 sigset_t set;
147 stack_t st;
148 int result; 147 int result;
149 148
150 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 149 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -158,14 +157,11 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
158 recalc_sigpending(); 157 recalc_sigpending();
159 spin_unlock_irq(&current->sighand->siglock); 158 spin_unlock_irq(&current->sighand->siglock);
160 159
161 if (restore_sigcontext(&regs, &frame->uc.uc_mcontext, &result)) 160 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result))
162 goto badframe; 161 goto badframe;
163 162
164 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) 163 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->spu) == -EFAULT)
165 goto badframe; 164 goto badframe;
166 /* It is more difficult to avoid calling this function than to
167 call it and ignore errors. */
168 do_sigaltstack(&st, NULL, regs.spu);
169 165
170 return result; 166 return result;
171 167
diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c
index ce16bbe26a52..2d1dd2106c4d 100644
--- a/arch/m32r/lib/usercopy.c
+++ b/arch/m32r/lib/usercopy.c
@@ -64,7 +64,7 @@ do { \
64 " .balign 4\n" \ 64 " .balign 4\n" \
65 " .long 0b,3b\n" \ 65 " .long 0b,3b\n" \
66 ".previous" \ 66 ".previous" \
67 : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ 67 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
68 "=&r" (__d2) \ 68 "=&r" (__d2) \
69 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ 69 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
70 "4"(dst) \ 70 "4"(dst) \
@@ -101,7 +101,7 @@ do { \
101 " .balign 4\n" \ 101 " .balign 4\n" \
102 " .long 0b,3b\n" \ 102 " .long 0b,3b\n" \
103 ".previous" \ 103 ".previous" \
104 : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ 104 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
105 "=&r" (__d2) \ 105 "=&r" (__d2) \
106 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ 106 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
107 "4"(dst) \ 107 "4"(dst) \
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 5f68b220c26d..e00e5f6e7fdd 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -161,60 +161,6 @@ out:
161 return error; 161 return error;
162} 162}
163 163
164struct dirent32 {
165 unsigned int d_ino;
166 unsigned int d_off;
167 unsigned short d_reclen;
168 char d_name[NAME_MAX + 1];
169};
170
171static void
172xlate_dirent(void *dirent64, void *dirent32, long n)
173{
174 long off;
175 struct dirent *dirp;
176 struct dirent32 *dirp32;
177
178 off = 0;
179 while (off < n) {
180 dirp = (struct dirent *)(dirent64 + off);
181 dirp32 = (struct dirent32 *)(dirent32 + off);
182 off += dirp->d_reclen;
183 dirp32->d_ino = dirp->d_ino;
184 dirp32->d_off = (unsigned int)dirp->d_off;
185 dirp32->d_reclen = dirp->d_reclen;
186 strncpy(dirp32->d_name, dirp->d_name, dirp->d_reclen - ((3 * 4) + 2));
187 }
188 return;
189}
190
191asmlinkage long
192sys32_getdents(unsigned int fd, void * dirent32, unsigned int count)
193{
194 long n;
195 void *dirent64;
196
197 dirent64 = (void *)((unsigned long)(dirent32 + (sizeof(long) - 1)) & ~(sizeof(long) - 1));
198 if ((n = sys_getdents(fd, dirent64, count - (dirent64 - dirent32))) < 0)
199 return(n);
200 xlate_dirent(dirent64, dirent32, n);
201 return(n);
202}
203
204asmlinkage int old_readdir(unsigned int fd, void * dirent, unsigned int count);
205
206asmlinkage int
207sys32_readdir(unsigned int fd, void * dirent32, unsigned int count)
208{
209 int n;
210 struct dirent dirent64;
211
212 if ((n = old_readdir(fd, &dirent64, count)) < 0)
213 return(n);
214 xlate_dirent(&dirent64, dirent32, dirent64.d_reclen);
215 return(n);
216}
217
218asmlinkage int 164asmlinkage int
219sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) 165sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
220{ 166{
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d83e033dbc87..2f2dc54b2e26 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -626,7 +626,7 @@ einval: li v0, -EINVAL
626 sys sys_fstatat64 4 626 sys sys_fstatat64 4
627 sys sys_unlinkat 3 627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */ 628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4 629 sys sys_linkat 5
630 sys sys_symlinkat 3 630 sys sys_symlinkat 3
631 sys sys_readlinkat 4 631 sys sys_readlinkat 4
632 sys sys_fchmodat 3 632 sys sys_fchmodat 3
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index d87b5446fa13..02c8267e45e7 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -195,7 +195,7 @@ EXPORT(sysn32_call_table)
195 PTR sys_fdatasync 195 PTR sys_fdatasync
196 PTR sys_truncate 196 PTR sys_truncate
197 PTR sys_ftruncate /* 6075 */ 197 PTR sys_ftruncate /* 6075 */
198 PTR sys32_getdents 198 PTR compat_sys_getdents
199 PTR sys_getcwd 199 PTR sys_getcwd
200 PTR sys_chdir 200 PTR sys_chdir
201 PTR sys_fchdir 201 PTR sys_fchdir
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 5b0414018c9a..797e0d874889 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -293,7 +293,7 @@ sys_call_table:
293 PTR sys_uselib 293 PTR sys_uselib
294 PTR sys_swapon 294 PTR sys_swapon
295 PTR sys_reboot 295 PTR sys_reboot
296 PTR sys32_readdir 296 PTR compat_sys_old_readdir
297 PTR old_mmap /* 4090 */ 297 PTR old_mmap /* 4090 */
298 PTR sys_munmap 298 PTR sys_munmap
299 PTR sys_truncate 299 PTR sys_truncate
@@ -345,7 +345,7 @@ sys_call_table:
345 PTR sys_setfsuid 345 PTR sys_setfsuid
346 PTR sys_setfsgid 346 PTR sys_setfsgid
347 PTR sys32_llseek /* 4140 */ 347 PTR sys32_llseek /* 4140 */
348 PTR sys32_getdents 348 PTR compat_sys_getdents
349 PTR compat_sys_select 349 PTR compat_sys_select
350 PTR sys_flock 350 PTR sys_flock
351 PTR sys_msync 351 PTR sys_msync
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index d86affa21278..d9293c558e41 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -540,6 +540,9 @@ void __init setup_arch(char **cmdline_p)
540 sparse_init(); 540 sparse_init();
541 paging_init(); 541 paging_init();
542 resource_init(); 542 resource_init();
543#ifdef CONFIG_SMP
544 plat_smp_setup();
545#endif
543} 546}
544 547
545int __init fpu_disable(char *s) 548int __init fpu_disable(char *s)
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 5e189862e523..06ed90752424 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -236,7 +236,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
236 init_new_context(current, &init_mm); 236 init_new_context(current, &init_mm);
237 current_thread_info()->cpu = 0; 237 current_thread_info()->cpu = 0;
238 smp_tune_scheduling(); 238 smp_tune_scheduling();
239 prom_prepare_cpus(max_cpus); 239 plat_prepare_cpus(max_cpus);
240} 240}
241 241
242/* preload SMP state for boot cpu */ 242/* preload SMP state for boot cpu */
diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp_mt.c
index c930364830d0..993b8bf56aaf 100644
--- a/arch/mips/kernel/smp_mt.c
+++ b/arch/mips/kernel/smp_mt.c
@@ -143,7 +143,7 @@ static struct irqaction irq_call = {
143 * Make sure all CPU's are in a sensible state before we boot any of the 143 * Make sure all CPU's are in a sensible state before we boot any of the
144 * secondarys 144 * secondarys
145 */ 145 */
146void prom_prepare_cpus(unsigned int max_cpus) 146void plat_smp_setup(void)
147{ 147{
148 unsigned long val; 148 unsigned long val;
149 int i, num; 149 int i, num;
@@ -179,11 +179,9 @@ void prom_prepare_cpus(unsigned int max_cpus)
179 write_vpe_c0_vpeconf0(tmp); 179 write_vpe_c0_vpeconf0(tmp);
180 180
181 /* Record this as available CPU */ 181 /* Record this as available CPU */
182 if (i < max_cpus) { 182 cpu_set(i, phys_cpu_present_map);
183 cpu_set(i, phys_cpu_present_map); 183 __cpu_number_map[i] = ++num;
184 __cpu_number_map[i] = ++num; 184 __cpu_logical_map[num] = i;
185 __cpu_logical_map[num] = i;
186 }
187 } 185 }
188 186
189 /* disable multi-threading with TC's */ 187 /* disable multi-threading with TC's */
@@ -241,7 +239,10 @@ void prom_prepare_cpus(unsigned int max_cpus)
241 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); 239 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch);
242 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); 240 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch);
243 } 241 }
242}
244 243
244void __init plat_prepare_cpus(unsigned int max_cpus)
245{
245 cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ; 246 cpu_ipi_resched_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_RESCHED_IRQ;
246 cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ; 247 cpu_ipi_call_irq = MIPSCPU_INT_BASE + MIPS_CPU_IPI_CALL_IRQ;
247 248
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index 7f8fda962190..c197311e15d3 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -50,37 +50,25 @@ void __init prom_grab_secondary(void)
50 * We don't want to start the secondary CPU yet nor do we have a nice probing 50 * We don't want to start the secondary CPU yet nor do we have a nice probing
51 * feature in PMON so we just assume presence of the secondary core. 51 * feature in PMON so we just assume presence of the secondary core.
52 */ 52 */
53static char maxcpus_string[] __initdata = 53void __init plat_smp_setup(void)
54 KERN_WARNING "max_cpus set to 0; using 1 instead\n";
55
56void __init prom_prepare_cpus(unsigned int max_cpus)
57{ 54{
58 int enabled = 0, i; 55 int i;
59
60 if (max_cpus == 0) {
61 printk(maxcpus_string);
62 max_cpus = 1;
63 }
64 56
65 cpus_clear(phys_cpu_present_map); 57 cpus_clear(phys_cpu_present_map);
66 58
67 for (i = 0; i < 2; i++) { 59 for (i = 0; i < 2; i++) {
68 if (i == max_cpus)
69 break;
70
71 /*
72 * The boot CPU
73 */
74 cpu_set(i, phys_cpu_present_map); 60 cpu_set(i, phys_cpu_present_map);
75 __cpu_number_map[i] = i; 61 __cpu_number_map[i] = i;
76 __cpu_logical_map[i] = i; 62 __cpu_logical_map[i] = i;
77 enabled++;
78 } 63 }
64}
79 65
66void __init plat_prepare_cpus(unsigned int max_cpus)
67{
80 /* 68 /*
81 * Be paranoid. Enable the IPI only if we're really about to go SMP. 69 * Be paranoid. Enable the IPI only if we're really about to go SMP.
82 */ 70 */
83 if (enabled > 1) 71 if (cpus_weight(cpu_possible_map))
84 set_c0_status(STATUSF_IP5); 72 set_c0_status(STATUSF_IP5);
85} 73}
86 74
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index dbef3f6b5650..09fa7f5216f0 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -140,7 +140,7 @@ static __init void intr_clear_all(nasid_t nasid)
140 REMOTE_HUB_CLR_INTR(nasid, i); 140 REMOTE_HUB_CLR_INTR(nasid, i);
141} 141}
142 142
143void __init prom_prepare_cpus(unsigned int max_cpus) 143void __init plat_smp_setup(void)
144{ 144{
145 cnodeid_t cnode; 145 cnodeid_t cnode;
146 146
@@ -161,6 +161,11 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
161 alloc_cpupda(0, 0); 161 alloc_cpupda(0, 0);
162} 162}
163 163
164void __init plat_prepare_cpus(unsigned int max_cpus)
165{
166 /* We already did everything necessary earlier */
167}
168
164/* 169/*
165 * Launch a slave into smp_bootstrap(). It doesn't take an argument, and we 170 * Launch a slave into smp_bootstrap(). It doesn't take an argument, and we
166 * set sp to the kernel stack of the newly created idle process, gp to the proc 171 * set sp to the kernel stack of the newly created idle process, gp to the proc
diff --git a/arch/mips/sibyte/cfe/smp.c b/arch/mips/sibyte/cfe/smp.c
index 4477af3d8074..eab20e2db323 100644
--- a/arch/mips/sibyte/cfe/smp.c
+++ b/arch/mips/sibyte/cfe/smp.c
@@ -31,7 +31,7 @@
31 * 31 *
32 * Common setup before any secondaries are started 32 * Common setup before any secondaries are started
33 */ 33 */
34void __init prom_prepare_cpus(unsigned int max_cpus) 34void __init plat_smp_setup(void)
35{ 35{
36 int i, num; 36 int i, num;
37 37
@@ -40,14 +40,18 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
40 __cpu_number_map[0] = 0; 40 __cpu_number_map[0] = 0;
41 __cpu_logical_map[0] = 0; 41 __cpu_logical_map[0] = 0;
42 42
43 for (i=1, num=0; i<NR_CPUS; i++) { 43 for (i = 1, num = 0; i < NR_CPUS; i++) {
44 if (cfe_cpu_stop(i) == 0) { 44 if (cfe_cpu_stop(i) == 0) {
45 cpu_set(i, phys_cpu_present_map); 45 cpu_set(i, phys_cpu_present_map);
46 __cpu_number_map[i] = ++num; 46 __cpu_number_map[i] = ++num;
47 __cpu_logical_map[num] = i; 47 __cpu_logical_map[num] = i;
48 } 48 }
49 } 49 }
50 printk("Detected %i available secondary CPU(s)\n", num); 50 printk(KERN_INFO "Detected %i available secondary CPU(s)\n", num);
51}
52
53void __init plat_prepare_cpus(unsigned int max_cpus)
54{
51} 55}
52 56
53/* 57/*
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d112aed2999b..fec07a12c6cd 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -989,7 +989,7 @@ source "arch/powerpc/oprofile/Kconfig"
989 989
990config KPROBES 990config KPROBES
991 bool "Kprobes (EXPERIMENTAL)" 991 bool "Kprobes (EXPERIMENTAL)"
992 depends on PPC64 992 depends on PPC64 && EXPERIMENTAL && MODULES
993 help 993 help
994 Kprobes allows you to trap at almost any kernel address and 994 Kprobes allows you to trap at almost any kernel address and
995 execute a callback function. register_kprobe() establishes 995 execute a callback function. register_kprobe() establishes
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 82d117c60d7f..d63cd562d9d5 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void)
816{ 816{
817 unsigned long start, mem, size; 817 unsigned long start, mem, size;
818 struct device_node **allnextp = &allnodes; 818 struct device_node **allnextp = &allnodes;
819 char *p = NULL;
820 int l = 0;
821 819
822 DBG(" -> unflatten_device_tree()\n"); 820 DBG(" -> unflatten_device_tree()\n");
823 821
@@ -853,19 +851,6 @@ void __init unflatten_device_tree(void)
853 if (of_chosen == NULL) 851 if (of_chosen == NULL)
854 of_chosen = of_find_node_by_path("/chosen@0"); 852 of_chosen = of_find_node_by_path("/chosen@0");
855 853
856 /* Retreive command line */
857 if (of_chosen != NULL) {
858 p = (char *)get_property(of_chosen, "bootargs", &l);
859 if (p != NULL && l > 0)
860 strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE));
861 }
862#ifdef CONFIG_CMDLINE
863 if (l == 0 || (l == 1 && (*p) == 0))
864 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
865#endif /* CONFIG_CMDLINE */
866
867 DBG("Command line is: %s\n", cmd_line);
868
869 DBG(" <- unflatten_device_tree()\n"); 854 DBG(" <- unflatten_device_tree()\n");
870} 855}
871 856
@@ -936,6 +921,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
936{ 921{
937 u32 *prop; 922 u32 *prop;
938 unsigned long *lprop; 923 unsigned long *lprop;
924 unsigned long l;
925 char *p;
939 926
940 DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); 927 DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
941 928
@@ -1000,6 +987,41 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1000 crashk_res.end = crashk_res.start + *lprop - 1; 987 crashk_res.end = crashk_res.start + *lprop - 1;
1001#endif 988#endif
1002 989
990 /* Retreive command line */
991 p = of_get_flat_dt_prop(node, "bootargs", &l);
992 if (p != NULL && l > 0)
993 strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
994
995#ifdef CONFIG_CMDLINE
996 if (l == 0 || (l == 1 && (*p) == 0))
997 strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
998#endif /* CONFIG_CMDLINE */
999
1000 DBG("Command line is: %s\n", cmd_line);
1001
1002 if (strstr(cmd_line, "mem=")) {
1003 char *p, *q;
1004 unsigned long maxmem = 0;
1005
1006 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
1007 q = p + 4;
1008 if (p > cmd_line && p[-1] != ' ')
1009 continue;
1010 maxmem = simple_strtoul(q, &q, 0);
1011 if (*q == 'k' || *q == 'K') {
1012 maxmem <<= 10;
1013 ++q;
1014 } else if (*q == 'm' || *q == 'M') {
1015 maxmem <<= 20;
1016 ++q;
1017 } else if (*q == 'g' || *q == 'G') {
1018 maxmem <<= 30;
1019 ++q;
1020 }
1021 }
1022 memory_limit = maxmem;
1023 }
1024
1003 /* break now */ 1025 /* break now */
1004 return 1; 1026 return 1;
1005} 1027}
@@ -1120,7 +1142,7 @@ static void __init early_reserve_mem(void)
1120 size_32 = *(reserve_map_32++); 1142 size_32 = *(reserve_map_32++);
1121 if (size_32 == 0) 1143 if (size_32 == 0)
1122 break; 1144 break;
1123 DBG("reserving: %lx -> %lx\n", base_32, size_32); 1145 DBG("reserving: %x -> %x\n", base_32, size_32);
1124 lmb_reserve(base_32, size_32); 1146 lmb_reserve(base_32, size_32);
1125 } 1147 }
1126 return; 1148 return;
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index ccaeda5136d1..4ee871f1cadb 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -225,9 +225,9 @@ V_FUNCTION_BEGIN(__do_get_xsec)
225 .cfi_startproc 225 .cfi_startproc
226 /* check for update count & load values */ 226 /* check for update count & load values */
2271: ld r8,CFG_TB_UPDATE_COUNT(r3) 2271: ld r8,CFG_TB_UPDATE_COUNT(r3)
228 andi. r0,r4,1 /* pending update ? loop */ 228 andi. r0,r8,1 /* pending update ? loop */
229 bne- 1b 229 bne- 1b
230 xor r0,r4,r4 /* create dependency */ 230 xor r0,r8,r8 /* create dependency */
231 add r3,r3,r0 231 add r3,r3,r0
232 232
233 /* Get TB & offset it */ 233 /* Get TB & offset it */
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index ae2c919cbecd..7d9ce9a48219 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -169,7 +169,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
169#ifdef CONFIG_PPC_ISERIES 169#ifdef CONFIG_PPC_ISERIES
170 if (_machine == PLATFORM_ISERIES_LPAR) 170 if (_machine == PLATFORM_ISERIES_LPAR)
171 ret = iSeries_hpte_insert(hpteg, va, 171 ret = iSeries_hpte_insert(hpteg, va,
172 virt_to_abs(paddr), 172 __pa(vaddr),
173 tmp_mode, 173 tmp_mode,
174 HPTE_V_BOLTED, 174 HPTE_V_BOLTED,
175 psize); 175 psize);
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 83578313ee7e..2ab9dcdfb415 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -893,6 +893,20 @@ void eeh_add_device_tree_early(struct device_node *dn)
893} 893}
894EXPORT_SYMBOL_GPL(eeh_add_device_tree_early); 894EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
895 895
896void eeh_add_device_tree_late(struct pci_bus *bus)
897{
898 struct pci_dev *dev;
899
900 list_for_each_entry(dev, &bus->devices, bus_list) {
901 eeh_add_device_late(dev);
902 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
903 struct pci_bus *subbus = dev->subordinate;
904 if (subbus)
905 eeh_add_device_tree_late(subbus);
906 }
907 }
908}
909
896/** 910/**
897 * eeh_add_device_late - perform EEH initialization for the indicated pci device 911 * eeh_add_device_late - perform EEH initialization for the indicated pci device
898 * @dev: pci device for which to set up EEH 912 * @dev: pci device for which to set up EEH
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index e3cbba49fd6e..b811d5ff92fe 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -37,7 +37,7 @@
37 37
38static inline const char * pcid_name (struct pci_dev *pdev) 38static inline const char * pcid_name (struct pci_dev *pdev)
39{ 39{
40 if (pdev->dev.driver) 40 if (pdev && pdev->dev.driver)
41 return pdev->dev.driver->name; 41 return pdev->dev.driver->name;
42 return ""; 42 return "";
43} 43}
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index bdaa8aabdaa6..f3bad900bbcf 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -106,6 +106,8 @@ pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
106 } 106 }
107 } 107 }
108 } 108 }
109
110 eeh_add_device_tree_late(bus);
109} 111}
110EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices); 112EXPORT_SYMBOL_GPL(pcibios_fixup_new_pci_devices);
111 113
@@ -114,7 +116,6 @@ pcibios_pci_config_bridge(struct pci_dev *dev)
114{ 116{
115 u8 sec_busno; 117 u8 sec_busno;
116 struct pci_bus *child_bus; 118 struct pci_bus *child_bus;
117 struct pci_dev *child_dev;
118 119
119 /* Get busno of downstream bus */ 120 /* Get busno of downstream bus */
120 pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); 121 pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno);
@@ -129,10 +130,6 @@ pcibios_pci_config_bridge(struct pci_dev *dev)
129 130
130 pci_scan_child_bus(child_bus); 131 pci_scan_child_bus(child_bus);
131 132
132 list_for_each_entry(child_dev, &child_bus->devices, bus_list) {
133 eeh_add_device_late(child_dev);
134 }
135
136 /* Fixup new pci devices without touching bus struct */ 133 /* Fixup new pci devices without touching bus struct */
137 pcibios_fixup_new_pci_devices(child_bus, 0); 134 pcibios_fixup_new_pci_devices(child_bus, 0);
138 135
@@ -160,18 +157,25 @@ pcibios_add_pci_devices(struct pci_bus * bus)
160 157
161 eeh_add_device_tree_early(dn); 158 eeh_add_device_tree_early(dn);
162 159
163 /* pci_scan_slot should find all children */ 160 if (_machine == PLATFORM_PSERIES_LPAR) {
164 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); 161 /* use ofdt-based probe */
165 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 162 of_scan_bus(dn, bus);
166 if (num) { 163 if (!list_empty(&bus->devices)) {
167 pcibios_fixup_new_pci_devices(bus, 1); 164 pcibios_fixup_new_pci_devices(bus, 0);
168 pci_bus_add_devices(bus); 165 pci_bus_add_devices(bus);
169 } 166 }
167 } else {
168 /* use legacy probe */
169 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
170 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
171 if (num) {
172 pcibios_fixup_new_pci_devices(bus, 1);
173 pci_bus_add_devices(bus);
174 }
170 175
171 list_for_each_entry(dev, &bus->devices, bus_list) { 176 list_for_each_entry(dev, &bus->devices, bus_list)
172 eeh_add_device_late (dev); 177 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
173 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) 178 pcibios_pci_config_bridge(dev);
174 pcibios_pci_config_bridge(dev);
175 } 179 }
176} 180}
177EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); 181EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 615964cca15f..50e80138e7ad 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1552,6 +1552,7 @@ sys_linkat_wrapper:
1552 llgtr %r3,%r3 # const char * 1552 llgtr %r3,%r3 # const char *
1553 lgfr %r4,%r4 # int 1553 lgfr %r4,%r4 # int
1554 llgtr %r5,%r5 # const char * 1554 llgtr %r5,%r5 # const char *
1555 lgfr %r6,%r6 # int
1555 jg sys_linkat 1556 jg sys_linkat
1556 1557
1557 .globl sys_symlinkat_wrapper 1558 .globl sys_symlinkat_wrapper
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index ab733be9af08..4c0a50a76554 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -383,6 +383,7 @@ source "arch/sparc64/oprofile/Kconfig"
383 383
384config KPROBES 384config KPROBES
385 bool "Kprobes (EXPERIMENTAL)" 385 bool "Kprobes (EXPERIMENTAL)"
386 depends on EXPERIMENTAL && MODULES
386 help 387 help
387 Kprobes allows you to trap at almost any kernel address and 388 Kprobes allows you to trap at almost any kernel address and
388 execute a callback function. register_kprobe() establishes 389 execute a callback function. register_kprobe() establishes
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 054461e6946d..158bd31e15b7 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -542,6 +542,8 @@ void __init setup_arch(char **cmdline_p)
542 } 542 }
543#endif 543#endif
544 544
545 smp_setup_cpu_possible_map();
546
545 paging_init(); 547 paging_init();
546} 548}
547 549
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 1fb6323e65a4..1f7ad8a69052 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -1079,18 +1079,12 @@ int setup_profiling_timer(unsigned int multiplier)
1079 return 0; 1079 return 0;
1080} 1080}
1081 1081
1082/* Constrain the number of cpus to max_cpus. */
1082void __init smp_prepare_cpus(unsigned int max_cpus) 1083void __init smp_prepare_cpus(unsigned int max_cpus)
1083{ 1084{
1084 int instance, mid;
1085
1086 instance = 0;
1087 while (!cpu_find_by_instance(instance, NULL, &mid)) {
1088 if (mid < max_cpus)
1089 cpu_set(mid, phys_cpu_present_map);
1090 instance++;
1091 }
1092
1093 if (num_possible_cpus() > max_cpus) { 1085 if (num_possible_cpus() > max_cpus) {
1086 int instance, mid;
1087
1094 instance = 0; 1088 instance = 0;
1095 while (!cpu_find_by_instance(instance, NULL, &mid)) { 1089 while (!cpu_find_by_instance(instance, NULL, &mid)) {
1096 if (mid != boot_cpu_id) { 1090 if (mid != boot_cpu_id) {
@@ -1105,6 +1099,22 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
1105 smp_store_cpu_info(boot_cpu_id); 1099 smp_store_cpu_info(boot_cpu_id);
1106} 1100}
1107 1101
1102/* Set this up early so that things like the scheduler can init
1103 * properly. We use the same cpu mask for both the present and
1104 * possible cpu map.
1105 */
1106void __init smp_setup_cpu_possible_map(void)
1107{
1108 int instance, mid;
1109
1110 instance = 0;
1111 while (!cpu_find_by_instance(instance, NULL, &mid)) {
1112 if (mid < NR_CPUS)
1113 cpu_set(mid, phys_cpu_present_map);
1114 instance++;
1115 }
1116}
1117
1108void __devinit smp_prepare_boot_cpu(void) 1118void __devinit smp_prepare_boot_cpu(void)
1109{ 1119{
1110 if (hard_smp_processor_id() >= NR_CPUS) { 1120 if (hard_smp_processor_id() >= NR_CPUS) {
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index dc36b222100b..04e3958266e0 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -46,7 +46,7 @@ extern int file_reader(__u64 offset, char *buf, int len, void *arg);
46extern int read_cow_header(int (*reader)(__u64, char *, int, void *), 46extern int read_cow_header(int (*reader)(__u64, char *, int, void *),
47 void *arg, __u32 *version_out, 47 void *arg, __u32 *version_out,
48 char **backing_file_out, time_t *mtime_out, 48 char **backing_file_out, time_t *mtime_out,
49 unsigned long long *size_out, int *sectorsize_out, 49 __u64 *size_out, int *sectorsize_out,
50 __u32 *align_out, int *bitmap_offset_out); 50 __u32 *align_out, int *bitmap_offset_out);
51 51
52extern int write_cow_header(char *cow_file, int fd, char *backing_file, 52extern int write_cow_header(char *cow_file, int fd, char *backing_file,
diff --git a/arch/um/drivers/cow_sys.h b/arch/um/drivers/cow_sys.h
index c83fc5d68936..94de4ead4f7a 100644
--- a/arch/um/drivers/cow_sys.h
+++ b/arch/um/drivers/cow_sys.h
@@ -23,17 +23,17 @@ static inline char *cow_strdup(char *str)
23 return(uml_strdup(str)); 23 return(uml_strdup(str));
24} 24}
25 25
26static inline int cow_seek_file(int fd, unsigned long long offset) 26static inline int cow_seek_file(int fd, __u64 offset)
27{ 27{
28 return(os_seek_file(fd, offset)); 28 return(os_seek_file(fd, offset));
29} 29}
30 30
31static inline int cow_file_size(char *file, unsigned long long *size_out) 31static inline int cow_file_size(char *file, __u64 *size_out)
32{ 32{
33 return(os_file_size(file, size_out)); 33 return(os_file_size(file, size_out));
34} 34}
35 35
36static inline int cow_write_file(int fd, char *buf, int size) 36static inline int cow_write_file(int fd, void *buf, int size)
37{ 37{
38 return(os_write_file(fd, buf, size)); 38 return(os_write_file(fd, buf, size));
39} 39}
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index fbe2217db5dd..61951b721268 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -176,7 +176,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
176 err = -ENOMEM; 176 err = -ENOMEM;
177 header = cow_malloc(sizeof(*header)); 177 header = cow_malloc(sizeof(*header));
178 if(header == NULL){ 178 if(header == NULL){
179 cow_printf("Failed to allocate COW V3 header\n"); 179 cow_printf("write_cow_header - failed to allocate COW V3 header\n");
180 goto out; 180 goto out;
181 } 181 }
182 header->magic = htonl(COW_MAGIC); 182 header->magic = htonl(COW_MAGIC);
@@ -196,15 +196,17 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
196 196
197 err = os_file_modtime(header->backing_file, &modtime); 197 err = os_file_modtime(header->backing_file, &modtime);
198 if(err < 0){ 198 if(err < 0){
199 cow_printf("Backing file '%s' mtime request failed, " 199 cow_printf("write_cow_header - backing file '%s' mtime "
200 "err = %d\n", header->backing_file, -err); 200 "request failed, err = %d\n", header->backing_file,
201 -err);
201 goto out_free; 202 goto out_free;
202 } 203 }
203 204
204 err = cow_file_size(header->backing_file, size); 205 err = cow_file_size(header->backing_file, size);
205 if(err < 0){ 206 if(err < 0){
206 cow_printf("Couldn't get size of backing file '%s', " 207 cow_printf("write_cow_header - couldn't get size of "
207 "err = %d\n", header->backing_file, -err); 208 "backing file '%s', err = %d\n",
209 header->backing_file, -err);
208 goto out_free; 210 goto out_free;
209 } 211 }
210 212
@@ -214,10 +216,11 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
214 header->alignment = htonl(alignment); 216 header->alignment = htonl(alignment);
215 header->cow_format = COW_BITMAP; 217 header->cow_format = COW_BITMAP;
216 218
217 err = os_write_file(fd, header, sizeof(*header)); 219 err = cow_write_file(fd, header, sizeof(*header));
218 if(err != sizeof(*header)){ 220 if(err != sizeof(*header)){
219 cow_printf("Write of header to new COW file '%s' failed, " 221 cow_printf("write_cow_header - write of header to "
220 "err = %d\n", cow_file, -err); 222 "new COW file '%s' failed, err = %d\n", cow_file,
223 -err);
221 goto out_free; 224 goto out_free;
222 } 225 }
223 err = 0; 226 err = 0;
@@ -299,7 +302,7 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
299 } 302 }
300 else if(version == 3){ 303 else if(version == 3){
301 if(n < sizeof(header->v3)){ 304 if(n < sizeof(header->v3)){
302 cow_printf("read_cow_header - failed to read V2 " 305 cow_printf("read_cow_header - failed to read V3 "
303 "header\n"); 306 "header\n");
304 goto out; 307 goto out;
305 } 308 }
@@ -359,7 +362,8 @@ int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize,
359 if(err != sizeof(zero)){ 362 if(err != sizeof(zero)){
360 cow_printf("Write of bitmap to new COW file '%s' failed, " 363 cow_printf("Write of bitmap to new COW file '%s' failed, "
361 "err = %d\n", cow_file, -err); 364 "err = %d\n", cow_file, -err);
362 err = -EINVAL; 365 if (err >= 0)
366 err = -EINVAL;
363 goto out; 367 goto out;
364 } 368 }
365 369
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index 098fa65981ab..0e2f06187ea7 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -47,10 +47,12 @@ void tap_check_ips(char *gate_addr, unsigned char *eth_addr)
47 } 47 }
48} 48}
49 49
50/* Do reliable error handling as this fails frequently enough. */
50void read_output(int fd, char *output, int len) 51void read_output(int fd, char *output, int len)
51{ 52{
52 int remain, n, actual; 53 int remain, ret, expected;
53 char c; 54 char c;
55 char *str;
54 56
55 if(output == NULL){ 57 if(output == NULL){
56 output = &c; 58 output = &c;
@@ -58,23 +60,31 @@ void read_output(int fd, char *output, int len)
58 } 60 }
59 61
60 *output = '\0'; 62 *output = '\0';
61 n = os_read_file(fd, &remain, sizeof(remain)); 63 ret = os_read_file(fd, &remain, sizeof(remain));
62 if(n != sizeof(remain)){ 64
63 printk("read_output - read of length failed, err = %d\n", -n); 65 if (ret != sizeof(remain)) {
64 return; 66 expected = sizeof(remain);
67 str = "length";
68 goto err;
65 } 69 }
66 70
67 while(remain != 0){ 71 while(remain != 0){
68 n = (remain < len) ? remain : len; 72 expected = (remain < len) ? remain : len;
69 actual = os_read_file(fd, output, n); 73 ret = os_read_file(fd, output, expected);
70 if(actual != n){ 74 if (ret != expected) {
71 printk("read_output - read of data failed, " 75 str = "data";
72 "err = %d\n", -actual); 76 goto err;
73 return;
74 } 77 }
75 remain -= actual; 78 remain -= ret;
76 } 79 }
80
77 return; 81 return;
82
83err:
84 if (ret < 0)
85 printk("read_output - read of %s failed, errno = %d\n", str, -ret);
86 else
87 printk("read_output - read of %s failed, read only %d of %d bytes\n", str, ret, expected);
78} 88}
79 89
80int net_read(int fd, void *buf, int len) 90int net_read(int fd, void *buf, int len)
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 101efd26d467..fa617e0719ab 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1135,7 +1135,7 @@ static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow)
1135static int backing_file_mismatch(char *file, __u64 size, time_t mtime) 1135static int backing_file_mismatch(char *file, __u64 size, time_t mtime)
1136{ 1136{
1137 unsigned long modtime; 1137 unsigned long modtime;
1138 long long actual; 1138 unsigned long long actual;
1139 int err; 1139 int err;
1140 1140
1141 err = os_file_modtime(file, &modtime); 1141 err = os_file_modtime(file, &modtime);
diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index cbd79a8d213d..d4de7c0120ce 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -122,7 +122,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
122 122
123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn 123#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
124 124
125#define __init_call __attribute__ ((unused,__section__ (".initcall.init"))) 125#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
126 126
127#endif 127#endif
128 128
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index eb1710b81255..2a1c64d8d0bf 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -179,8 +179,11 @@ extern void os_stop_process(int pid);
179extern void os_kill_process(int pid, int reap_child); 179extern void os_kill_process(int pid, int reap_child);
180extern void os_kill_ptraced_process(int pid, int reap_child); 180extern void os_kill_ptraced_process(int pid, int reap_child);
181extern void os_usr1_process(int pid); 181extern void os_usr1_process(int pid);
182extern long os_ptrace_ldt(long pid, long addr, long data);
183
182extern int os_getpid(void); 184extern int os_getpid(void);
183extern int os_getpgrp(void); 185extern int os_getpgrp(void);
186
184extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); 187extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int));
185extern void init_new_thread_signals(int altstack); 188extern void init_new_thread_signals(int altstack);
186extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); 189extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index f55773c819e6..3bd10deea280 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -272,14 +272,23 @@ int os_connect_socket(char *name)
272 snprintf(sock.sun_path, sizeof(sock.sun_path), "%s", name); 272 snprintf(sock.sun_path, sizeof(sock.sun_path), "%s", name);
273 273
274 fd = socket(AF_UNIX, SOCK_STREAM, 0); 274 fd = socket(AF_UNIX, SOCK_STREAM, 0);
275 if(fd < 0) 275 if(fd < 0) {
276 return(fd); 276 err = -errno;
277 goto out;
278 }
277 279
278 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); 280 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock));
279 if(err) 281 if(err) {
280 return(-errno); 282 err = -errno;
283 goto out_close;
284 }
281 285
282 return(fd); 286 return fd;
287
288out_close:
289 close(fd);
290out:
291 return err;
283} 292}
284 293
285void os_close_file(int fd) 294void os_close_file(int fd)
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 7f5e2dac2a35..d261888f39c4 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -19,6 +19,7 @@
19#include "irq_user.h" 19#include "irq_user.h"
20#include "kern_util.h" 20#include "kern_util.h"
21#include "longjmp.h" 21#include "longjmp.h"
22#include "skas_ptrace.h"
22 23
23#define ARBITRARY_ADDR -1 24#define ARBITRARY_ADDR -1
24#define FAILURE_PID -1 25#define FAILURE_PID -1
@@ -100,6 +101,21 @@ void os_kill_process(int pid, int reap_child)
100 101
101} 102}
102 103
104/* This is here uniquely to have access to the userspace errno, i.e. the one
105 * used by ptrace in case of error.
106 */
107
108long os_ptrace_ldt(long pid, long addr, long data)
109{
110 int ret;
111
112 ret = ptrace(PTRACE_LDT, pid, addr, data);
113
114 if (ret < 0)
115 return -errno;
116 return ret;
117}
118
103/* Kill off a ptraced child by all means available. kill it normally first, 119/* Kill off a ptraced child by all means available. kill it normally first,
104 * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from 120 * then PTRACE_KILL it, then PTRACE_CONT it in case it's in a run state from
105 * which it can't exit directly. 121 * which it can't exit directly.
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 1fa09a79a10b..fe0877b3509c 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -107,7 +107,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
107 * So we need to switch child's mm into our userspace, then 107 * So we need to switch child's mm into our userspace, then
108 * later switch back. 108 * later switch back.
109 * 109 *
110 * Note: I'm unshure: should interrupts be disabled here? 110 * Note: I'm unsure: should interrupts be disabled here?
111 */ 111 */
112 if(!current->active_mm || current->active_mm == &init_mm || 112 if(!current->active_mm || current->active_mm == &init_mm ||
113 mm_idp != &current->active_mm->context.skas.id) 113 mm_idp != &current->active_mm->context.skas.id)
@@ -129,9 +129,7 @@ long write_ldt_entry(struct mm_id * mm_idp, int func, struct user_desc * desc,
129 pid = userspace_pid[cpu]; 129 pid = userspace_pid[cpu];
130 } 130 }
131 131
132 res = ptrace(PTRACE_LDT, pid, 0, (unsigned long) &ldt_op); 132 res = os_ptrace_ldt(pid, 0, (unsigned long) &ldt_op);
133 if(res)
134 res = errno;
135 133
136 if(proc_mm) 134 if(proc_mm)
137 put_cpu(); 135 put_cpu();
@@ -181,8 +179,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
181 */ 179 */
182 180
183 cpu = get_cpu(); 181 cpu = get_cpu();
184 res = ptrace(PTRACE_LDT, userspace_pid[cpu], 0, 182 res = os_ptrace_ldt(userspace_pid[cpu], 0, (unsigned long) &ptrace_ldt);
185 (unsigned long) &ptrace_ldt);
186 put_cpu(); 183 put_cpu();
187 if(res < 0) 184 if(res < 0)
188 goto out; 185 goto out;
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 2f9deca31cc9..e18eb79bf855 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -354,21 +354,6 @@ config HPET_TIMER
354 as it is off-chip. You can find the HPET spec at 354 as it is off-chip. You can find the HPET spec at
355 <http://www.intel.com/hardwaredesign/hpetspec.htm>. 355 <http://www.intel.com/hardwaredesign/hpetspec.htm>.
356 356
357config X86_PM_TIMER
358 bool "PM timer" if EMBEDDED
359 depends on ACPI
360 default y
361 help
362 Support the ACPI PM timer for time keeping. This is slow,
363 but is useful on some chipsets without HPET on systems with more
364 than one CPU. On a single processor or single socket multi core
365 system it is normally not required.
366 When the PM timer is active 64bit vsyscalls are disabled
367 and should not be enabled (/proc/sys/kernel/vsyscall64 should
368 not be changed).
369 The kernel selects the PM timer only as a last resort, so it is
370 useful to enable just in case.
371
372config HPET_EMULATE_RTC 357config HPET_EMULATE_RTC
373 bool "Provide RTC interrupt" 358 bool "Provide RTC interrupt"
374 depends on HPET_TIMER && RTC=y 359 depends on HPET_TIMER && RTC=y
@@ -592,6 +577,7 @@ source "arch/x86_64/oprofile/Kconfig"
592 577
593config KPROBES 578config KPROBES
594 bool "Kprobes (EXPERIMENTAL)" 579 bool "Kprobes (EXPERIMENTAL)"
580 depends on EXPERIMENTAL && MODULES
595 help 581 help
596 Kprobes allows you to trap at almost any kernel address and 582 Kprobes allows you to trap at almost any kernel address and
597 execute a callback function. register_kprobe() establishes 583 execute a callback function. register_kprobe() establishes
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 72fe60c20d39..a098a11e7755 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -43,7 +43,7 @@ CFLAGS_vsyscall.o := $(PROFILING) -g0
43 43
44bootflag-y += ../../i386/kernel/bootflag.o 44bootflag-y += ../../i386/kernel/bootflag.o
45cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o 45cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o
46topology-y += ../../i386/mach-default/topology.o 46topology-y += ../../i386/kernel/topology.o
47microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o 47microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
48intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o 48intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
49quirks-y += ../../i386/kernel/quirks.o 49quirks-y += ../../i386/kernel/quirks.o
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index e4e2b7d01f89..a0f955b9995f 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -248,7 +248,7 @@ void __init iommu_hole_init(void)
248 /* Got the aperture from the AGP bridge */ 248 /* Got the aperture from the AGP bridge */
249 } else if (swiotlb && !valid_agp) { 249 } else if (swiotlb && !valid_agp) {
250 /* Do nothing */ 250 /* Do nothing */
251 } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) || 251 } else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) ||
252 force_iommu || 252 force_iommu ||
253 valid_agp || 253 valid_agp ||
254 fallback_aper_force) { 254 fallback_aper_force) {
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 2585c1d92b26..ffed464e6b12 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -50,6 +50,8 @@ static int no_timer_check;
50 50
51int disable_timer_pin_1 __initdata; 51int disable_timer_pin_1 __initdata;
52 52
53int timer_over_8254 __initdata = 1;
54
53/* Where if anywhere is the i8259 connect in external int mode */ 55/* Where if anywhere is the i8259 connect in external int mode */
54static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; 56static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
55 57
@@ -251,6 +253,20 @@ static int __init enable_ioapic_setup(char *str)
251__setup("noapic", disable_ioapic_setup); 253__setup("noapic", disable_ioapic_setup);
252__setup("apic", enable_ioapic_setup); 254__setup("apic", enable_ioapic_setup);
253 255
256static int __init setup_disable_8254_timer(char *s)
257{
258 timer_over_8254 = -1;
259 return 1;
260}
261static int __init setup_enable_8254_timer(char *s)
262{
263 timer_over_8254 = 2;
264 return 1;
265}
266
267__setup("disable_8254_timer", setup_disable_8254_timer);
268__setup("enable_8254_timer", setup_enable_8254_timer);
269
254#include <asm/pci-direct.h> 270#include <asm/pci-direct.h>
255#include <linux/pci_ids.h> 271#include <linux/pci_ids.h>
256#include <linux/pci.h> 272#include <linux/pci.h>
@@ -309,27 +325,20 @@ void __init check_ioapic(void)
309#endif 325#endif
310 /* RED-PEN skip them on mptables too? */ 326 /* RED-PEN skip them on mptables too? */
311 return; 327 return;
328
329 /* This should be actually default, but
330 for 2.6.16 let's do it for ATI only where
331 it's really needed. */
312 case PCI_VENDOR_ID_ATI: 332 case PCI_VENDOR_ID_ATI:
313 if (apic_runs_main_timer != 0) 333 if (timer_over_8254 == 1) {
314 break; 334 timer_over_8254 = 0;
315#ifdef CONFIG_ACPI
316 /* Don't do this for laptops right
317 right now because their timer
318 doesn't necessarily tick in C2/3 */
319 if (acpi_fadt.revision >= 3 &&
320 (acpi_fadt.plvl2_lat + acpi_fadt.plvl3_lat) < 1100) {
321 printk(KERN_INFO
322"ATI board detected, but seems to be a laptop. Timer might be shakey, sorry\n");
323 break;
324 }
325#endif
326 printk(KERN_INFO 335 printk(KERN_INFO
327 "ATI board detected. Using APIC/PM timer.\n"); 336 "ATI board detected. Disabling timer routing over 8254.\n");
328 apic_runs_main_timer = 1; 337 }
329 nohpet = 1;
330 return; 338 return;
331 } 339 }
332 340
341
333 /* No multi-function device? */ 342 /* No multi-function device? */
334 type = read_pci_config_byte(num,slot,func, 343 type = read_pci_config_byte(num,slot,func,
335 PCI_HEADER_TYPE); 344 PCI_HEADER_TYPE);
@@ -1773,6 +1782,8 @@ static inline void unlock_ExtINT_logic(void)
1773 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 1782 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
1774 * is so screwy. Thanks to Brian Perkins for testing/hacking this beast 1783 * is so screwy. Thanks to Brian Perkins for testing/hacking this beast
1775 * fanatically on his truly buggy board. 1784 * fanatically on his truly buggy board.
1785 *
1786 * FIXME: really need to revamp this for modern platforms only.
1776 */ 1787 */
1777static inline void check_timer(void) 1788static inline void check_timer(void)
1778{ 1789{
@@ -1795,7 +1806,8 @@ static inline void check_timer(void)
1795 */ 1806 */
1796 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 1807 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
1797 init_8259A(1); 1808 init_8259A(1);
1798 enable_8259A_irq(0); 1809 if (timer_over_8254 > 0)
1810 enable_8259A_irq(0);
1799 1811
1800 pin1 = find_isa_irq_pin(0, mp_INT); 1812 pin1 = find_isa_irq_pin(0, mp_INT);
1801 apic1 = find_isa_irq_apic(0, mp_INT); 1813 apic1 = find_isa_irq_apic(0, mp_INT);
@@ -1850,7 +1862,7 @@ static inline void check_timer(void)
1850 } 1862 }
1851 printk(" failed.\n"); 1863 printk(" failed.\n");
1852 1864
1853 if (nmi_watchdog) { 1865 if (nmi_watchdog == NMI_IO_APIC) {
1854 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); 1866 printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
1855 nmi_watchdog = 0; 1867 nmi_watchdog = 0;
1856 } 1868 }
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index dd0718dc178b..0c3f052ba6ce 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -228,11 +228,6 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size
228 int mmu = high; 228 int mmu = high;
229 if (force_iommu) 229 if (force_iommu)
230 mmu = 1; 230 mmu = 1;
231 if (no_iommu) {
232 if (high)
233 panic("PCI-DMA: high address but no IOMMU.\n");
234 mmu = 0;
235 }
236 return mmu; 231 return mmu;
237} 232}
238 233
@@ -241,11 +236,6 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t
241 u64 mask = *dev->dma_mask; 236 u64 mask = *dev->dma_mask;
242 int high = addr + size >= mask; 237 int high = addr + size >= mask;
243 int mmu = high; 238 int mmu = high;
244 if (no_iommu) {
245 if (high)
246 panic("PCI-DMA: high address but no IOMMU.\n");
247 mmu = 0;
248 }
249 return mmu; 239 return mmu;
250} 240}
251 241
@@ -310,7 +300,7 @@ void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int di
310 300
311 for (i = 0; i < nents; i++) { 301 for (i = 0; i < nents; i++) {
312 struct scatterlist *s = &sg[i]; 302 struct scatterlist *s = &sg[i];
313 if (!s->dma_length) 303 if (!s->dma_length || !s->length)
314 break; 304 break;
315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir); 305 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
316 } 306 }
@@ -364,6 +354,7 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
364 354
365 BUG_ON(i > start && s->offset); 355 BUG_ON(i > start && s->offset);
366 if (i == start) { 356 if (i == start) {
357 *sout = *s;
367 sout->dma_address = iommu_bus_base; 358 sout->dma_address = iommu_bus_base;
368 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 359 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
369 sout->dma_length = s->length; 360 sout->dma_length = s->length;
@@ -390,6 +381,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat,
390{ 381{
391 if (!need) { 382 if (!need) {
392 BUG_ON(stopat - start != 1); 383 BUG_ON(stopat - start != 1);
384 *sout = sg[start];
393 sout->dma_length = sg[start].length; 385 sout->dma_length = sg[start].length;
394 return 0; 386 return 0;
395 } 387 }
@@ -632,17 +624,13 @@ static int __init pci_iommu_init(void)
632 (agp_copy_info(agp_bridge, &info) < 0); 624 (agp_copy_info(agp_bridge, &info) < 0);
633#endif 625#endif
634 626
635 if (swiotlb) { 627 if (swiotlb)
636 no_iommu = 1;
637 return -1; 628 return -1;
638 } 629
639
640 if (no_iommu || 630 if (no_iommu ||
641 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 631 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
642 !iommu_aperture || 632 !iommu_aperture ||
643 (no_agp && init_k8_gatt(&info) < 0)) { 633 (no_agp && init_k8_gatt(&info) < 0)) {
644 no_iommu = 1;
645 no_iommu_init();
646 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 634 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
647 if (end_pfn > MAX_DMA32_PFN) { 635 if (end_pfn > MAX_DMA32_PFN) {
648 printk(KERN_ERR "WARNING more than 4GB of memory " 636 printk(KERN_ERR "WARNING more than 4GB of memory "
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 9435ab7d6fb8..aa55e3cec665 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -423,6 +423,12 @@ static __init void parse_cmdline_early (char ** cmdline_p)
423 else if(!memcmp(from, "elfcorehdr=", 11)) 423 else if(!memcmp(from, "elfcorehdr=", 11))
424 elfcorehdr_addr = memparse(from+11, &from); 424 elfcorehdr_addr = memparse(from+11, &from);
425#endif 425#endif
426
427#ifdef CONFIG_HOTPLUG_CPU
428 else if (!memcmp(from, "additional_cpus=", 16))
429 setup_additional_cpus(from+16);
430#endif
431
426 next_char: 432 next_char:
427 c = *(from++); 433 c = *(from++);
428 if (!c) 434 if (!c)
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 67e4e28f4df8..66e98659d077 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -1152,8 +1152,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
1152 setup_ioapic_dest(); 1152 setup_ioapic_dest();
1153#endif 1153#endif
1154 1154
1155 time_init_gtod();
1156
1157 check_nmi_watchdog(); 1155 check_nmi_watchdog();
1158} 1156}
1159 1157
@@ -1244,7 +1242,7 @@ void __cpu_die(unsigned int cpu)
1244 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1242 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1245} 1243}
1246 1244
1247static __init int setup_additional_cpus(char *s) 1245__init int setup_additional_cpus(char *s)
1248{ 1246{
1249 return get_option(&s, &additional_cpus); 1247 return get_option(&s, &additional_cpus);
1250} 1248}
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 67841d11ed1f..3080f84bf7b7 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -48,6 +48,8 @@ static void cpufreq_delayed_get(void);
48extern void i8254_timer_resume(void); 48extern void i8254_timer_resume(void);
49extern int using_apic_timer; 49extern int using_apic_timer;
50 50
51static char *time_init_gtod(void);
52
51DEFINE_SPINLOCK(rtc_lock); 53DEFINE_SPINLOCK(rtc_lock);
52DEFINE_SPINLOCK(i8253_lock); 54DEFINE_SPINLOCK(i8253_lock);
53 55
@@ -901,6 +903,7 @@ static struct irqaction irq0 = {
901void __init time_init(void) 903void __init time_init(void)
902{ 904{
903 char *timename; 905 char *timename;
906 char *gtod;
904 907
905#ifdef HPET_HACK_ENABLE_DANGEROUS 908#ifdef HPET_HACK_ENABLE_DANGEROUS
906 if (!vxtime.hpet_address) { 909 if (!vxtime.hpet_address) {
@@ -945,21 +948,19 @@ void __init time_init(void)
945 timename = "PIT"; 948 timename = "PIT";
946 } 949 }
947 950
948 printk(KERN_INFO "time.c: Using %ld.%06ld MHz %s timer.\n", 951 vxtime.mode = VXTIME_TSC;
949 vxtime_hz / 1000000, vxtime_hz % 1000000, timename); 952 gtod = time_init_gtod();
953
954 printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n",
955 vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod);
950 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 956 printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
951 cpu_khz / 1000, cpu_khz % 1000); 957 cpu_khz / 1000, cpu_khz % 1000);
952 vxtime.mode = VXTIME_TSC;
953 vxtime.quot = (1000000L << 32) / vxtime_hz; 958 vxtime.quot = (1000000L << 32) / vxtime_hz;
954 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 959 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
955 vxtime.last_tsc = get_cycles_sync(); 960 vxtime.last_tsc = get_cycles_sync();
956 setup_irq(0, &irq0); 961 setup_irq(0, &irq0);
957 962
958 set_cyc2ns_scale(cpu_khz); 963 set_cyc2ns_scale(cpu_khz);
959
960#ifndef CONFIG_SMP
961 time_init_gtod();
962#endif
963} 964}
964 965
965/* 966/*
@@ -981,9 +982,9 @@ __cpuinit int unsynchronized_tsc(void)
981} 982}
982 983
983/* 984/*
984 * Decide after all CPUs are booted what mode gettimeofday should use. 985 * Decide what mode gettimeofday should use.
985 */ 986 */
986void __init time_init_gtod(void) 987__init static char *time_init_gtod(void)
987{ 988{
988 char *timetype; 989 char *timetype;
989 990
@@ -1011,8 +1012,7 @@ void __init time_init_gtod(void)
1011 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; 1012 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC";
1012 vxtime.mode = VXTIME_TSC; 1013 vxtime.mode = VXTIME_TSC;
1013 } 1014 }
1014 1015 return timetype;
1015 printk(KERN_INFO "time.c: Using %s based timekeeping.\n", timetype);
1016} 1016}
1017 1017
1018__setup("report_lost_ticks", time_setup); 1018__setup("report_lost_ticks", time_setup);