aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/boot/Makefile11
-rw-r--r--arch/x86/boot/compressed/Makefile_322
-rw-r--r--arch/x86/boot/compressed/Makefile_644
-rw-r--r--arch/x86/ia32/ia32_aout.c10
-rw-r--r--arch/x86/ia32/ia32_binfmt.c1
-rw-r--r--arch/x86/ia32/ipc32.c2
-rw-r--r--arch/x86/kernel/alternative.c1
-rw-r--r--arch/x86/kernel/apic_64.c26
-rw-r--r--arch/x86/kernel/bugs_64.c2
-rw-r--r--arch/x86/kernel/cpu/bugs.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c10
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-ich.c2
-rw-r--r--arch/x86/kernel/cpu/proc.c3
-rw-r--r--arch/x86/kernel/cpuid.c2
-rw-r--r--arch/x86/kernel/crash_dump_32.c2
-rw-r--r--arch/x86/kernel/crash_dump_64.c2
-rw-r--r--arch/x86/kernel/e820_64.c19
-rw-r--r--arch/x86/kernel/early_printk.c15
-rw-r--r--arch/x86/kernel/efi_32.c15
-rw-r--r--arch/x86/kernel/entry_32.S4
-rw-r--r--arch/x86/kernel/entry_64.S23
-rw-r--r--arch/x86/kernel/head64.c22
-rw-r--r--arch/x86/kernel/i387_32.c2
-rw-r--r--arch/x86/kernel/i387_64.c2
-rw-r--r--arch/x86/kernel/i8237.c2
-rw-r--r--arch/x86/kernel/i8253.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c4
-rw-r--r--arch/x86/kernel/ioport_32.c2
-rw-r--r--arch/x86/kernel/ioport_64.c2
-rw-r--r--arch/x86/kernel/irq_32.c2
-rw-r--r--arch/x86/kernel/irq_64.c2
-rw-r--r--arch/x86/kernel/kprobes_32.c18
-rw-r--r--arch/x86/kernel/kprobes_64.c16
-rw-r--r--arch/x86/kernel/ldt_32.c2
-rw-r--r--arch/x86/kernel/ldt_64.c2
-rw-r--r--arch/x86/kernel/machine_kexec_32.c15
-rw-r--r--arch/x86/kernel/machine_kexec_64.c11
-rw-r--r--arch/x86/kernel/mca_32.c1
-rw-r--r--arch/x86/kernel/mce_64.c3
-rw-r--r--arch/x86/kernel/mce_amd_64.c6
-rw-r--r--arch/x86/kernel/msr.c2
-rw-r--r--arch/x86/kernel/nmi_32.c2
-rw-r--r--arch/x86/kernel/nmi_64.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c24
-rw-r--r--arch/x86/kernel/pci-gart_64.c65
-rw-r--r--arch/x86/kernel/pci-nommu_64.c5
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c4
-rw-r--r--arch/x86/kernel/ptrace_32.c6
-rw-r--r--arch/x86/kernel/ptrace_64.c6
-rw-r--r--arch/x86/kernel/reboot_32.c4
-rw-r--r--arch/x86/kernel/reboot_fixups_32.c2
-rw-r--r--arch/x86/kernel/scx200_32.c12
-rw-r--r--arch/x86/kernel/setup64.c4
-rw-r--r--arch/x86/kernel/setup_32.c69
-rw-r--r--arch/x86/kernel/setup_64.c59
-rw-r--r--arch/x86/kernel/signal_32.c2
-rw-r--r--arch/x86/kernel/signal_64.c2
-rw-r--r--arch/x86/kernel/smpboot_32.c68
-rw-r--r--arch/x86/kernel/smpboot_64.c55
-rw-r--r--arch/x86/kernel/stacktrace.c2
-rw-r--r--arch/x86/kernel/summit_32.c2
-rw-r--r--arch/x86/kernel/sys_i386_32.c4
-rw-r--r--arch/x86/kernel/sys_x86_64.c4
-rw-r--r--arch/x86/kernel/sysenter_32.c2
-rw-r--r--arch/x86/kernel/time_32.c2
-rw-r--r--arch/x86/kernel/time_64.c2
-rw-r--r--arch/x86/kernel/topology.c2
-rw-r--r--arch/x86/kernel/traps_32.c2
-rw-r--r--arch/x86/kernel/traps_64.c2
-rw-r--r--arch/x86/kernel/tsc_32.c6
-rw-r--r--arch/x86/kernel/tsc_sync.c2
-rw-r--r--arch/x86/kernel/vm86_32.c2
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/lib/copy_user_nocache_64.S1
-rw-r--r--arch/x86/lib/thunk_64.S4
-rw-r--r--arch/x86/mach-default/setup.c12
-rw-r--r--arch/x86/mach-visws/setup.c2
-rw-r--r--arch/x86/mach-voyager/setup.c14
-rw-r--r--arch/x86/math-emu/Makefile3
-rw-r--r--arch/x86/mm/discontig_32.c5
-rw-r--r--arch/x86/mm/fault_32.c45
-rw-r--r--arch/x86/mm/fault_64.c44
-rw-r--r--arch/x86/mm/init_32.c5
-rw-r--r--arch/x86/mm/init_64.c51
-rw-r--r--arch/x86/mm/pgtable_32.c2
-rw-r--r--arch/x86/oprofile/op_model_p4.c2
-rw-r--r--arch/x86/pci/acpi.c2
-rw-r--r--arch/x86/vdso/Makefile4
-rw-r--r--arch/x86/xen/enlighten.c7
-rw-r--r--arch/x86/xen/smp.c18
93 files changed, 481 insertions, 449 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index cb1035f2b7e9..89dbf970e058 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -39,6 +39,7 @@ setup-y += printf.o string.o tty.o video.o version.o voyager.o
39setup-y += video-vga.o 39setup-y += video-vga.o
40setup-y += video-vesa.o 40setup-y += video-vesa.o
41setup-y += video-bios.o 41setup-y += video-bios.o
42
42targets += $(setup-y) 43targets += $(setup-y)
43hostprogs-y := tools/build 44hostprogs-y := tools/build
44 45
@@ -50,7 +51,7 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
50# that way we can complain to the user if the CPU is insufficient. 51# that way we can complain to the user if the CPU is insufficient.
51cflags-i386 := 52cflags-i386 :=
52cflags-x86_64 := -m32 53cflags-x86_64 := -m32
53CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ 54KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
54 $(cflags-$(ARCH)) \ 55 $(cflags-$(ARCH)) \
55 -Wall -Wstrict-prototypes \ 56 -Wall -Wstrict-prototypes \
56 -march=i386 -mregparm=3 \ 57 -march=i386 -mregparm=3 \
@@ -61,13 +62,13 @@ CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
61 $(call cc-option, -fno-unit-at-a-time)) \ 62 $(call cc-option, -fno-unit-at-a-time)) \
62 $(call cc-option, -fno-stack-protector) \ 63 $(call cc-option, -fno-stack-protector) \
63 $(call cc-option, -mpreferred-stack-boundary=2) 64 $(call cc-option, -mpreferred-stack-boundary=2)
64AFLAGS := $(CFLAGS) -D__ASSEMBLY__ 65KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
65 66
66$(obj)/zImage: IMAGE_OFFSET := 0x1000 67$(obj)/zImage: IMAGE_OFFSET := 0x1000
67$(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) 68$(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK)
68$(obj)/bzImage: IMAGE_OFFSET := 0x100000 69$(obj)/bzImage: IMAGE_OFFSET := 0x100000
69$(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__ 70$(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__
70$(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ 71$(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
71$(obj)/bzImage: BUILDFLAGS := -b 72$(obj)/bzImage: BUILDFLAGS := -b
72 73
73quiet_cmd_image = BUILD $@ 74quiet_cmd_image = BUILD $@
diff --git a/arch/x86/boot/compressed/Makefile_32 b/arch/x86/boot/compressed/Makefile_32
index 22613c652d22..e43ff7c56e6e 100644
--- a/arch/x86/boot/compressed/Makefile_32
+++ b/arch/x86/boot/compressed/Makefile_32
@@ -11,7 +11,7 @@ EXTRA_AFLAGS := -traditional
11LDFLAGS_vmlinux := -T 11LDFLAGS_vmlinux := -T
12hostprogs-y := relocs 12hostprogs-y := relocs
13 13
14CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \ 14KBUILD_CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
15 -fno-strict-aliasing -fPIC \ 15 -fno-strict-aliasing -fPIC \
16 $(call cc-option,-ffreestanding) \ 16 $(call cc-option,-ffreestanding) \
17 $(call cc-option,-fno-stack-protector) 17 $(call cc-option,-fno-stack-protector)
diff --git a/arch/x86/boot/compressed/Makefile_64 b/arch/x86/boot/compressed/Makefile_64
index dc6b3380cc45..7801e8dd90b2 100644
--- a/arch/x86/boot/compressed/Makefile_64
+++ b/arch/x86/boot/compressed/Makefile_64
@@ -6,11 +6,11 @@
6 6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz head_64.o misc_64.o piggy.o 7targets := vmlinux vmlinux.bin vmlinux.bin.gz head_64.o misc_64.o piggy.o
8 8
9CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \ 9KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \
10 -fno-strict-aliasing -fPIC -mcmodel=small \ 10 -fno-strict-aliasing -fPIC -mcmodel=small \
11 $(call cc-option, -ffreestanding) \ 11 $(call cc-option, -ffreestanding) \
12 $(call cc-option, -fno-stack-protector) 12 $(call cc-option, -fno-stack-protector)
13AFLAGS := $(CFLAGS) -D__ASSEMBLY__ 13KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
14LDFLAGS := -m elf_x86_64 14LDFLAGS := -m elf_x86_64
15 15
16LDFLAGS_vmlinux := -T 16LDFLAGS_vmlinux := -T
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 08781370256d..7cf1c29bf90e 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -40,7 +40,7 @@ static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
40static int load_aout_library(struct file*); 40static int load_aout_library(struct file*);
41 41
42#ifdef CORE_DUMP 42#ifdef CORE_DUMP
43static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 43static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
44 44
45/* 45/*
46 * fill in the user structure for a core dump.. 46 * fill in the user structure for a core dump..
@@ -148,7 +148,7 @@ if (file->f_op->llseek) { \
148 * dumping of the process results in another error.. 148 * dumping of the process results in another error..
149 */ 149 */
150 150
151static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file) 151static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
152{ 152{
153 mm_segment_t fs; 153 mm_segment_t fs;
154 int has_dumped = 0; 154 int has_dumped = 0;
@@ -168,13 +168,11 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
168 168
169/* If the size of the dump file exceeds the rlimit, then see what would happen 169/* If the size of the dump file exceeds the rlimit, then see what would happen
170 if we wrote the stack, but not the data area. */ 170 if we wrote the stack, but not the data area. */
171 if ((dump.u_dsize+dump.u_ssize+1) * PAGE_SIZE > 171 if ((dump.u_dsize + dump.u_ssize + 1) * PAGE_SIZE > limit)
172 current->signal->rlim[RLIMIT_CORE].rlim_cur)
173 dump.u_dsize = 0; 172 dump.u_dsize = 0;
174 173
175/* Make sure we have enough room to write the stack and data areas. */ 174/* Make sure we have enough room to write the stack and data areas. */
176 if ((dump.u_ssize+1) * PAGE_SIZE > 175 if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
177 current->signal->rlim[RLIMIT_CORE].rlim_cur)
178 dump.u_ssize = 0; 176 dump.u_ssize = 0;
179 177
180/* make sure we actually have a data and stack area to dump */ 178/* make sure we actually have a data and stack area to dump */
diff --git a/arch/x86/ia32/ia32_binfmt.c b/arch/x86/ia32/ia32_binfmt.c
index dffd2ac72747..d3c53e8b05c0 100644
--- a/arch/x86/ia32/ia32_binfmt.c
+++ b/arch/x86/ia32/ia32_binfmt.c
@@ -188,6 +188,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
188} 188}
189 189
190#define ELF_CORE_COPY_XFPREGS 1 190#define ELF_CORE_COPY_XFPREGS 1
191#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
191static inline int 192static inline int
192elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) 193elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
193{ 194{
diff --git a/arch/x86/ia32/ipc32.c b/arch/x86/ia32/ipc32.c
index 2e1869ec4db4..7b3342e5aab5 100644
--- a/arch/x86/ia32/ipc32.c
+++ b/arch/x86/ia32/ipc32.c
@@ -9,8 +9,6 @@
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/compat.h> 10#include <linux/compat.h>
11 11
12#include <asm/ipc.h>
13
14asmlinkage long 12asmlinkage long
15sys32_ipc(u32 call, int first, int second, int third, 13sys32_ipc(u32 call, int first, int second, int third,
16 compat_uptr_t ptr, u32 fifth) 14 compat_uptr_t ptr, u32 fifth)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 63c55148dd05..42421437ded3 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -10,6 +10,7 @@
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11#include <asm/mce.h> 11#include <asm/mce.h>
12#include <asm/nmi.h> 12#include <asm/nmi.h>
13#include <asm/vsyscall.h>
13 14
14#define MAX_PATCH_LEN (255-1) 15#define MAX_PATCH_LEN (255-1)
15 16
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 395928de28ea..09b82093bc75 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -964,8 +964,34 @@ void __init setup_boot_APIC_clock (void)
964 setup_APIC_timer(); 964 setup_APIC_timer();
965} 965}
966 966
967/*
968 * AMD C1E enabled CPUs have a real nasty problem: Some BIOSes set the
969 * C1E flag only in the secondary CPU, so when we detect the wreckage
970 * we already have enabled the boot CPU local apic timer. Check, if
971 * disable_apic_timer is set and the DUMMY flag is cleared. If yes,
972 * set the DUMMY flag again and force the broadcast mode in the
973 * clockevents layer.
974 */
975void __cpuinit check_boot_apic_timer_broadcast(void)
976{
977 struct clock_event_device *levt = &per_cpu(lapic_events, boot_cpu_id);
978
979 if (!disable_apic_timer ||
980 (lapic_clockevent.features & CLOCK_EVT_FEAT_DUMMY))
981 return;
982
983 printk(KERN_INFO "AMD C1E detected late. Force timer broadcast.\n");
984 lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY;
985 levt->features |= CLOCK_EVT_FEAT_DUMMY;
986
987 local_irq_enable();
988 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, &boot_cpu_id);
989 local_irq_disable();
990}
991
967void __cpuinit setup_secondary_APIC_clock(void) 992void __cpuinit setup_secondary_APIC_clock(void)
968{ 993{
994 check_boot_apic_timer_broadcast();
969 setup_APIC_timer(); 995 setup_APIC_timer();
970} 996}
971 997
diff --git a/arch/x86/kernel/bugs_64.c b/arch/x86/kernel/bugs_64.c
index 4e5e9d364d63..9a189cef6404 100644
--- a/arch/x86/kernel/bugs_64.c
+++ b/arch/x86/kernel/bugs_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/x86_64/kernel/bugs.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * Copyright (C) 2000 SuSE 3 * Copyright (C) 2000 SuSE
6 */ 4 */
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 59266f03d1cd..205fd5ba57f7 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/i386/cpu/bugs.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * 3 *
6 * Cyrix stuff, June 1998 by: 4 * Cyrix stuff, June 1998 by:
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index ffd01e5dcb52..2ca43ba32bc0 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -595,7 +595,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
595 dmi_check_system(sw_any_bug_dmi_table); 595 dmi_check_system(sw_any_bug_dmi_table);
596 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) { 596 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) {
597 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; 597 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
598 policy->cpus = cpu_core_map[cpu]; 598 policy->cpus = per_cpu(cpu_core_map, cpu);
599 } 599 }
600#endif 600#endif
601 601
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index 8eb414b906d2..793eae854f4f 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -200,7 +200,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
200 unsigned int i; 200 unsigned int i;
201 201
202#ifdef CONFIG_SMP 202#ifdef CONFIG_SMP
203 policy->cpus = cpu_sibling_map[policy->cpu]; 203 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
204#endif 204#endif
205 205
206 /* Errata workaround */ 206 /* Errata workaround */
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index b273b69cfddf..c06ac680c9ca 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -57,7 +57,7 @@ static struct powernow_k8_data *powernow_data[NR_CPUS];
57static int cpu_family = CPU_OPTERON; 57static int cpu_family = CPU_OPTERON;
58 58
59#ifndef CONFIG_SMP 59#ifndef CONFIG_SMP
60static cpumask_t cpu_core_map[1]; 60DEFINE_PER_CPU(cpumask_t, cpu_core_map);
61#endif 61#endif
62 62
63/* Return a frequency in MHz, given an input fid */ 63/* Return a frequency in MHz, given an input fid */
@@ -667,7 +667,7 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
667 667
668 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 668 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
669 data->powernow_table = powernow_table; 669 data->powernow_table = powernow_table;
670 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu) 670 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
671 print_basics(data); 671 print_basics(data);
672 672
673 for (j = 0; j < data->numps; j++) 673 for (j = 0; j < data->numps; j++)
@@ -821,7 +821,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
821 821
822 /* fill in data */ 822 /* fill in data */
823 data->numps = data->acpi_data.state_count; 823 data->numps = data->acpi_data.state_count;
824 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu) 824 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
825 print_basics(data); 825 print_basics(data);
826 powernow_k8_acpi_pst_values(data, 0); 826 powernow_k8_acpi_pst_values(data, 0);
827 827
@@ -1214,7 +1214,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1214 if (cpu_family == CPU_HW_PSTATE) 1214 if (cpu_family == CPU_HW_PSTATE)
1215 pol->cpus = cpumask_of_cpu(pol->cpu); 1215 pol->cpus = cpumask_of_cpu(pol->cpu);
1216 else 1216 else
1217 pol->cpus = cpu_core_map[pol->cpu]; 1217 pol->cpus = per_cpu(cpu_core_map, pol->cpu);
1218 data->available_cores = &(pol->cpus); 1218 data->available_cores = &(pol->cpus);
1219 1219
1220 /* Take a crude guess here. 1220 /* Take a crude guess here.
@@ -1281,7 +1281,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1281 cpumask_t oldmask = current->cpus_allowed; 1281 cpumask_t oldmask = current->cpus_allowed;
1282 unsigned int khz = 0; 1282 unsigned int khz = 0;
1283 1283
1284 data = powernow_data[first_cpu(cpu_core_map[cpu])]; 1284 data = powernow_data[first_cpu(per_cpu(cpu_core_map, cpu))];
1285 1285
1286 if (!data) 1286 if (!data)
1287 return -EINVAL; 1287 return -EINVAL;
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index 36685e8f7be1..14d68aa301ee 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -322,7 +322,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
322 322
323 /* only run on CPU to be set, or on its sibling */ 323 /* only run on CPU to be set, or on its sibling */
324#ifdef CONFIG_SMP 324#ifdef CONFIG_SMP
325 policy->cpus = cpu_sibling_map[policy->cpu]; 325 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu);
326#endif 326#endif
327 327
328 cpus_allowed = current->cpus_allowed; 328 cpus_allowed = current->cpus_allowed;
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 1e31b6caffb1..879a0f789b1e 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -122,7 +122,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
122#ifdef CONFIG_X86_HT 122#ifdef CONFIG_X86_HT
123 if (c->x86_max_cores * smp_num_siblings > 1) { 123 if (c->x86_max_cores * smp_num_siblings > 1) {
124 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 124 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
125 seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[n])); 125 seq_printf(m, "siblings\t: %d\n",
126 cpus_weight(per_cpu(cpu_core_map, n)));
126 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); 127 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
127 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); 128 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
128 } 129 }
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 5c2faa10e9fa..f4548c93ccf5 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -11,8 +11,6 @@
11 * ----------------------------------------------------------------------- */ 11 * ----------------------------------------------------------------------- */
12 12
13/* 13/*
14 * cpuid.c
15 *
16 * x86 CPUID access device 14 * x86 CPUID access device
17 * 15 *
18 * This device is accessed by lseek() to the appropriate CPUID level 16 * This device is accessed by lseek() to the appropriate CPUID level
diff --git a/arch/x86/kernel/crash_dump_32.c b/arch/x86/kernel/crash_dump_32.c
index 3f532df488bc..32e75d0731a9 100644
--- a/arch/x86/kernel/crash_dump_32.c
+++ b/arch/x86/kernel/crash_dump_32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code. 2 * Memory preserving reboot related code.
3 * 3 *
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) 4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * Copyright (C) IBM Corporation, 2004. All rights reserved 5 * Copyright (C) IBM Corporation, 2004. All rights reserved
diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
index 942deac4d43a..15e6c6bc4a46 100644
--- a/arch/x86/kernel/crash_dump_64.c
+++ b/arch/x86/kernel/crash_dump_64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code. 2 * Memory preserving reboot related code.
3 * 3 *
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) 4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * Copyright (C) IBM Corporation, 2004. All rights reserved 5 * Copyright (C) IBM Corporation, 2004. All rights reserved
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 0f4d5e209e9b..e422b8159f69 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -24,7 +24,7 @@
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/e820.h> 25#include <asm/e820.h>
26#include <asm/proto.h> 26#include <asm/proto.h>
27#include <asm/bootsetup.h> 27#include <asm/setup.h>
28#include <asm/sections.h> 28#include <asm/sections.h>
29 29
30struct e820map e820; 30struct e820map e820;
@@ -68,10 +68,15 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
68 68
69 /* initrd */ 69 /* initrd */
70#ifdef CONFIG_BLK_DEV_INITRD 70#ifdef CONFIG_BLK_DEV_INITRD
71 if (LOADER_TYPE && INITRD_START && last >= INITRD_START && 71 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
72 addr < INITRD_START+INITRD_SIZE) { 72 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
73 *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); 73 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
74 return 1; 74 unsigned long ramdisk_end = ramdisk_image+ramdisk_size;
75
76 if (last >= ramdisk_image && addr < ramdisk_end) {
77 *addrp = PAGE_ALIGN(ramdisk_end);
78 return 1;
79 }
75 } 80 }
76#endif 81#endif
77 /* kernel code */ 82 /* kernel code */
@@ -594,8 +599,8 @@ void __init setup_memory_region(void)
594 * Otherwise fake a memory map; one section from 0k->640k, 599 * Otherwise fake a memory map; one section from 0k->640k,
595 * the next section from 1mb->appropriate_mem_k 600 * the next section from 1mb->appropriate_mem_k
596 */ 601 */
597 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 602 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
598 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) 603 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
599 early_panic("Cannot find a valid memory map"); 604 early_panic("Cannot find a valid memory map");
600 printk(KERN_INFO "BIOS-provided physical RAM map:\n"); 605 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
601 e820_print_map("BIOS-e820"); 606 e820_print_map("BIOS-e820");
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index fd9aff3f3890..b7d6c23f2871 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -6,15 +6,10 @@
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/fcntl.h> 8#include <asm/fcntl.h>
9#include <asm/setup.h>
9#include <xen/hvc-console.h> 10#include <xen/hvc-console.h>
10 11
11/* Simple VGA output */ 12/* Simple VGA output */
12
13#ifdef __i386__
14#include <asm/setup.h>
15#else
16#include <asm/bootsetup.h>
17#endif
18#define VGABASE (__ISA_IO_base + 0xb8000) 13#define VGABASE (__ISA_IO_base + 0xb8000)
19 14
20static int max_ypos = 25, max_xpos = 80; 15static int max_ypos = 25, max_xpos = 80;
@@ -234,10 +229,10 @@ static int __init setup_early_printk(char *buf)
234 early_serial_init(buf); 229 early_serial_init(buf);
235 early_console = &early_serial_console; 230 early_console = &early_serial_console;
236 } else if (!strncmp(buf, "vga", 3) 231 } else if (!strncmp(buf, "vga", 3)
237 && SCREEN_INFO.orig_video_isVGA == 1) { 232 && boot_params.screen_info.orig_video_isVGA == 1) {
238 max_xpos = SCREEN_INFO.orig_video_cols; 233 max_xpos = boot_params.screen_info.orig_video_cols;
239 max_ypos = SCREEN_INFO.orig_video_lines; 234 max_ypos = boot_params.screen_info.orig_video_lines;
240 current_ypos = SCREEN_INFO.orig_y; 235 current_ypos = boot_params.screen_info.orig_y;
241 early_console = &early_vga_console; 236 early_console = &early_vga_console;
242 } else if (!strncmp(buf, "simnow", 6)) { 237 } else if (!strncmp(buf, "simnow", 6)) {
243 simnow_init(buf + 6); 238 simnow_init(buf + 6);
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index 2452c6fbe992..b42558c48e9d 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -331,11 +331,13 @@ void __init efi_init(void)
331 memset(&efi, 0, sizeof(efi) ); 331 memset(&efi, 0, sizeof(efi) );
332 memset(&efi_phys, 0, sizeof(efi_phys)); 332 memset(&efi_phys, 0, sizeof(efi_phys));
333 333
334 efi_phys.systab = EFI_SYSTAB; 334 efi_phys.systab =
335 memmap.phys_map = EFI_MEMMAP; 335 (efi_system_table_t *)boot_params.efi_info.efi_systab;
336 memmap.nr_map = EFI_MEMMAP_SIZE/EFI_MEMDESC_SIZE; 336 memmap.phys_map = (void *)boot_params.efi_info.efi_memmap;
337 memmap.desc_version = EFI_MEMDESC_VERSION; 337 memmap.nr_map = boot_params.efi_info.efi_memmap_size/
338 memmap.desc_size = EFI_MEMDESC_SIZE; 338 boot_params.efi_info.efi_memdesc_size;
339 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
340 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
339 341
340 efi.systab = (efi_system_table_t *) 342 efi.systab = (efi_system_table_t *)
341 boot_ioremap((unsigned long) efi_phys.systab, 343 boot_ioremap((unsigned long) efi_phys.systab,
@@ -446,7 +448,8 @@ void __init efi_init(void)
446 printk(KERN_ERR PFX "Could not map the runtime service table!\n"); 448 printk(KERN_ERR PFX "Could not map the runtime service table!\n");
447 449
448 /* Map the EFI memory map for use until paging_init() */ 450 /* Map the EFI memory map for use until paging_init() */
449 memmap.map = boot_ioremap((unsigned long) EFI_MEMMAP, EFI_MEMMAP_SIZE); 451 memmap.map = boot_ioremap(boot_params.efi_info.efi_memmap,
452 boot_params.efi_info.efi_memmap_size);
450 if (memmap.map == NULL) 453 if (memmap.map == NULL)
451 printk(KERN_ERR PFX "Could not map the EFI memory map!\n"); 454 printk(KERN_ERR PFX "Could not map the EFI memory map!\n");
452 455
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 1f2062e94d82..dc7f938e5015 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -251,6 +251,7 @@ check_userspace:
251 jb resume_kernel # not returning to v8086 or userspace 251 jb resume_kernel # not returning to v8086 or userspace
252 252
253ENTRY(resume_userspace) 253ENTRY(resume_userspace)
254 LOCKDEP_SYS_EXIT
254 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 255 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
255 # setting need_resched or sigpending 256 # setting need_resched or sigpending
256 # between sampling and the iret 257 # between sampling and the iret
@@ -338,6 +339,7 @@ sysenter_past_esp:
338 jae syscall_badsys 339 jae syscall_badsys
339 call *sys_call_table(,%eax,4) 340 call *sys_call_table(,%eax,4)
340 movl %eax,PT_EAX(%esp) 341 movl %eax,PT_EAX(%esp)
342 LOCKDEP_SYS_EXIT
341 DISABLE_INTERRUPTS(CLBR_ANY) 343 DISABLE_INTERRUPTS(CLBR_ANY)
342 TRACE_IRQS_OFF 344 TRACE_IRQS_OFF
343 movl TI_flags(%ebp), %ecx 345 movl TI_flags(%ebp), %ecx
@@ -377,6 +379,7 @@ syscall_call:
377 call *sys_call_table(,%eax,4) 379 call *sys_call_table(,%eax,4)
378 movl %eax,PT_EAX(%esp) # store the return value 380 movl %eax,PT_EAX(%esp) # store the return value
379syscall_exit: 381syscall_exit:
382 LOCKDEP_SYS_EXIT
380 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 383 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
381 # setting need_resched or sigpending 384 # setting need_resched or sigpending
382 # between sampling and the iret 385 # between sampling and the iret
@@ -467,6 +470,7 @@ work_pending:
467 jz work_notifysig 470 jz work_notifysig
468work_resched: 471work_resched:
469 call schedule 472 call schedule
473 LOCKDEP_SYS_EXIT
470 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 474 DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt
471 # setting need_resched or sigpending 475 # setting need_resched or sigpending
472 # between sampling and the iret 476 # between sampling and the iret
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1d232e5f5658..f1cacd4897f7 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -244,6 +244,7 @@ ret_from_sys_call:
244 movl $_TIF_ALLWORK_MASK,%edi 244 movl $_TIF_ALLWORK_MASK,%edi
245 /* edi: flagmask */ 245 /* edi: flagmask */
246sysret_check: 246sysret_check:
247 LOCKDEP_SYS_EXIT
247 GET_THREAD_INFO(%rcx) 248 GET_THREAD_INFO(%rcx)
248 cli 249 cli
249 TRACE_IRQS_OFF 250 TRACE_IRQS_OFF
@@ -333,6 +334,7 @@ int_ret_from_sys_call:
333 movl $_TIF_ALLWORK_MASK,%edi 334 movl $_TIF_ALLWORK_MASK,%edi
334 /* edi: mask to check */ 335 /* edi: mask to check */
335int_with_check: 336int_with_check:
337 LOCKDEP_SYS_EXIT_IRQ
336 GET_THREAD_INFO(%rcx) 338 GET_THREAD_INFO(%rcx)
337 movl threadinfo_flags(%rcx),%edx 339 movl threadinfo_flags(%rcx),%edx
338 andl %edi,%edx 340 andl %edi,%edx
@@ -544,11 +546,13 @@ exit_intr:
544retint_with_reschedule: 546retint_with_reschedule:
545 movl $_TIF_WORK_MASK,%edi 547 movl $_TIF_WORK_MASK,%edi
546retint_check: 548retint_check:
549 LOCKDEP_SYS_EXIT_IRQ
547 movl threadinfo_flags(%rcx),%edx 550 movl threadinfo_flags(%rcx),%edx
548 andl %edi,%edx 551 andl %edi,%edx
549 CFI_REMEMBER_STATE 552 CFI_REMEMBER_STATE
550 jnz retint_careful 553 jnz retint_careful
551retint_swapgs: 554
555retint_swapgs: /* return to user-space */
552 /* 556 /*
553 * The iretq could re-enable interrupts: 557 * The iretq could re-enable interrupts:
554 */ 558 */
@@ -557,7 +561,7 @@ retint_swapgs:
557 swapgs 561 swapgs
558 jmp restore_args 562 jmp restore_args
559 563
560retint_restore_args: 564retint_restore_args: /* return to kernel space */
561 cli 565 cli
562 /* 566 /*
563 * The iretq could re-enable interrupts: 567 * The iretq could re-enable interrupts:
@@ -866,26 +870,21 @@ error_sti:
866 movq ORIG_RAX(%rsp),%rsi /* get error code */ 870 movq ORIG_RAX(%rsp),%rsi /* get error code */
867 movq $-1,ORIG_RAX(%rsp) 871 movq $-1,ORIG_RAX(%rsp)
868 call *%rax 872 call *%rax
869 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */ 873 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
870error_exit: 874error_exit:
871 movl %ebx,%eax 875 movl %ebx,%eax
872 RESTORE_REST 876 RESTORE_REST
873 cli 877 cli
874 TRACE_IRQS_OFF 878 TRACE_IRQS_OFF
875 GET_THREAD_INFO(%rcx) 879 GET_THREAD_INFO(%rcx)
876 testl %eax,%eax 880 testl %eax,%eax
877 jne retint_kernel 881 jne retint_kernel
882 LOCKDEP_SYS_EXIT_IRQ
878 movl threadinfo_flags(%rcx),%edx 883 movl threadinfo_flags(%rcx),%edx
879 movl $_TIF_WORK_MASK,%edi 884 movl $_TIF_WORK_MASK,%edi
880 andl %edi,%edx 885 andl %edi,%edx
881 jnz retint_careful 886 jnz retint_careful
882 /* 887 jmp retint_swapgs
883 * The iret might restore flags:
884 */
885 TRACE_IRQS_IRETQ
886 swapgs
887 RESTORE_ARGS 0,8,0
888 jmp iret_label
889 CFI_ENDPROC 888 CFI_ENDPROC
890 889
891error_kernelspace: 890error_kernelspace:
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 6c34bdd22e26..a7eee0a4751d 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/head64.c -- prepare to run common code 2 * prepare to run common code
3 * 3 *
4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE 4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
5 */ 5 */
@@ -14,7 +14,6 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/proto.h> 15#include <asm/proto.h>
16#include <asm/smp.h> 16#include <asm/smp.h>
17#include <asm/bootsetup.h>
18#include <asm/setup.h> 17#include <asm/setup.h>
19#include <asm/desc.h> 18#include <asm/desc.h>
20#include <asm/pgtable.h> 19#include <asm/pgtable.h>
@@ -36,26 +35,15 @@ static void __init clear_bss(void)
36 (unsigned long) __bss_stop - (unsigned long) __bss_start); 35 (unsigned long) __bss_stop - (unsigned long) __bss_start);
37} 36}
38 37
39#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
40#define OLD_CL_MAGIC_ADDR 0x20
41#define OLD_CL_MAGIC 0xA33F
42#define OLD_CL_OFFSET 0x22
43
44static void __init copy_bootdata(char *real_mode_data) 38static void __init copy_bootdata(char *real_mode_data)
45{ 39{
46 unsigned long new_data;
47 char * command_line; 40 char * command_line;
48 41
49 memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); 42 memcpy(&boot_params, real_mode_data, sizeof boot_params);
50 new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); 43 if (boot_params.hdr.cmd_line_ptr) {
51 if (!new_data) { 44 command_line = __va(boot_params.hdr.cmd_line_ptr);
52 if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { 45 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
53 return;
54 }
55 new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET);
56 } 46 }
57 command_line = __va(new_data);
58 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
59} 47}
60 48
61void __init x86_64_start_kernel(char * real_mode_data) 49void __init x86_64_start_kernel(char * real_mode_data)
diff --git a/arch/x86/kernel/i387_32.c b/arch/x86/kernel/i387_32.c
index 665847281ed2..7d2e12f6c78b 100644
--- a/arch/x86/kernel/i387_32.c
+++ b/arch/x86/kernel/i387_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/i387.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
diff --git a/arch/x86/kernel/i387_64.c b/arch/x86/kernel/i387_64.c
index 1d58c13bc6bc..56c1f1147109 100644
--- a/arch/x86/kernel/i387_64.c
+++ b/arch/x86/kernel/i387_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/i387.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * Copyright (C) 2002 Andi Kleen, SuSE Labs 3 * Copyright (C) 2002 Andi Kleen, SuSE Labs
6 * 4 *
diff --git a/arch/x86/kernel/i8237.c b/arch/x86/kernel/i8237.c
index 6f508e8d7c57..29313832df0c 100644
--- a/arch/x86/kernel/i8237.c
+++ b/arch/x86/kernel/i8237.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * i8237.c: 8237A DMA controller suspend functions. 2 * 8237A DMA controller suspend functions.
3 * 3 *
4 * Written by Pierre Ossman, 2005. 4 * Written by Pierre Ossman, 2005.
5 * 5 *
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index ac15e4cbd9c1..5cc8841ca2c6 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * i8253.c 8253/PIT functions 2 * 8253/PIT functions
3 * 3 *
4 */ 4 */
5#include <linux/clockchips.h> 5#include <linux/clockchips.h>
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index e2f4a1c68547..4ee1e5ee9b57 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -378,7 +378,7 @@ static struct irq_cpu_info {
378 378
379#define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask) 379#define IRQ_ALLOWED(cpu, allowed_mask) cpu_isset(cpu, allowed_mask)
380 380
381#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i])) 381#define CPU_TO_PACKAGEINDEX(i) (first_cpu(per_cpu(cpu_sibling_map, i)))
382 382
383static cpumask_t balance_irq_affinity[NR_IRQS] = { 383static cpumask_t balance_irq_affinity[NR_IRQS] = {
384 [0 ... NR_IRQS-1] = CPU_MASK_ALL 384 [0 ... NR_IRQS-1] = CPU_MASK_ALL
@@ -598,7 +598,7 @@ tryanotherirq:
598 * (A+B)/2 vs B 598 * (A+B)/2 vs B
599 */ 599 */
600 load = CPU_IRQ(min_loaded) >> 1; 600 load = CPU_IRQ(min_loaded) >> 1;
601 for_each_cpu_mask(j, cpu_sibling_map[min_loaded]) { 601 for_each_cpu_mask(j, per_cpu(cpu_sibling_map, min_loaded)) {
602 if (load > CPU_IRQ(j)) { 602 if (load > CPU_IRQ(j)) {
603 /* This won't change cpu_sibling_map[min_loaded] */ 603 /* This won't change cpu_sibling_map[min_loaded] */
604 load = CPU_IRQ(j); 604 load = CPU_IRQ(j);
diff --git a/arch/x86/kernel/ioport_32.c b/arch/x86/kernel/ioport_32.c
index 3d310a946d76..4ed48dc8df1e 100644
--- a/arch/x86/kernel/ioport_32.c
+++ b/arch/x86/kernel/ioport_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/ioport.c
3 *
4 * This contains the io-permission bitmap code - written by obz, with changes 2 * This contains the io-permission bitmap code - written by obz, with changes
5 * by Linus. 3 * by Linus.
6 */ 4 */
diff --git a/arch/x86/kernel/ioport_64.c b/arch/x86/kernel/ioport_64.c
index 653efa30b0f4..5f62fad64dab 100644
--- a/arch/x86/kernel/ioport_64.c
+++ b/arch/x86/kernel/ioport_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/ioport.c
3 *
4 * This contains the io-permission bitmap code - written by obz, with changes 2 * This contains the io-permission bitmap code - written by obz, with changes
5 * by Linus. 3 * by Linus.
6 */ 4 */
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 4f681bcdb1fc..e173b763f148 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/irq.c
3 *
4 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 2 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
5 * 3 *
6 * This file contains the lowest level x86-specific interrupt 4 * This file contains the lowest level x86-specific interrupt
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index bd11e42b22bf..865669efc540 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/irq.c
3 *
4 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 2 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
5 * 3 *
6 * This file contains the lowest level x86_64-specific interrupt 4 * This file contains the lowest level x86_64-specific interrupt
diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index 448a50b1324c..90f778c04b3f 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Kernel Probes (KProbes) 2 * Kernel Probes (KProbes)
3 * arch/i386/kernel/kprobes.c
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -42,6 +41,13 @@ void jprobe_return_end(void);
42DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 41DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
43DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 42DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
44 43
44struct kretprobe_blackpoint kretprobe_blacklist[] = {
45 {"__switch_to", }, /* This function switches only current task, but
46 doesn't switch kernel stack.*/
47 {NULL, NULL} /* Terminator */
48};
49const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
50
45/* insert a jmp code */ 51/* insert a jmp code */
46static __always_inline void set_jmp_op(void *from, void *to) 52static __always_inline void set_jmp_op(void *from, void *to)
47{ 53{
@@ -558,6 +564,12 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
558 564
559 resume_execution(cur, regs, kcb); 565 resume_execution(cur, regs, kcb);
560 regs->eflags |= kcb->kprobe_saved_eflags; 566 regs->eflags |= kcb->kprobe_saved_eflags;
567#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
568 if (raw_irqs_disabled_flags(regs->eflags))
569 trace_hardirqs_off();
570 else
571 trace_hardirqs_on();
572#endif
561 573
562 /*Restore back the original saved kprobes variables and continue. */ 574 /*Restore back the original saved kprobes variables and continue. */
563 if (kcb->kprobe_status == KPROBE_REENTER) { 575 if (kcb->kprobe_status == KPROBE_REENTER) {
@@ -579,7 +591,7 @@ out:
579 return 1; 591 return 1;
580} 592}
581 593
582static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 594int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
583{ 595{
584 struct kprobe *cur = kprobe_running(); 596 struct kprobe *cur = kprobe_running();
585 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 597 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -661,7 +673,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
661 ret = NOTIFY_STOP; 673 ret = NOTIFY_STOP;
662 break; 674 break;
663 case DIE_GPF: 675 case DIE_GPF:
664 case DIE_PAGE_FAULT:
665 /* kprobe_running() needs smp_processor_id() */ 676 /* kprobe_running() needs smp_processor_id() */
666 preempt_disable(); 677 preempt_disable();
667 if (kprobe_running() && 678 if (kprobe_running() &&
@@ -695,6 +706,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
695 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, 706 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr,
696 MIN_STACK_SIZE(addr)); 707 MIN_STACK_SIZE(addr));
697 regs->eflags &= ~IF_MASK; 708 regs->eflags &= ~IF_MASK;
709 trace_hardirqs_off();
698 regs->eip = (unsigned long)(jp->entry); 710 regs->eip = (unsigned long)(jp->entry);
699 return 1; 711 return 1;
700} 712}
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index a30e004682e2..681b801c5e26 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Kernel Probes (KProbes) 2 * Kernel Probes (KProbes)
3 * arch/x86_64/kernel/kprobes.c
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -49,6 +48,13 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p);
49DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 48DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
50DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 49DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
51 50
51struct kretprobe_blackpoint kretprobe_blacklist[] = {
52 {"__switch_to", }, /* This function switches only current task, but
53 doesn't switch kernel stack.*/
54 {NULL, NULL} /* Terminator */
55};
56const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
57
52/* 58/*
53 * returns non-zero if opcode modifies the interrupt flag. 59 * returns non-zero if opcode modifies the interrupt flag.
54 */ 60 */
@@ -545,6 +551,12 @@ int __kprobes post_kprobe_handler(struct pt_regs *regs)
545 551
546 resume_execution(cur, regs, kcb); 552 resume_execution(cur, regs, kcb);
547 regs->eflags |= kcb->kprobe_saved_rflags; 553 regs->eflags |= kcb->kprobe_saved_rflags;
554#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
555 if (raw_irqs_disabled_flags(regs->eflags))
556 trace_hardirqs_off();
557 else
558 trace_hardirqs_on();
559#endif
548 560
549 /* Restore the original saved kprobes variables and continue. */ 561 /* Restore the original saved kprobes variables and continue. */
550 if (kcb->kprobe_status == KPROBE_REENTER) { 562 if (kcb->kprobe_status == KPROBE_REENTER) {
@@ -652,7 +664,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
652 ret = NOTIFY_STOP; 664 ret = NOTIFY_STOP;
653 break; 665 break;
654 case DIE_GPF: 666 case DIE_GPF:
655 case DIE_PAGE_FAULT:
656 /* kprobe_running() needs smp_processor_id() */ 667 /* kprobe_running() needs smp_processor_id() */
657 preempt_disable(); 668 preempt_disable();
658 if (kprobe_running() && 669 if (kprobe_running() &&
@@ -685,6 +696,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
685 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, 696 memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr,
686 MIN_STACK_SIZE(addr)); 697 MIN_STACK_SIZE(addr));
687 regs->eflags &= ~IF_MASK; 698 regs->eflags &= ~IF_MASK;
699 trace_hardirqs_off();
688 regs->rip = (unsigned long)(jp->entry); 700 regs->rip = (unsigned long)(jp->entry);
689 return 1; 701 return 1;
690} 702}
diff --git a/arch/x86/kernel/ldt_32.c b/arch/x86/kernel/ldt_32.c
index e0b2d17f4f10..a8b18421863a 100644
--- a/arch/x86/kernel/ldt_32.c
+++ b/arch/x86/kernel/ldt_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/ldt.c
3 *
4 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds 2 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds
5 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 3 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
6 */ 4 */
diff --git a/arch/x86/kernel/ldt_64.c b/arch/x86/kernel/ldt_64.c
index bc9ffd5c19cc..3796523d616a 100644
--- a/arch/x86/kernel/ldt_64.c
+++ b/arch/x86/kernel/ldt_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/ldt.c
3 *
4 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds 2 * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds
5 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 3 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
6 * Copyright (C) 2002 Andi Kleen 4 * Copyright (C) 2002 Andi Kleen
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 91966bafb3dc..8459ca64bc2f 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel 2 * handle transition of Linux booting another kernel
3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com> 3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com>
4 * 4 *
5 * This source code is licensed under the GNU General Public License, 5 * This source code is licensed under the GNU General Public License,
@@ -10,6 +10,7 @@
10#include <linux/kexec.h> 10#include <linux/kexec.h>
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/numa.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
14#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
15#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
@@ -169,3 +170,15 @@ static int __init parse_crashkernel(char *arg)
169 return 0; 170 return 0;
170} 171}
171early_param("crashkernel", parse_crashkernel); 172early_param("crashkernel", parse_crashkernel);
173
174void arch_crash_save_vmcoreinfo(void)
175{
176#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
177 VMCOREINFO_SYMBOL(node_data);
178 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
179#endif
180#ifdef CONFIG_X86_PAE
181 VMCOREINFO_CONFIG(X86_PAE);
182#endif
183}
184
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index c3a554703672..7450b69710b5 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel 2 * handle transition of Linux booting another kernel
3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com> 3 * Copyright (C) 2002-2005 Eric Biederman <ebiederm@xmission.com>
4 * 4 *
5 * This source code is licensed under the GNU General Public License, 5 * This source code is licensed under the GNU General Public License,
@@ -10,6 +10,7 @@
10#include <linux/kexec.h> 10#include <linux/kexec.h>
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/reboot.h> 12#include <linux/reboot.h>
13#include <linux/numa.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
14#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
15#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
@@ -257,3 +258,11 @@ static int __init setup_crashkernel(char *arg)
257} 258}
258early_param("crashkernel", setup_crashkernel); 259early_param("crashkernel", setup_crashkernel);
259 260
261void arch_crash_save_vmcoreinfo(void)
262{
263#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
264 VMCOREINFO_SYMBOL(node_data);
265 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
266#endif
267}
268
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c
index b83672b89527..9482033ed0fe 100644
--- a/arch/x86/kernel/mca_32.c
+++ b/arch/x86/kernel/mca_32.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/mca.c
3 * Written by Martin Kolinek, February 1996 2 * Written by Martin Kolinek, February 1996
4 * 3 *
5 * Changes: 4 * Changes:
diff --git a/arch/x86/kernel/mce_64.c b/arch/x86/kernel/mce_64.c
index a66d607f5b92..97d2b757d6bd 100644
--- a/arch/x86/kernel/mce_64.c
+++ b/arch/x86/kernel/mce_64.c
@@ -76,9 +76,6 @@ void mce_log(struct mce *mce)
76 wmb(); 76 wmb();
77 for (;;) { 77 for (;;) {
78 entry = rcu_dereference(mcelog.next); 78 entry = rcu_dereference(mcelog.next);
79 /* The rmb forces the compiler to reload next in each
80 iteration */
81 rmb();
82 for (;;) { 79 for (;;) {
83 /* When the buffer fills up discard new entries. Assume 80 /* When the buffer fills up discard new entries. Assume
84 that the earlier errors are the more interesting. */ 81 that the earlier errors are the more interesting. */
diff --git a/arch/x86/kernel/mce_amd_64.c b/arch/x86/kernel/mce_amd_64.c
index 2f8a7f18b0fe..805b62b1e0df 100644
--- a/arch/x86/kernel/mce_amd_64.c
+++ b/arch/x86/kernel/mce_amd_64.c
@@ -472,7 +472,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
472 472
473#ifdef CONFIG_SMP 473#ifdef CONFIG_SMP
474 if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */ 474 if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */
475 i = first_cpu(cpu_core_map[cpu]); 475 i = first_cpu(per_cpu(cpu_core_map, cpu));
476 476
477 /* first core not up yet */ 477 /* first core not up yet */
478 if (cpu_data[i].cpu_core_id) 478 if (cpu_data[i].cpu_core_id)
@@ -492,7 +492,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
492 if (err) 492 if (err)
493 goto out; 493 goto out;
494 494
495 b->cpus = cpu_core_map[cpu]; 495 b->cpus = per_cpu(cpu_core_map, cpu);
496 per_cpu(threshold_banks, cpu)[bank] = b; 496 per_cpu(threshold_banks, cpu)[bank] = b;
497 goto out; 497 goto out;
498 } 498 }
@@ -509,7 +509,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
509#ifndef CONFIG_SMP 509#ifndef CONFIG_SMP
510 b->cpus = CPU_MASK_ALL; 510 b->cpus = CPU_MASK_ALL;
511#else 511#else
512 b->cpus = cpu_core_map[cpu]; 512 b->cpus = per_cpu(cpu_core_map, cpu);
513#endif 513#endif
514 err = kobject_register(&b->kobj); 514 err = kobject_register(&b->kobj);
515 if (err) 515 if (err)
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 0c1069b8d638..c044de310b69 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -11,8 +11,6 @@
11 * ----------------------------------------------------------------------- */ 11 * ----------------------------------------------------------------------- */
12 12
13/* 13/*
14 * msr.c
15 *
16 * x86 MSR access device 14 * x86 MSR access device
17 * 15 *
18 * This device is accessed by lseek() to the appropriate register number 16 * This device is accessed by lseek() to the appropriate register number
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 95d3fc203cf7..f803ed0ed1c4 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/nmi.c
3 *
4 * NMI watchdog support on APIC systems 2 * NMI watchdog support on APIC systems
5 * 3 *
6 * Started by Ingo Molnar <mingo@redhat.com> 4 * Started by Ingo Molnar <mingo@redhat.com>
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index e60ac0da5283..a576fd740062 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/nmi.c
3 *
4 * NMI watchdog support on APIC systems 2 * NMI watchdog support on APIC systems
5 * 3 *
6 * Started by Ingo Molnar <mingo@redhat.com> 4 * Started by Ingo Molnar <mingo@redhat.com>
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 71da01e73f03..a50b787b3bfa 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -35,6 +35,7 @@
35#include <linux/pci_ids.h> 35#include <linux/pci_ids.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/scatterlist.h>
38#include <asm/iommu.h> 39#include <asm/iommu.h>
39#include <asm/calgary.h> 40#include <asm/calgary.h>
40#include <asm/tce.h> 41#include <asm/tce.h>
@@ -384,31 +385,32 @@ static void calgary_unmap_sg(struct device *dev,
384 struct scatterlist *sglist, int nelems, int direction) 385 struct scatterlist *sglist, int nelems, int direction)
385{ 386{
386 struct iommu_table *tbl = find_iommu_table(dev); 387 struct iommu_table *tbl = find_iommu_table(dev);
388 struct scatterlist *s;
389 int i;
387 390
388 if (!translate_phb(to_pci_dev(dev))) 391 if (!translate_phb(to_pci_dev(dev)))
389 return; 392 return;
390 393
391 while (nelems--) { 394 for_each_sg(sglist, s, nelems, i) {
392 unsigned int npages; 395 unsigned int npages;
393 dma_addr_t dma = sglist->dma_address; 396 dma_addr_t dma = s->dma_address;
394 unsigned int dmalen = sglist->dma_length; 397 unsigned int dmalen = s->dma_length;
395 398
396 if (dmalen == 0) 399 if (dmalen == 0)
397 break; 400 break;
398 401
399 npages = num_dma_pages(dma, dmalen); 402 npages = num_dma_pages(dma, dmalen);
400 iommu_free(tbl, dma, npages); 403 iommu_free(tbl, dma, npages);
401 sglist++;
402 } 404 }
403} 405}
404 406
405static int calgary_nontranslate_map_sg(struct device* dev, 407static int calgary_nontranslate_map_sg(struct device* dev,
406 struct scatterlist *sg, int nelems, int direction) 408 struct scatterlist *sg, int nelems, int direction)
407{ 409{
410 struct scatterlist *s;
408 int i; 411 int i;
409 412
410 for (i = 0; i < nelems; i++ ) { 413 for_each_sg(sg, s, nelems, i) {
411 struct scatterlist *s = &sg[i];
412 BUG_ON(!s->page); 414 BUG_ON(!s->page);
413 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 415 s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
414 s->dma_length = s->length; 416 s->dma_length = s->length;
@@ -420,6 +422,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
420 int nelems, int direction) 422 int nelems, int direction)
421{ 423{
422 struct iommu_table *tbl = find_iommu_table(dev); 424 struct iommu_table *tbl = find_iommu_table(dev);
425 struct scatterlist *s;
423 unsigned long vaddr; 426 unsigned long vaddr;
424 unsigned int npages; 427 unsigned int npages;
425 unsigned long entry; 428 unsigned long entry;
@@ -428,8 +431,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
428 if (!translate_phb(to_pci_dev(dev))) 431 if (!translate_phb(to_pci_dev(dev)))
429 return calgary_nontranslate_map_sg(dev, sg, nelems, direction); 432 return calgary_nontranslate_map_sg(dev, sg, nelems, direction);
430 433
431 for (i = 0; i < nelems; i++ ) { 434 for_each_sg(sg, s, nelems, i) {
432 struct scatterlist *s = &sg[i];
433 BUG_ON(!s->page); 435 BUG_ON(!s->page);
434 436
435 vaddr = (unsigned long)page_address(s->page) + s->offset; 437 vaddr = (unsigned long)page_address(s->page) + s->offset;
@@ -454,9 +456,9 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
454 return nelems; 456 return nelems;
455error: 457error:
456 calgary_unmap_sg(dev, sg, nelems, direction); 458 calgary_unmap_sg(dev, sg, nelems, direction);
457 for (i = 0; i < nelems; i++) { 459 for_each_sg(sg, s, nelems, i) {
458 sg[i].dma_address = bad_dma_address; 460 sg->dma_address = bad_dma_address;
459 sg[i].dma_length = 0; 461 sg->dma_length = 0;
460 } 462 }
461 return 0; 463 return 0;
462} 464}
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 4918c575d582..cfcc84e6c350 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/kdebug.h> 25#include <linux/kdebug.h>
26#include <linux/scatterlist.h>
26#include <asm/atomic.h> 27#include <asm/atomic.h>
27#include <asm/io.h> 28#include <asm/io.h>
28#include <asm/mtrr.h> 29#include <asm/mtrr.h>
@@ -278,10 +279,10 @@ static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
278 */ 279 */
279static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) 280static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
280{ 281{
282 struct scatterlist *s;
281 int i; 283 int i;
282 284
283 for (i = 0; i < nents; i++) { 285 for_each_sg(sg, s, nents, i) {
284 struct scatterlist *s = &sg[i];
285 if (!s->dma_length || !s->length) 286 if (!s->dma_length || !s->length)
286 break; 287 break;
287 gart_unmap_single(dev, s->dma_address, s->dma_length, dir); 288 gart_unmap_single(dev, s->dma_address, s->dma_length, dir);
@@ -292,14 +293,14 @@ static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
292static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, 293static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
293 int nents, int dir) 294 int nents, int dir)
294{ 295{
296 struct scatterlist *s;
295 int i; 297 int i;
296 298
297#ifdef CONFIG_IOMMU_DEBUG 299#ifdef CONFIG_IOMMU_DEBUG
298 printk(KERN_DEBUG "dma_map_sg overflow\n"); 300 printk(KERN_DEBUG "dma_map_sg overflow\n");
299#endif 301#endif
300 302
301 for (i = 0; i < nents; i++ ) { 303 for_each_sg(sg, s, nents, i) {
302 struct scatterlist *s = &sg[i];
303 unsigned long addr = page_to_phys(s->page) + s->offset; 304 unsigned long addr = page_to_phys(s->page) + s->offset;
304 if (nonforced_iommu(dev, addr, s->length)) { 305 if (nonforced_iommu(dev, addr, s->length)) {
305 addr = dma_map_area(dev, addr, s->length, dir); 306 addr = dma_map_area(dev, addr, s->length, dir);
@@ -319,23 +320,23 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
319} 320}
320 321
321/* Map multiple scatterlist entries continuous into the first. */ 322/* Map multiple scatterlist entries continuous into the first. */
322static int __dma_map_cont(struct scatterlist *sg, int start, int stopat, 323static int __dma_map_cont(struct scatterlist *start, int nelems,
323 struct scatterlist *sout, unsigned long pages) 324 struct scatterlist *sout, unsigned long pages)
324{ 325{
325 unsigned long iommu_start = alloc_iommu(pages); 326 unsigned long iommu_start = alloc_iommu(pages);
326 unsigned long iommu_page = iommu_start; 327 unsigned long iommu_page = iommu_start;
328 struct scatterlist *s;
327 int i; 329 int i;
328 330
329 if (iommu_start == -1) 331 if (iommu_start == -1)
330 return -1; 332 return -1;
331 333
332 for (i = start; i < stopat; i++) { 334 for_each_sg(start, s, nelems, i) {
333 struct scatterlist *s = &sg[i];
334 unsigned long pages, addr; 335 unsigned long pages, addr;
335 unsigned long phys_addr = s->dma_address; 336 unsigned long phys_addr = s->dma_address;
336 337
337 BUG_ON(i > start && s->offset); 338 BUG_ON(s != start && s->offset);
338 if (i == start) { 339 if (s == start) {
339 *sout = *s; 340 *sout = *s;
340 sout->dma_address = iommu_bus_base; 341 sout->dma_address = iommu_bus_base;
341 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 342 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
@@ -357,17 +358,17 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
357 return 0; 358 return 0;
358} 359}
359 360
360static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat, 361static inline int dma_map_cont(struct scatterlist *start, int nelems,
361 struct scatterlist *sout, 362 struct scatterlist *sout,
362 unsigned long pages, int need) 363 unsigned long pages, int need)
363{ 364{
364 if (!need) { 365 if (!need) {
365 BUG_ON(stopat - start != 1); 366 BUG_ON(nelems != 1);
366 *sout = sg[start]; 367 *sout = *start;
367 sout->dma_length = sg[start].length; 368 sout->dma_length = start->length;
368 return 0; 369 return 0;
369 } 370 }
370 return __dma_map_cont(sg, start, stopat, sout, pages); 371 return __dma_map_cont(start, nelems, sout, pages);
371} 372}
372 373
373/* 374/*
@@ -381,6 +382,7 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
381 int start; 382 int start;
382 unsigned long pages = 0; 383 unsigned long pages = 0;
383 int need = 0, nextneed; 384 int need = 0, nextneed;
385 struct scatterlist *s, *ps, *start_sg, *sgmap;
384 386
385 if (nents == 0) 387 if (nents == 0)
386 return 0; 388 return 0;
@@ -390,8 +392,9 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
390 392
391 out = 0; 393 out = 0;
392 start = 0; 394 start = 0;
393 for (i = 0; i < nents; i++) { 395 start_sg = sgmap = sg;
394 struct scatterlist *s = &sg[i]; 396 ps = NULL; /* shut up gcc */
397 for_each_sg(sg, s, nents, i) {
395 dma_addr_t addr = page_to_phys(s->page) + s->offset; 398 dma_addr_t addr = page_to_phys(s->page) + s->offset;
396 s->dma_address = addr; 399 s->dma_address = addr;
397 BUG_ON(s->length == 0); 400 BUG_ON(s->length == 0);
@@ -400,29 +403,33 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
400 403
401 /* Handle the previous not yet processed entries */ 404 /* Handle the previous not yet processed entries */
402 if (i > start) { 405 if (i > start) {
403 struct scatterlist *ps = &sg[i-1];
404 /* Can only merge when the last chunk ends on a page 406 /* Can only merge when the last chunk ends on a page
405 boundary and the new one doesn't have an offset. */ 407 boundary and the new one doesn't have an offset. */
406 if (!iommu_merge || !nextneed || !need || s->offset || 408 if (!iommu_merge || !nextneed || !need || s->offset ||
407 (ps->offset + ps->length) % PAGE_SIZE) { 409 (ps->offset + ps->length) % PAGE_SIZE) {
408 if (dma_map_cont(sg, start, i, sg+out, pages, 410 if (dma_map_cont(start_sg, i - start, sgmap,
409 need) < 0) 411 pages, need) < 0)
410 goto error; 412 goto error;
411 out++; 413 out++;
414 sgmap = sg_next(sgmap);
412 pages = 0; 415 pages = 0;
413 start = i; 416 start = i;
417 start_sg = s;
414 } 418 }
415 } 419 }
416 420
417 need = nextneed; 421 need = nextneed;
418 pages += to_pages(s->offset, s->length); 422 pages += to_pages(s->offset, s->length);
423 ps = s;
419 } 424 }
420 if (dma_map_cont(sg, start, i, sg+out, pages, need) < 0) 425 if (dma_map_cont(start_sg, i - start, sgmap, pages, need) < 0)
421 goto error; 426 goto error;
422 out++; 427 out++;
423 flush_gart(); 428 flush_gart();
424 if (out < nents) 429 if (out < nents) {
425 sg[out].dma_length = 0; 430 sgmap = sg_next(sgmap);
431 sgmap->dma_length = 0;
432 }
426 return out; 433 return out;
427 434
428error: 435error:
@@ -437,8 +444,8 @@ error:
437 if (panic_on_overflow) 444 if (panic_on_overflow)
438 panic("dma_map_sg: overflow on %lu pages\n", pages); 445 panic("dma_map_sg: overflow on %lu pages\n", pages);
439 iommu_full(dev, pages << PAGE_SHIFT, dir); 446 iommu_full(dev, pages << PAGE_SHIFT, dir);
440 for (i = 0; i < nents; i++) 447 for_each_sg(sg, s, nents, i)
441 sg[i].dma_address = bad_dma_address; 448 s->dma_address = bad_dma_address;
442 return 0; 449 return 0;
443} 450}
444 451
diff --git a/arch/x86/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index 2a34c6c025a9..e85d4360360c 100644
--- a/arch/x86/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
@@ -5,6 +5,7 @@
5#include <linux/pci.h> 5#include <linux/pci.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8#include <linux/scatterlist.h>
8 9
9#include <asm/iommu.h> 10#include <asm/iommu.h>
10#include <asm/processor.h> 11#include <asm/processor.h>
@@ -57,10 +58,10 @@ static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
57static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, 58static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
58 int nents, int direction) 59 int nents, int direction)
59{ 60{
61 struct scatterlist *s;
60 int i; 62 int i;
61 63
62 for (i = 0; i < nents; i++ ) { 64 for_each_sg(sg, s, nents, i) {
63 struct scatterlist *s = &sg[i];
64 BUG_ON(!s->page); 65 BUG_ON(!s->page);
65 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 66 s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
66 if (!check_addr("map_sg", hwdev, s->dma_address, s->length)) 67 if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 84664710b784..097aeafce5ff 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/process.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 6f9dbbe65eef..6309b275cb9c 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86-64/kernel/process.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
@@ -583,7 +581,7 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
583 * 581 *
584 * Kprobes not supported here. Set the probe on schedule instead. 582 * Kprobes not supported here. Set the probe on schedule instead.
585 */ 583 */
586__kprobes struct task_struct * 584struct task_struct *
587__switch_to(struct task_struct *prev_p, struct task_struct *next_p) 585__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
588{ 586{
589 struct thread_struct *prev = &prev_p->thread, 587 struct thread_struct *prev = &prev_p->thread,
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index 7c1b92522e95..8622b9cd3e38 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -1,4 +1,3 @@
1/* ptrace.c */
2/* By Ross Biro 1/23/92 */ 1/* By Ross Biro 1/23/92 */
3/* 2/*
4 * Pentium III FXSR, SSE support 3 * Pentium III FXSR, SSE support
@@ -525,11 +524,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
525 ret = 0; 524 ret = 0;
526 break; 525 break;
527 526
528 case PTRACE_DETACH:
529 /* detach a process that was attached. */
530 ret = ptrace_detach(child, data);
531 break;
532
533 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 527 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
534 if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) { 528 if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) {
535 ret = -EIO; 529 ret = -EIO;
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index eea3702427b4..86321ee6da93 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -1,4 +1,3 @@
1/* ptrace.c */
2/* By Ross Biro 1/23/92 */ 1/* By Ross Biro 1/23/92 */
3/* 2/*
4 * Pentium III FXSR, SSE support 3 * Pentium III FXSR, SSE support
@@ -501,11 +500,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
501 ret = 0; 500 ret = 0;
502 break; 501 break;
503 502
504 case PTRACE_DETACH:
505 /* detach a process that was attached. */
506 ret = ptrace_detach(child, data);
507 break;
508
509 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 503 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
510 if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, 504 if (!access_ok(VERIFY_WRITE, (unsigned __user *)data,
511 sizeof(struct user_regs_struct))) { 505 sizeof(struct user_regs_struct))) {
diff --git a/arch/x86/kernel/reboot_32.c b/arch/x86/kernel/reboot_32.c
index b37ed226830a..9e2269d00918 100644
--- a/arch/x86/kernel/reboot_32.c
+++ b/arch/x86/kernel/reboot_32.c
@@ -1,7 +1,3 @@
1/*
2 * linux/arch/i386/kernel/reboot.c
3 */
4
5#include <linux/mm.h> 1#include <linux/mm.h>
6#include <linux/module.h> 2#include <linux/module.h>
7#include <linux/delay.h> 3#include <linux/delay.h>
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 139eb03490f5..8b30b26ad069 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/reboot_fixups.c
3 *
4 * This is a good place to put board specific reboot fixups. 2 * This is a good place to put board specific reboot fixups.
5 * 3 *
6 * List of supported fixups: 4 * List of supported fixups:
diff --git a/arch/x86/kernel/scx200_32.c b/arch/x86/kernel/scx200_32.c
index c7d3df23f589..87bc159d29df 100644
--- a/arch/x86/kernel/scx200_32.c
+++ b/arch/x86/kernel/scx200_32.c
@@ -1,8 +1,8 @@
1/* linux/arch/i386/kernel/scx200.c 1/*
2 2 * Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
3 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> 3 *
4 4 * National Semiconductor SCx200 support.
5 National Semiconductor SCx200 support. */ 5 */
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
@@ -24,7 +24,7 @@ MODULE_DESCRIPTION("NatSemi SCx200 Driver");
24MODULE_LICENSE("GPL"); 24MODULE_LICENSE("GPL");
25 25
26unsigned scx200_gpio_base = 0; 26unsigned scx200_gpio_base = 0;
27long scx200_gpio_shadow[2]; 27unsigned long scx200_gpio_shadow[2];
28 28
29unsigned scx200_cb_base = 0; 29unsigned scx200_cb_base = 0;
30 30
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
index 1200aaac403e..ba9188235057 100644
--- a/arch/x86/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
@@ -11,7 +11,6 @@
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <asm/bootsetup.h>
15#include <asm/pda.h> 14#include <asm/pda.h>
16#include <asm/pgtable.h> 15#include <asm/pgtable.h>
17#include <asm/processor.h> 16#include <asm/processor.h>
@@ -23,8 +22,9 @@
23#include <asm/percpu.h> 22#include <asm/percpu.h>
24#include <asm/proto.h> 23#include <asm/proto.h>
25#include <asm/sections.h> 24#include <asm/sections.h>
25#include <asm/setup.h>
26 26
27char x86_boot_params[BOOT_PARAM_SIZE] __initdata; 27struct boot_params __initdata boot_params;
28 28
29cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 29cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
30 30
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index d474cd639bcb..b87a6fd5ba48 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * 3 *
6 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 4 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
@@ -139,10 +137,11 @@ EXPORT_SYMBOL(edd);
139 */ 137 */
140static inline void copy_edd(void) 138static inline void copy_edd(void)
141{ 139{
142 memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); 140 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
143 memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); 141 sizeof(edd.mbr_signature));
144 edd.mbr_signature_nr = EDD_MBR_SIG_NR; 142 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
145 edd.edd_info_nr = EDD_NR; 143 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
144 edd.edd_info_nr = boot_params.eddbuf_entries;
146} 145}
147#else 146#else
148static inline void copy_edd(void) 147static inline void copy_edd(void)
@@ -436,17 +435,20 @@ void __init setup_bootmem_allocator(void)
436#endif 435#endif
437 numa_kva_reserve(); 436 numa_kva_reserve();
438#ifdef CONFIG_BLK_DEV_INITRD 437#ifdef CONFIG_BLK_DEV_INITRD
439 if (LOADER_TYPE && INITRD_START) { 438 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
440 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 439 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
441 reserve_bootmem(INITRD_START, INITRD_SIZE); 440 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
442 initrd_start = INITRD_START + PAGE_OFFSET; 441 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
443 initrd_end = initrd_start+INITRD_SIZE; 442 unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
444 } 443
445 else { 444 if (ramdisk_end <= end_of_lowmem) {
445 reserve_bootmem(ramdisk_image, ramdisk_size);
446 initrd_start = ramdisk_image + PAGE_OFFSET;
447 initrd_end = initrd_start+ramdisk_size;
448 } else {
446 printk(KERN_ERR "initrd extends beyond end of memory " 449 printk(KERN_ERR "initrd extends beyond end of memory "
447 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 450 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
448 INITRD_START + INITRD_SIZE, 451 ramdisk_end, end_of_lowmem);
449 max_low_pfn << PAGE_SHIFT);
450 initrd_start = 0; 452 initrd_start = 0;
451 } 453 }
452 } 454 }
@@ -514,28 +516,29 @@ void __init setup_arch(char **cmdline_p)
514 * the system table is valid. If not, then initialize normally. 516 * the system table is valid. If not, then initialize normally.
515 */ 517 */
516#ifdef CONFIG_EFI 518#ifdef CONFIG_EFI
517 if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) 519 if ((boot_params.hdr.type_of_loader == 0x50) &&
520 boot_params.efi_info.efi_systab)
518 efi_enabled = 1; 521 efi_enabled = 1;
519#endif 522#endif
520 523
521 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 524 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
522 screen_info = SCREEN_INFO; 525 screen_info = boot_params.screen_info;
523 edid_info = EDID_INFO; 526 edid_info = boot_params.edid_info;
524 apm_info.bios = APM_BIOS_INFO; 527 apm_info.bios = boot_params.apm_bios_info;
525 ist_info = IST_INFO; 528 ist_info = boot_params.ist_info;
526 saved_videomode = VIDEO_MODE; 529 saved_videomode = boot_params.hdr.vid_mode;
527 if( SYS_DESC_TABLE.length != 0 ) { 530 if( boot_params.sys_desc_table.length != 0 ) {
528 set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); 531 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
529 machine_id = SYS_DESC_TABLE.table[0]; 532 machine_id = boot_params.sys_desc_table.table[0];
530 machine_submodel_id = SYS_DESC_TABLE.table[1]; 533 machine_submodel_id = boot_params.sys_desc_table.table[1];
531 BIOS_revision = SYS_DESC_TABLE.table[2]; 534 BIOS_revision = boot_params.sys_desc_table.table[2];
532 } 535 }
533 bootloader_type = LOADER_TYPE; 536 bootloader_type = boot_params.hdr.type_of_loader;
534 537
535#ifdef CONFIG_BLK_DEV_RAM 538#ifdef CONFIG_BLK_DEV_RAM
536 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 539 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
537 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 540 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
538 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); 541 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
539#endif 542#endif
540 ARCH_SETUP 543 ARCH_SETUP
541 if (efi_enabled) 544 if (efi_enabled)
@@ -547,7 +550,7 @@ void __init setup_arch(char **cmdline_p)
547 550
548 copy_edd(); 551 copy_edd();
549 552
550 if (!MOUNT_ROOT_RDONLY) 553 if (!boot_params.hdr.root_flags)
551 root_mountflags &= ~MS_RDONLY; 554 root_mountflags &= ~MS_RDONLY;
552 init_mm.start_code = (unsigned long) _text; 555 init_mm.start_code = (unsigned long) _text;
553 init_mm.end_code = (unsigned long) _etext; 556 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 32054bf5ba40..8159bf0be17a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -1,10 +1,5 @@
1/* 1/*
2 * linux/arch/x86-64/kernel/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 *
6 * Nov 2001 Dave Jones <davej@suse.de>
7 * Forked from i386 setup code.
8 */ 3 */
9 4
10/* 5/*
@@ -57,7 +52,6 @@
57#include <asm/dma.h> 52#include <asm/dma.h>
58#include <asm/mpspec.h> 53#include <asm/mpspec.h>
59#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
60#include <asm/bootsetup.h>
61#include <asm/proto.h> 55#include <asm/proto.h>
62#include <asm/setup.h> 56#include <asm/setup.h>
63#include <asm/mach_apic.h> 57#include <asm/mach_apic.h>
@@ -185,10 +179,11 @@ EXPORT_SYMBOL(edd);
185 */ 179 */
186static inline void copy_edd(void) 180static inline void copy_edd(void)
187{ 181{
188 memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); 182 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
189 memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); 183 sizeof(edd.mbr_signature));
190 edd.mbr_signature_nr = EDD_MBR_SIG_NR; 184 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
191 edd.edd_info_nr = EDD_NR; 185 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
186 edd.edd_info_nr = boot_params.eddbuf_entries;
192} 187}
193#else 188#else
194static inline void copy_edd(void) 189static inline void copy_edd(void)
@@ -225,21 +220,21 @@ void __init setup_arch(char **cmdline_p)
225{ 220{
226 printk(KERN_INFO "Command line: %s\n", boot_command_line); 221 printk(KERN_INFO "Command line: %s\n", boot_command_line);
227 222
228 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 223 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
229 screen_info = SCREEN_INFO; 224 screen_info = boot_params.screen_info;
230 edid_info = EDID_INFO; 225 edid_info = boot_params.edid_info;
231 saved_video_mode = SAVED_VIDEO_MODE; 226 saved_video_mode = boot_params.hdr.vid_mode;
232 bootloader_type = LOADER_TYPE; 227 bootloader_type = boot_params.hdr.type_of_loader;
233 228
234#ifdef CONFIG_BLK_DEV_RAM 229#ifdef CONFIG_BLK_DEV_RAM
235 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 230 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
236 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 231 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
237 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); 232 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
238#endif 233#endif
239 setup_memory_region(); 234 setup_memory_region();
240 copy_edd(); 235 copy_edd();
241 236
242 if (!MOUNT_ROOT_RDONLY) 237 if (!boot_params.hdr.root_flags)
243 root_mountflags &= ~MS_RDONLY; 238 root_mountflags &= ~MS_RDONLY;
244 init_mm.start_code = (unsigned long) &_text; 239 init_mm.start_code = (unsigned long) &_text;
245 init_mm.end_code = (unsigned long) &_etext; 240 init_mm.end_code = (unsigned long) &_etext;
@@ -344,17 +339,20 @@ void __init setup_arch(char **cmdline_p)
344 */ 339 */
345 find_smp_config(); 340 find_smp_config();
346#ifdef CONFIG_BLK_DEV_INITRD 341#ifdef CONFIG_BLK_DEV_INITRD
347 if (LOADER_TYPE && INITRD_START) { 342 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
348 if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { 343 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
349 reserve_bootmem_generic(INITRD_START, INITRD_SIZE); 344 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
350 initrd_start = INITRD_START + PAGE_OFFSET; 345 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
351 initrd_end = initrd_start+INITRD_SIZE; 346 unsigned long end_of_mem = end_pfn << PAGE_SHIFT;
352 } 347
353 else { 348 if (ramdisk_end <= end_of_mem) {
349 reserve_bootmem_generic(ramdisk_image, ramdisk_size);
350 initrd_start = ramdisk_image + PAGE_OFFSET;
351 initrd_end = initrd_start+ramdisk_size;
352 } else {
354 printk(KERN_ERR "initrd extends beyond end of memory " 353 printk(KERN_ERR "initrd extends beyond end of memory "
355 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 354 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
356 (unsigned long)(INITRD_START + INITRD_SIZE), 355 ramdisk_end, end_of_mem);
357 (unsigned long)(end_pfn << PAGE_SHIFT));
358 initrd_start = 0; 356 initrd_start = 0;
359 } 357 }
360 } 358 }
@@ -1075,7 +1073,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1075 if (smp_num_siblings * c->x86_max_cores > 1) { 1073 if (smp_num_siblings * c->x86_max_cores > 1) {
1076 int cpu = c - cpu_data; 1074 int cpu = c - cpu_data;
1077 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 1075 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
1078 seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); 1076 seq_printf(m, "siblings\t: %d\n",
1077 cpus_weight(per_cpu(cpu_core_map, cpu)));
1079 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); 1078 seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
1080 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); 1079 seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
1081 } 1080 }
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index c03570f7fe8e..d01d51fcce2a 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * 3 *
6 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson 4 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 739175b01e06..683802bec419 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs 3 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs
6 * 4 *
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index e4f61d1c6248..31fc08bd15ef 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -70,12 +70,12 @@ EXPORT_SYMBOL(smp_num_siblings);
70int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; 70int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
71 71
72/* representing HT siblings of each logical CPU */ 72/* representing HT siblings of each logical CPU */
73cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 73DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
74EXPORT_SYMBOL(cpu_sibling_map); 74EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
75 75
76/* representing HT and core siblings of each logical CPU */ 76/* representing HT and core siblings of each logical CPU */
77cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 77DEFINE_PER_CPU(cpumask_t, cpu_core_map);
78EXPORT_SYMBOL(cpu_core_map); 78EXPORT_PER_CPU_SYMBOL(cpu_core_map);
79 79
80/* bitmap of online cpus */ 80/* bitmap of online cpus */
81cpumask_t cpu_online_map __read_mostly; 81cpumask_t cpu_online_map __read_mostly;
@@ -300,7 +300,7 @@ cpumask_t cpu_coregroup_map(int cpu)
300 * And for power savings, we return cpu_core_map 300 * And for power savings, we return cpu_core_map
301 */ 301 */
302 if (sched_mc_power_savings || sched_smt_power_savings) 302 if (sched_mc_power_savings || sched_smt_power_savings)
303 return cpu_core_map[cpu]; 303 return per_cpu(cpu_core_map, cpu);
304 else 304 else
305 return c->llc_shared_map; 305 return c->llc_shared_map;
306} 306}
@@ -319,22 +319,22 @@ void __cpuinit set_cpu_sibling_map(int cpu)
319 for_each_cpu_mask(i, cpu_sibling_setup_map) { 319 for_each_cpu_mask(i, cpu_sibling_setup_map) {
320 if (c[cpu].phys_proc_id == c[i].phys_proc_id && 320 if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
321 c[cpu].cpu_core_id == c[i].cpu_core_id) { 321 c[cpu].cpu_core_id == c[i].cpu_core_id) {
322 cpu_set(i, cpu_sibling_map[cpu]); 322 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
323 cpu_set(cpu, cpu_sibling_map[i]); 323 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
324 cpu_set(i, cpu_core_map[cpu]); 324 cpu_set(i, per_cpu(cpu_core_map, cpu));
325 cpu_set(cpu, cpu_core_map[i]); 325 cpu_set(cpu, per_cpu(cpu_core_map, i));
326 cpu_set(i, c[cpu].llc_shared_map); 326 cpu_set(i, c[cpu].llc_shared_map);
327 cpu_set(cpu, c[i].llc_shared_map); 327 cpu_set(cpu, c[i].llc_shared_map);
328 } 328 }
329 } 329 }
330 } else { 330 } else {
331 cpu_set(cpu, cpu_sibling_map[cpu]); 331 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
332 } 332 }
333 333
334 cpu_set(cpu, c[cpu].llc_shared_map); 334 cpu_set(cpu, c[cpu].llc_shared_map);
335 335
336 if (current_cpu_data.x86_max_cores == 1) { 336 if (current_cpu_data.x86_max_cores == 1) {
337 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 337 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
338 c[cpu].booted_cores = 1; 338 c[cpu].booted_cores = 1;
339 return; 339 return;
340 } 340 }
@@ -346,17 +346,17 @@ void __cpuinit set_cpu_sibling_map(int cpu)
346 cpu_set(cpu, c[i].llc_shared_map); 346 cpu_set(cpu, c[i].llc_shared_map);
347 } 347 }
348 if (c[cpu].phys_proc_id == c[i].phys_proc_id) { 348 if (c[cpu].phys_proc_id == c[i].phys_proc_id) {
349 cpu_set(i, cpu_core_map[cpu]); 349 cpu_set(i, per_cpu(cpu_core_map, cpu));
350 cpu_set(cpu, cpu_core_map[i]); 350 cpu_set(cpu, per_cpu(cpu_core_map, i));
351 /* 351 /*
352 * Does this new cpu bringup a new core? 352 * Does this new cpu bringup a new core?
353 */ 353 */
354 if (cpus_weight(cpu_sibling_map[cpu]) == 1) { 354 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) {
355 /* 355 /*
356 * for each core in package, increment 356 * for each core in package, increment
357 * the booted_cores for this new cpu 357 * the booted_cores for this new cpu
358 */ 358 */
359 if (first_cpu(cpu_sibling_map[i]) == i) 359 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i)
360 c[cpu].booted_cores++; 360 c[cpu].booted_cores++;
361 /* 361 /*
362 * increment the core count for all 362 * increment the core count for all
@@ -983,8 +983,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
983 printk(KERN_NOTICE "Local APIC not detected." 983 printk(KERN_NOTICE "Local APIC not detected."
984 " Using dummy APIC emulation.\n"); 984 " Using dummy APIC emulation.\n");
985 map_cpu_to_logical_apicid(); 985 map_cpu_to_logical_apicid();
986 cpu_set(0, cpu_sibling_map[0]); 986 cpu_set(0, per_cpu(cpu_sibling_map, 0));
987 cpu_set(0, cpu_core_map[0]); 987 cpu_set(0, per_cpu(cpu_core_map, 0));
988 return; 988 return;
989 } 989 }
990 990
@@ -1008,8 +1008,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1008 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); 1008 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
1009 smpboot_clear_io_apic_irqs(); 1009 smpboot_clear_io_apic_irqs();
1010 phys_cpu_present_map = physid_mask_of_physid(0); 1010 phys_cpu_present_map = physid_mask_of_physid(0);
1011 cpu_set(0, cpu_sibling_map[0]); 1011 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1012 cpu_set(0, cpu_core_map[0]); 1012 cpu_set(0, per_cpu(cpu_core_map, 0));
1013 return; 1013 return;
1014 } 1014 }
1015 1015
@@ -1023,8 +1023,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1023 printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n"); 1023 printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n");
1024 smpboot_clear_io_apic_irqs(); 1024 smpboot_clear_io_apic_irqs();
1025 phys_cpu_present_map = physid_mask_of_physid(0); 1025 phys_cpu_present_map = physid_mask_of_physid(0);
1026 cpu_set(0, cpu_sibling_map[0]); 1026 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1027 cpu_set(0, cpu_core_map[0]); 1027 cpu_set(0, per_cpu(cpu_core_map, 0));
1028 return; 1028 return;
1029 } 1029 }
1030 1030
@@ -1102,16 +1102,16 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1102 Dprintk("Boot done.\n"); 1102 Dprintk("Boot done.\n");
1103 1103
1104 /* 1104 /*
1105 * construct cpu_sibling_map[], so that we can tell sibling CPUs 1105 * construct cpu_sibling_map, so that we can tell sibling CPUs
1106 * efficiently. 1106 * efficiently.
1107 */ 1107 */
1108 for (cpu = 0; cpu < NR_CPUS; cpu++) { 1108 for (cpu = 0; cpu < NR_CPUS; cpu++) {
1109 cpus_clear(cpu_sibling_map[cpu]); 1109 cpus_clear(per_cpu(cpu_sibling_map, cpu));
1110 cpus_clear(cpu_core_map[cpu]); 1110 cpus_clear(per_cpu(cpu_core_map, cpu));
1111 } 1111 }
1112 1112
1113 cpu_set(0, cpu_sibling_map[0]); 1113 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1114 cpu_set(0, cpu_core_map[0]); 1114 cpu_set(0, per_cpu(cpu_core_map, 0));
1115 1115
1116 smpboot_setup_io_apic(); 1116 smpboot_setup_io_apic();
1117 1117
@@ -1148,19 +1148,19 @@ void remove_siblinginfo(int cpu)
1148 int sibling; 1148 int sibling;
1149 struct cpuinfo_x86 *c = cpu_data; 1149 struct cpuinfo_x86 *c = cpu_data;
1150 1150
1151 for_each_cpu_mask(sibling, cpu_core_map[cpu]) { 1151 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
1152 cpu_clear(cpu, cpu_core_map[sibling]); 1152 cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
1153 /* 1153 /*/
1154 * last thread sibling in this cpu core going down 1154 * last thread sibling in this cpu core going down
1155 */ 1155 */
1156 if (cpus_weight(cpu_sibling_map[cpu]) == 1) 1156 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
1157 c[sibling].booted_cores--; 1157 c[sibling].booted_cores--;
1158 } 1158 }
1159 1159
1160 for_each_cpu_mask(sibling, cpu_sibling_map[cpu]) 1160 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
1161 cpu_clear(cpu, cpu_sibling_map[sibling]); 1161 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
1162 cpus_clear(cpu_sibling_map[cpu]); 1162 cpus_clear(per_cpu(cpu_sibling_map, cpu));
1163 cpus_clear(cpu_core_map[cpu]); 1163 cpus_clear(per_cpu(cpu_core_map, cpu));
1164 c[cpu].phys_proc_id = 0; 1164 c[cpu].phys_proc_id = 0;
1165 c[cpu].cpu_core_id = 0; 1165 c[cpu].cpu_core_id = 0;
1166 cpu_clear(cpu, cpu_sibling_setup_map); 1166 cpu_clear(cpu, cpu_sibling_setup_map);
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 57ccf7cb6b91..0faa0a0af272 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -91,12 +91,12 @@ EXPORT_SYMBOL(cpu_data);
91int smp_threads_ready; 91int smp_threads_ready;
92 92
93/* representing HT siblings of each logical CPU */ 93/* representing HT siblings of each logical CPU */
94cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 94DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
95EXPORT_SYMBOL(cpu_sibling_map); 95EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
96 96
97/* representing HT and core siblings of each logical CPU */ 97/* representing HT and core siblings of each logical CPU */
98cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 98DEFINE_PER_CPU(cpumask_t, cpu_core_map);
99EXPORT_SYMBOL(cpu_core_map); 99EXPORT_PER_CPU_SYMBOL(cpu_core_map);
100 100
101/* 101/*
102 * Trampoline 80x86 program as an array. 102 * Trampoline 80x86 program as an array.
@@ -243,7 +243,7 @@ cpumask_t cpu_coregroup_map(int cpu)
243 * And for power savings, we return cpu_core_map 243 * And for power savings, we return cpu_core_map
244 */ 244 */
245 if (sched_mc_power_savings || sched_smt_power_savings) 245 if (sched_mc_power_savings || sched_smt_power_savings)
246 return cpu_core_map[cpu]; 246 return per_cpu(cpu_core_map, cpu);
247 else 247 else
248 return c->llc_shared_map; 248 return c->llc_shared_map;
249} 249}
@@ -262,22 +262,22 @@ static inline void set_cpu_sibling_map(int cpu)
262 for_each_cpu_mask(i, cpu_sibling_setup_map) { 262 for_each_cpu_mask(i, cpu_sibling_setup_map) {
263 if (c[cpu].phys_proc_id == c[i].phys_proc_id && 263 if (c[cpu].phys_proc_id == c[i].phys_proc_id &&
264 c[cpu].cpu_core_id == c[i].cpu_core_id) { 264 c[cpu].cpu_core_id == c[i].cpu_core_id) {
265 cpu_set(i, cpu_sibling_map[cpu]); 265 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
266 cpu_set(cpu, cpu_sibling_map[i]); 266 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
267 cpu_set(i, cpu_core_map[cpu]); 267 cpu_set(i, per_cpu(cpu_core_map, cpu));
268 cpu_set(cpu, cpu_core_map[i]); 268 cpu_set(cpu, per_cpu(cpu_core_map, i));
269 cpu_set(i, c[cpu].llc_shared_map); 269 cpu_set(i, c[cpu].llc_shared_map);
270 cpu_set(cpu, c[i].llc_shared_map); 270 cpu_set(cpu, c[i].llc_shared_map);
271 } 271 }
272 } 272 }
273 } else { 273 } else {
274 cpu_set(cpu, cpu_sibling_map[cpu]); 274 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
275 } 275 }
276 276
277 cpu_set(cpu, c[cpu].llc_shared_map); 277 cpu_set(cpu, c[cpu].llc_shared_map);
278 278
279 if (current_cpu_data.x86_max_cores == 1) { 279 if (current_cpu_data.x86_max_cores == 1) {
280 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 280 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
281 c[cpu].booted_cores = 1; 281 c[cpu].booted_cores = 1;
282 return; 282 return;
283 } 283 }
@@ -289,17 +289,17 @@ static inline void set_cpu_sibling_map(int cpu)
289 cpu_set(cpu, c[i].llc_shared_map); 289 cpu_set(cpu, c[i].llc_shared_map);
290 } 290 }
291 if (c[cpu].phys_proc_id == c[i].phys_proc_id) { 291 if (c[cpu].phys_proc_id == c[i].phys_proc_id) {
292 cpu_set(i, cpu_core_map[cpu]); 292 cpu_set(i, per_cpu(cpu_core_map, cpu));
293 cpu_set(cpu, cpu_core_map[i]); 293 cpu_set(cpu, per_cpu(cpu_core_map, i));
294 /* 294 /*
295 * Does this new cpu bringup a new core? 295 * Does this new cpu bringup a new core?
296 */ 296 */
297 if (cpus_weight(cpu_sibling_map[cpu]) == 1) { 297 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) {
298 /* 298 /*
299 * for each core in package, increment 299 * for each core in package, increment
300 * the booted_cores for this new cpu 300 * the booted_cores for this new cpu
301 */ 301 */
302 if (first_cpu(cpu_sibling_map[i]) == i) 302 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i)
303 c[cpu].booted_cores++; 303 c[cpu].booted_cores++;
304 /* 304 /*
305 * increment the core count for all 305 * increment the core count for all
@@ -335,11 +335,6 @@ void __cpuinit start_secondary(void)
335 */ 335 */
336 check_tsc_sync_target(); 336 check_tsc_sync_target();
337 337
338 Dprintk("cpu %d: setting up apic clock\n", smp_processor_id());
339 setup_secondary_APIC_clock();
340
341 Dprintk("cpu %d: enabling apic timer\n", smp_processor_id());
342
343 if (nmi_watchdog == NMI_IO_APIC) { 338 if (nmi_watchdog == NMI_IO_APIC) {
344 disable_8259A_irq(0); 339 disable_8259A_irq(0);
345 enable_NMI_through_LVT0(NULL); 340 enable_NMI_through_LVT0(NULL);
@@ -374,6 +369,8 @@ void __cpuinit start_secondary(void)
374 369
375 unlock_ipi_call_lock(); 370 unlock_ipi_call_lock();
376 371
372 setup_secondary_APIC_clock();
373
377 cpu_idle(); 374 cpu_idle();
378} 375}
379 376
@@ -738,8 +735,8 @@ static __init void disable_smp(void)
738 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); 735 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
739 else 736 else
740 phys_cpu_present_map = physid_mask_of_physid(0); 737 phys_cpu_present_map = physid_mask_of_physid(0);
741 cpu_set(0, cpu_sibling_map[0]); 738 cpu_set(0, per_cpu(cpu_sibling_map, 0));
742 cpu_set(0, cpu_core_map[0]); 739 cpu_set(0, per_cpu(cpu_core_map, 0));
743} 740}
744 741
745#ifdef CONFIG_HOTPLUG_CPU 742#ifdef CONFIG_HOTPLUG_CPU
@@ -974,19 +971,19 @@ static void remove_siblinginfo(int cpu)
974 int sibling; 971 int sibling;
975 struct cpuinfo_x86 *c = cpu_data; 972 struct cpuinfo_x86 *c = cpu_data;
976 973
977 for_each_cpu_mask(sibling, cpu_core_map[cpu]) { 974 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
978 cpu_clear(cpu, cpu_core_map[sibling]); 975 cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
979 /* 976 /*
980 * last thread sibling in this cpu core going down 977 * last thread sibling in this cpu core going down
981 */ 978 */
982 if (cpus_weight(cpu_sibling_map[cpu]) == 1) 979 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
983 c[sibling].booted_cores--; 980 c[sibling].booted_cores--;
984 } 981 }
985 982
986 for_each_cpu_mask(sibling, cpu_sibling_map[cpu]) 983 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
987 cpu_clear(cpu, cpu_sibling_map[sibling]); 984 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
988 cpus_clear(cpu_sibling_map[cpu]); 985 cpus_clear(per_cpu(cpu_sibling_map, cpu));
989 cpus_clear(cpu_core_map[cpu]); 986 cpus_clear(per_cpu(cpu_core_map, cpu));
990 c[cpu].phys_proc_id = 0; 987 c[cpu].phys_proc_id = 0;
991 c[cpu].cpu_core_id = 0; 988 c[cpu].cpu_core_id = 0;
992 cpu_clear(cpu, cpu_sibling_setup_map); 989 cpu_clear(cpu, cpu_sibling_setup_map);
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index cb9109113584..413e527cdeb9 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/x86_64/kernel/stacktrace.c
3 *
4 * Stack trace management functions 2 * Stack trace management functions
5 * 3 *
6 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index d0e01a3acf35..91c7acc8d999 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/i386/kernel/summit.c - IBM Summit-Specific Code 2 * IBM Summit-Specific Code
3 * 3 *
4 * Written By: Matthew Dobson, IBM Corporation 4 * Written By: Matthew Dobson, IBM Corporation
5 * 5 *
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index 42147304de88..a86d26f036e1 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/sys_i386.c
3 *
4 * This file contains various random system calls that 2 * This file contains various random system calls that
5 * have a non-standard calling sequence on the Linux/i386 3 * have a non-standard calling sequence on the Linux/i386
6 * platform. 4 * platform.
@@ -19,10 +17,10 @@
19#include <linux/mman.h> 17#include <linux/mman.h>
20#include <linux/file.h> 18#include <linux/file.h>
21#include <linux/utsname.h> 19#include <linux/utsname.h>
20#include <linux/ipc.h>
22 21
23#include <asm/uaccess.h> 22#include <asm/uaccess.h>
24#include <asm/unistd.h> 23#include <asm/unistd.h>
25#include <asm/ipc.h>
26 24
27/* 25/*
28 * sys_pipe() is the normal C calling standard for creating 26 * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 4770b7a2052c..907942ee6e76 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -1,7 +1,3 @@
1/*
2 * linux/arch/x86_64/kernel/sys_x86_64.c
3 */
4
5#include <linux/errno.h> 1#include <linux/errno.h>
6#include <linux/sched.h> 2#include <linux/sched.h>
7#include <linux/syscalls.h> 3#include <linux/syscalls.h>
diff --git a/arch/x86/kernel/sysenter_32.c b/arch/x86/kernel/sysenter_32.c
index 4eb2e408764f..5a2d951e2608 100644
--- a/arch/x86/kernel/sysenter_32.c
+++ b/arch/x86/kernel/sysenter_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/sysenter.c
3 *
4 * (C) Copyright 2002 Linus Torvalds 2 * (C) Copyright 2002 Linus Torvalds
5 * Portions based on the vdso-randomization code from exec-shield: 3 * Portions based on the vdso-randomization code from exec-shield:
6 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar 4 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 56dadfc2f41c..8a322c96bc23 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 2 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * 3 *
6 * This file contains the PC-specific time handling details: 4 * This file contains the PC-specific time handling details:
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index e0134d6c88da..c821edc32216 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86-64/kernel/time.c
3 *
4 * "High Precision Event Timer" based timekeeping. 2 * "High Precision Event Timer" based timekeeping.
5 * 3 *
6 * Copyright (c) 1991,1992,1995 Linus Torvalds 4 * Copyright (c) 1991,1992,1995 Linus Torvalds
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 45782356a618..c25f23eb397c 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/i386/kernel/topology.c - Populate sysfs with topology information 2 * Populate sysfs 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
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 47b0bef335bd..05c27ecaf2a7 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/i386/traps.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * 3 *
6 * Pentium III FXSR, SSE support 4 * Pentium III FXSR, SSE support
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 03888420775d..bc7116acf8ff 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86-64/traps.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs 3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
6 * 4 *
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index 3ed0ae8c918d..b85ad754f70e 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -1,9 +1,3 @@
1/*
2 * This code largely moved from arch/i386/kernel/timer/timer_tsc.c
3 * which was originally moved from arch/i386/kernel/time.c.
4 * See comments there for proper credits.
5 */
6
7#include <linux/sched.h> 1#include <linux/sched.h>
8#include <linux/clocksource.h> 2#include <linux/clocksource.h>
9#include <linux/workqueue.h> 3#include <linux/workqueue.h>
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 355f5f506c81..9125efe66a06 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/x86_64/kernel/tsc_sync.c: check TSC synchronization. 2 * check TSC synchronization.
3 * 3 *
4 * Copyright (C) 2006, Red Hat, Inc., Ingo Molnar 4 * Copyright (C) 2006, Red Hat, Inc., Ingo Molnar
5 * 5 *
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index f2dcd1d27c0a..157e4bedd3c5 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/kernel/vm86.c
3 *
4 * Copyright (C) 1994 Linus Torvalds 2 * Copyright (C) 1994 Linus Torvalds
5 * 3 *
6 * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86 4 * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 06c34949bfdc..93847d848157 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/x86_64/kernel/vsyscall.c
3 *
4 * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE 2 * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE
5 * Copyright 2003 Andi Kleen, SuSE Labs. 3 * Copyright 2003 Andi Kleen, SuSE Labs.
6 * 4 *
diff --git a/arch/x86/lib/copy_user_nocache_64.S b/arch/x86/lib/copy_user_nocache_64.S
index 4620efb12f13..5196762b3b0e 100644
--- a/arch/x86/lib/copy_user_nocache_64.S
+++ b/arch/x86/lib/copy_user_nocache_64.S
@@ -117,6 +117,7 @@ ENTRY(__copy_user_nocache)
117 popq %rbx 117 popq %rbx
118 CFI_ADJUST_CFA_OFFSET -8 118 CFI_ADJUST_CFA_OFFSET -8
119 CFI_RESTORE rbx 119 CFI_RESTORE rbx
120 sfence
120 ret 121 ret
121 CFI_RESTORE_STATE 122 CFI_RESTORE_STATE
122 123
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S
index 55e586d352d3..6ea73f3de567 100644
--- a/arch/x86/lib/thunk_64.S
+++ b/arch/x86/lib/thunk_64.S
@@ -50,6 +50,10 @@
50 thunk trace_hardirqs_on_thunk,trace_hardirqs_on 50 thunk trace_hardirqs_on_thunk,trace_hardirqs_on
51 thunk trace_hardirqs_off_thunk,trace_hardirqs_off 51 thunk trace_hardirqs_off_thunk,trace_hardirqs_off
52#endif 52#endif
53
54#ifdef CONFIG_DEBUG_LOCK_ALLOC
55 thunk lockdep_sys_exit_thunk,lockdep_sys_exit
56#endif
53 57
54 /* SAVE_ARGS below is used only for the .cfi directives it contains. */ 58 /* SAVE_ARGS below is used only for the .cfi directives it contains. */
55 CFI_STARTPROC 59 CFI_STARTPROC
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index 7f635c7a2381..1bd82983986d 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -159,16 +159,18 @@ char * __init machine_specific_memory_setup(void)
159 * Otherwise fake a memory map; one section from 0k->640k, 159 * Otherwise fake a memory map; one section from 0k->640k,
160 * the next section from 1mb->appropriate_mem_k 160 * the next section from 1mb->appropriate_mem_k
161 */ 161 */
162 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 162 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
163 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 163 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
164 < 0) {
164 unsigned long mem_size; 165 unsigned long mem_size;
165 166
166 /* compare results from other methods and take the greater */ 167 /* compare results from other methods and take the greater */
167 if (ALT_MEM_K < EXT_MEM_K) { 168 if (boot_params.alt_mem_k
168 mem_size = EXT_MEM_K; 169 < boot_params.screen_info.ext_mem_k) {
170 mem_size = boot_params.screen_info.ext_mem_k;
169 who = "BIOS-88"; 171 who = "BIOS-88";
170 } else { 172 } else {
171 mem_size = ALT_MEM_K; 173 mem_size = boot_params.alt_mem_k;
172 who = "BIOS-e801"; 174 who = "BIOS-e801";
173 } 175 }
174 176
diff --git a/arch/x86/mach-visws/setup.c b/arch/x86/mach-visws/setup.c
index 1f81f10e03a0..de4c9dbd086f 100644
--- a/arch/x86/mach-visws/setup.c
+++ b/arch/x86/mach-visws/setup.c
@@ -152,7 +152,7 @@ char * __init machine_specific_memory_setup(void)
152{ 152{
153 long long gfx_mem_size = 8 * MB; 153 long long gfx_mem_size = 8 * MB;
154 154
155 mem_size = ALT_MEM_K; 155 mem_size = boot_params.alt_mem_k;
156 156
157 if (!mem_size) { 157 if (!mem_size) {
158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n"); 158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index 2b55694e6400..a0ab4002abcd 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -83,7 +83,7 @@ char * __init machine_specific_memory_setup(void)
83 83
84 if(inb(catbase) != VOYAGER_DINO) { 84 if(inb(catbase) != VOYAGER_DINO) {
85 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); 85 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
86 tom = (EXT_MEM_K)<<10; 86 tom = (boot_params.screen_info.ext_mem_k)<<10;
87 } 87 }
88 who = "Voyager-TOM"; 88 who = "Voyager-TOM";
89 add_memory_region(0, 0x9f000, E820_RAM); 89 add_memory_region(0, 0x9f000, E820_RAM);
@@ -104,16 +104,18 @@ char * __init machine_specific_memory_setup(void)
104 * Otherwise fake a memory map; one section from 0k->640k, 104 * Otherwise fake a memory map; one section from 0k->640k,
105 * the next section from 1mb->appropriate_mem_k 105 * the next section from 1mb->appropriate_mem_k
106 */ 106 */
107 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 107 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
108 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 108 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
109 < 0) {
109 unsigned long mem_size; 110 unsigned long mem_size;
110 111
111 /* compare results from other methods and take the greater */ 112 /* compare results from other methods and take the greater */
112 if (ALT_MEM_K < EXT_MEM_K) { 113 if (boot_params.alt_mem_k
113 mem_size = EXT_MEM_K; 114 < boot_params.screen_info.ext_mem_k) {
115 mem_size = boot_params.screen_info.ext_mem_k;
114 who = "BIOS-88"; 116 who = "BIOS-88";
115 } else { 117 } else {
116 mem_size = ALT_MEM_K; 118 mem_size = boot_params.alt_mem_k;
117 who = "BIOS-e801"; 119 who = "BIOS-e801";
118 } 120 }
119 121
diff --git a/arch/x86/math-emu/Makefile b/arch/x86/math-emu/Makefile
index 9c943fa6ce6b..9b0c63b60302 100644
--- a/arch/x86/math-emu/Makefile
+++ b/arch/x86/math-emu/Makefile
@@ -5,8 +5,7 @@
5#DEBUG = -DDEBUGGING 5#DEBUG = -DDEBUGGING
6DEBUG = 6DEBUG =
7PARANOID = -DPARANOID 7PARANOID = -DPARANOID
8CFLAGS := $(CFLAGS) $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION) 8EXTRA_CFLAGS := $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION)
9
10EXTRA_AFLAGS := $(PARANOID) 9EXTRA_AFLAGS := $(PARANOID)
11 10
12# From 'C' language sources: 11# From 'C' language sources:
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 860e912a3fbb..b1e45457d4ef 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -288,8 +288,9 @@ unsigned long __init setup_memory(void)
288 288
289#ifdef CONFIG_BLK_DEV_INITRD 289#ifdef CONFIG_BLK_DEV_INITRD
290 /* Numa kva area is below the initrd */ 290 /* Numa kva area is below the initrd */
291 if (LOADER_TYPE && INITRD_START) 291 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image)
292 kva_start_pfn = PFN_DOWN(INITRD_START) - kva_pages; 292 kva_start_pfn = PFN_DOWN(boot_params.hdr.ramdisk_image)
293 - kva_pages;
293#endif 294#endif
294 kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1); 295 kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1);
295 296
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index fcb38e7f3543..c686ae20fd6b 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -25,6 +25,7 @@
25#include <linux/kprobes.h> 25#include <linux/kprobes.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
28 29
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/desc.h> 31#include <asm/desc.h>
@@ -32,33 +33,27 @@
32 33
33extern void die(const char *,struct pt_regs *,long); 34extern void die(const char *,struct pt_regs *,long);
34 35
35static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 36#ifdef CONFIG_KPROBES
36 37static inline int notify_page_fault(struct pt_regs *regs)
37int register_page_fault_notifier(struct notifier_block *nb)
38{ 38{
39 vmalloc_sync_all(); 39 int ret = 0;
40 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 40
41} 41 /* kprobe_running() needs smp_processor_id() */
42EXPORT_SYMBOL_GPL(register_page_fault_notifier); 42 if (!user_mode_vm(regs)) {
43 preempt_disable();
44 if (kprobe_running() && kprobe_fault_handler(regs, 14))
45 ret = 1;
46 preempt_enable();
47 }
43 48
44int unregister_page_fault_notifier(struct notifier_block *nb) 49 return ret;
45{
46 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
47} 50}
48EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 51#else
49 52static inline int notify_page_fault(struct pt_regs *regs)
50static inline int notify_page_fault(struct pt_regs *regs, long err)
51{ 53{
52 struct die_args args = { 54 return 0;
53 .regs = regs,
54 .str = "page fault",
55 .err = err,
56 .trapnr = 14,
57 .signr = SIGSEGV
58 };
59 return atomic_notifier_call_chain(&notify_page_fault_chain,
60 DIE_PAGE_FAULT, &args);
61} 55}
56#endif
62 57
63/* 58/*
64 * Return EIP plus the CS segment base. The segment limit is also 59 * Return EIP plus the CS segment base. The segment limit is also
@@ -331,7 +326,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
331 if (unlikely(address >= TASK_SIZE)) { 326 if (unlikely(address >= TASK_SIZE)) {
332 if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0) 327 if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
333 return; 328 return;
334 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 329 if (notify_page_fault(regs))
335 return; 330 return;
336 /* 331 /*
337 * Don't take the mm semaphore here. If we fixup a prefetch 332 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -340,7 +335,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
340 goto bad_area_nosemaphore; 335 goto bad_area_nosemaphore;
341 } 336 }
342 337
343 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 338 if (notify_page_fault(regs))
344 return; 339 return;
345 340
346 /* It's safe to allow irq's after cr2 has been saved and the vmalloc 341 /* It's safe to allow irq's after cr2 has been saved and the vmalloc
@@ -598,7 +593,7 @@ out_of_memory:
598 } 593 }
599 printk("VM: killing process %s\n", tsk->comm); 594 printk("VM: killing process %s\n", tsk->comm);
600 if (error_code & 4) 595 if (error_code & 4)
601 do_exit(SIGKILL); 596 do_group_exit(SIGKILL);
602 goto no_context; 597 goto no_context;
603 598
604do_sigbus: 599do_sigbus:
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index 54816adb8e93..5e0e54906c48 100644
--- a/arch/x86/mm/fault_64.c
+++ b/arch/x86/mm/fault_64.c
@@ -25,6 +25,7 @@
25#include <linux/kprobes.h> 25#include <linux/kprobes.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
28 29
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/pgalloc.h> 31#include <asm/pgalloc.h>
@@ -40,34 +41,27 @@
40#define PF_RSVD (1<<3) 41#define PF_RSVD (1<<3)
41#define PF_INSTR (1<<4) 42#define PF_INSTR (1<<4)
42 43
43static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 44#ifdef CONFIG_KPROBES
44 45static inline int notify_page_fault(struct pt_regs *regs)
45/* Hook to register for page fault notifications */
46int register_page_fault_notifier(struct notifier_block *nb)
47{ 46{
48 vmalloc_sync_all(); 47 int ret = 0;
49 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 48
50} 49 /* kprobe_running() needs smp_processor_id() */
51EXPORT_SYMBOL_GPL(register_page_fault_notifier); 50 if (!user_mode(regs)) {
51 preempt_disable();
52 if (kprobe_running() && kprobe_fault_handler(regs, 14))
53 ret = 1;
54 preempt_enable();
55 }
52 56
53int unregister_page_fault_notifier(struct notifier_block *nb) 57 return ret;
54{
55 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
56} 58}
57EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 59#else
58 60static inline int notify_page_fault(struct pt_regs *regs)
59static inline int notify_page_fault(struct pt_regs *regs, long err)
60{ 61{
61 struct die_args args = { 62 return 0;
62 .regs = regs,
63 .str = "page fault",
64 .err = err,
65 .trapnr = 14,
66 .signr = SIGSEGV
67 };
68 return atomic_notifier_call_chain(&notify_page_fault_chain,
69 DIE_PAGE_FAULT, &args);
70} 63}
64#endif
71 65
72/* Sometimes the CPU reports invalid exceptions on prefetch. 66/* Sometimes the CPU reports invalid exceptions on prefetch.
73 Check that here and ignore. 67 Check that here and ignore.
@@ -345,7 +339,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
345 if (vmalloc_fault(address) >= 0) 339 if (vmalloc_fault(address) >= 0)
346 return; 340 return;
347 } 341 }
348 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 342 if (notify_page_fault(regs))
349 return; 343 return;
350 /* 344 /*
351 * Don't take the mm semaphore here. If we fixup a prefetch 345 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -354,7 +348,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
354 goto bad_area_nosemaphore; 348 goto bad_area_nosemaphore;
355 } 349 }
356 350
357 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 351 if (notify_page_fault(regs))
358 return; 352 return;
359 353
360 if (likely(regs->eflags & X86_EFLAGS_IF)) 354 if (likely(regs->eflags & X86_EFLAGS_IF))
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index aa4708fda3e2..33d367a3432e 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -735,11 +735,6 @@ int arch_add_memory(int nid, u64 start, u64 size)
735 return __add_pages(zone, start_pfn, nr_pages); 735 return __add_pages(zone, start_pfn, nr_pages);
736} 736}
737 737
738int remove_memory(u64 start, u64 size)
739{
740 return -EINVAL;
741}
742EXPORT_SYMBOL_GPL(remove_memory);
743#endif 738#endif
744 739
745struct kmem_cache *pmd_cache; 740struct kmem_cache *pmd_cache;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 458893b376f8..1e3862e41065 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -474,12 +474,6 @@ error:
474} 474}
475EXPORT_SYMBOL_GPL(arch_add_memory); 475EXPORT_SYMBOL_GPL(arch_add_memory);
476 476
477int remove_memory(u64 start, u64 size)
478{
479 return -EINVAL;
480}
481EXPORT_SYMBOL_GPL(remove_memory);
482
483#if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA) 477#if !defined(CONFIG_ACPI_NUMA) && defined(CONFIG_NUMA)
484int memory_add_physaddr_to_nid(u64 start) 478int memory_add_physaddr_to_nid(u64 start)
485{ 479{
@@ -748,3 +742,48 @@ const char *arch_vma_name(struct vm_area_struct *vma)
748 return "[vsyscall]"; 742 return "[vsyscall]";
749 return NULL; 743 return NULL;
750} 744}
745
746#ifdef CONFIG_SPARSEMEM_VMEMMAP
747/*
748 * Initialise the sparsemem vmemmap using huge-pages at the PMD level.
749 */
750int __meminit vmemmap_populate(struct page *start_page,
751 unsigned long size, int node)
752{
753 unsigned long addr = (unsigned long)start_page;
754 unsigned long end = (unsigned long)(start_page + size);
755 unsigned long next;
756 pgd_t *pgd;
757 pud_t *pud;
758 pmd_t *pmd;
759
760 for (; addr < end; addr = next) {
761 next = pmd_addr_end(addr, end);
762
763 pgd = vmemmap_pgd_populate(addr, node);
764 if (!pgd)
765 return -ENOMEM;
766 pud = vmemmap_pud_populate(pgd, addr, node);
767 if (!pud)
768 return -ENOMEM;
769
770 pmd = pmd_offset(pud, addr);
771 if (pmd_none(*pmd)) {
772 pte_t entry;
773 void *p = vmemmap_alloc_block(PMD_SIZE, node);
774 if (!p)
775 return -ENOMEM;
776
777 entry = pfn_pte(__pa(p) >> PAGE_SHIFT, PAGE_KERNEL);
778 mk_pte_huge(entry);
779 set_pmd(pmd, __pmd(pte_val(entry)));
780
781 printk(KERN_DEBUG " [%lx-%lx] PMD ->%p on node %d\n",
782 addr, addr + PMD_SIZE - 1, p, node);
783 } else
784 vmemmap_verify((pte_t *)pmd, node, addr, next);
785 }
786
787 return 0;
788}
789#endif
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 01437c46baae..ef1f6cd3ea66 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -193,7 +193,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
193 return pte; 193 return pte;
194} 194}
195 195
196void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags) 196void pmd_ctor(struct kmem_cache *cache, void *pmd)
197{ 197{
198 memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); 198 memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
199} 199}
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 47925927b12f..56b4757a1f47 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -379,7 +379,7 @@ static unsigned int get_stagger(void)
379{ 379{
380#ifdef CONFIG_SMP 380#ifdef CONFIG_SMP
381 int cpu = smp_processor_id(); 381 int cpu = smp_processor_id();
382 return (cpu != first_cpu(cpu_sibling_map[cpu])); 382 return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu)));
383#endif 383#endif
384 return 0; 384 return 0;
385} 385}
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 27a391da9a98..2d88f7c6d6ac 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -6,7 +6,7 @@
6#include <asm/numa.h> 6#include <asm/numa.h>
7#include "pci.h" 7#include "pci.h"
8 8
9static int __devinit can_skip_ioresource_align(struct dmi_system_id *d) 9static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
10{ 10{
11 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; 11 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
12 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident); 12 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 8d03de029d9b..dcd6bb9e0bb3 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -34,8 +34,8 @@ $(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE
34 34
35CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64 35CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64
36 36
37$(obj)/vclock_gettime.o: CFLAGS = $(CFL) 37$(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL)
38$(obj)/vgetcpu.o: CFLAGS = $(CFL) 38$(obj)/vgetcpu.o: KBUILD_CFLAGS = $(CFL)
39 39
40# We also create a special relocatable object that should mirror the symbol 40# We also create a special relocatable object that should mirror the symbol
41# table and layout of the linked DSO. With ld -R we can then refer to 41# table and layout of the linked DSO. With ld -R we can then refer to
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c89e5b407f90..94c39aaf695f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1188,9 +1188,10 @@ asmlinkage void __init xen_start_kernel(void)
1188 new_cpu_data.x86_capability[0] = cpuid_edx(1); 1188 new_cpu_data.x86_capability[0] = cpuid_edx(1);
1189 1189
1190 /* Poke various useful things into boot_params */ 1190 /* Poke various useful things into boot_params */
1191 LOADER_TYPE = (9 << 4) | 0; 1191 boot_params.hdr.type_of_loader = (9 << 4) | 0;
1192 INITRD_START = xen_start_info->mod_start ? __pa(xen_start_info->mod_start) : 0; 1192 boot_params.hdr.ramdisk_image = xen_start_info->mod_start
1193 INITRD_SIZE = xen_start_info->mod_len; 1193 ? __pa(xen_start_info->mod_start) : 0;
1194 boot_params.hdr.ramdisk_size = xen_start_info->mod_len;
1194 1195
1195 /* Start the world */ 1196 /* Start the world */
1196 start_kernel(); 1197 start_kernel();
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 865953e6f341..d53bf9d8a72d 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -147,8 +147,13 @@ void __init xen_smp_prepare_boot_cpu(void)
147 make_lowmem_page_readwrite(&per_cpu__gdt_page); 147 make_lowmem_page_readwrite(&per_cpu__gdt_page);
148 148
149 for (cpu = 0; cpu < NR_CPUS; cpu++) { 149 for (cpu = 0; cpu < NR_CPUS; cpu++) {
150 cpus_clear(cpu_sibling_map[cpu]); 150 cpus_clear(per_cpu(cpu_sibling_map, cpu));
151 cpus_clear(cpu_core_map[cpu]); 151 /*
152 * cpu_core_map lives in a per cpu area that is cleared
153 * when the per cpu array is allocated.
154 *
155 * cpus_clear(per_cpu(cpu_core_map, cpu));
156 */
152 } 157 }
153 158
154 xen_setup_vcpu_info_placement(); 159 xen_setup_vcpu_info_placement();
@@ -159,8 +164,13 @@ void __init xen_smp_prepare_cpus(unsigned int max_cpus)
159 unsigned cpu; 164 unsigned cpu;
160 165
161 for (cpu = 0; cpu < NR_CPUS; cpu++) { 166 for (cpu = 0; cpu < NR_CPUS; cpu++) {
162 cpus_clear(cpu_sibling_map[cpu]); 167 cpus_clear(per_cpu(cpu_sibling_map, cpu));
163 cpus_clear(cpu_core_map[cpu]); 168 /*
169 * cpu_core_ map will be zeroed when the per
170 * cpu area is allocated.
171 *
172 * cpus_clear(per_cpu(cpu_core_map, cpu));
173 */
164 } 174 }
165 175
166 smp_store_cpu_info(0); 176 smp_store_cpu_info(0);