diff options
Diffstat (limited to 'include/asm-x86_64')
43 files changed, 397 insertions, 418 deletions
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index 2c95a319c056..ed59aa4c6ff9 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h | |||
@@ -155,8 +155,6 @@ extern void acpi_reserve_bootmem(void); | |||
155 | 155 | ||
156 | #endif /*CONFIG_ACPI_SLEEP*/ | 156 | #endif /*CONFIG_ACPI_SLEEP*/ |
157 | 157 | ||
158 | #define boot_cpu_physical_apicid boot_cpu_id | ||
159 | |||
160 | extern int acpi_disabled; | 158 | extern int acpi_disabled; |
161 | extern int acpi_pci_disabled; | 159 | extern int acpi_pci_disabled; |
162 | 160 | ||
diff --git a/include/asm-x86_64/alternative-asm.i b/include/asm-x86_64/alternative-asm.i new file mode 100644 index 000000000000..e4041f4fa4dc --- /dev/null +++ b/include/asm-x86_64/alternative-asm.i | |||
@@ -0,0 +1,14 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
3 | #ifdef CONFIG_SMP | ||
4 | .macro LOCK_PREFIX | ||
5 | 1: lock | ||
6 | .section .smp_locks,"a" | ||
7 | .align 8 | ||
8 | .quad 1b | ||
9 | .previous | ||
10 | .endm | ||
11 | #else | ||
12 | .macro LOCK_PREFIX | ||
13 | .endm | ||
14 | #endif | ||
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index 9c96a0a8d1bd..9e66d32330c9 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h | |||
@@ -17,6 +17,8 @@ | |||
17 | 17 | ||
18 | extern int apic_verbosity; | 18 | extern int apic_verbosity; |
19 | extern int apic_runs_main_timer; | 19 | extern int apic_runs_main_timer; |
20 | extern int ioapic_force; | ||
21 | extern int apic_mapped; | ||
20 | 22 | ||
21 | /* | 23 | /* |
22 | * Define the default level of output to be very little | 24 | * Define the default level of output to be very little |
@@ -29,8 +31,6 @@ extern int apic_runs_main_timer; | |||
29 | printk(s, ##a); \ | 31 | printk(s, ##a); \ |
30 | } while (0) | 32 | } while (0) |
31 | 33 | ||
32 | #ifdef CONFIG_X86_LOCAL_APIC | ||
33 | |||
34 | struct pt_regs; | 34 | struct pt_regs; |
35 | 35 | ||
36 | /* | 36 | /* |
@@ -95,17 +95,12 @@ extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector, | |||
95 | #define K8_APIC_EXT_INT_MSG_EXT 0x7 | 95 | #define K8_APIC_EXT_INT_MSG_EXT 0x7 |
96 | #define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 | 96 | #define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 |
97 | 97 | ||
98 | extern int disable_timer_pin_1; | ||
99 | |||
100 | |||
101 | void smp_send_timer_broadcast_ipi(void); | 98 | void smp_send_timer_broadcast_ipi(void); |
102 | void switch_APIC_timer_to_ipi(void *cpumask); | 99 | void switch_APIC_timer_to_ipi(void *cpumask); |
103 | void switch_ipi_to_APIC_timer(void *cpumask); | 100 | void switch_ipi_to_APIC_timer(void *cpumask); |
104 | 101 | ||
105 | #define ARCH_APICTIMER_STOPS_ON_C3 1 | 102 | #define ARCH_APICTIMER_STOPS_ON_C3 1 |
106 | 103 | ||
107 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
108 | |||
109 | extern unsigned boot_cpu_id; | 104 | extern unsigned boot_cpu_id; |
110 | 105 | ||
111 | #endif /* __ASM_APIC_H */ | 106 | #endif /* __ASM_APIC_H */ |
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index f7ba57b1cc08..5b535eaf5309 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -399,6 +399,8 @@ static __inline__ int fls(int x) | |||
399 | return r+1; | 399 | return r+1; |
400 | } | 400 | } |
401 | 401 | ||
402 | #define ARCH_HAS_FAST_MULTIPLIER 1 | ||
403 | |||
402 | #include <asm-generic/bitops/hweight.h> | 404 | #include <asm-generic/bitops/hweight.h> |
403 | 405 | ||
404 | #endif /* __KERNEL__ */ | 406 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h index 4e3919524240..6b93f5a3a5c8 100644 --- a/include/asm-x86_64/calgary.h +++ b/include/asm-x86_64/calgary.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _ASM_X86_64_CALGARY_H | 24 | #ifndef _ASM_X86_64_CALGARY_H |
25 | #define _ASM_X86_64_CALGARY_H | 25 | #define _ASM_X86_64_CALGARY_H |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
29 | #include <linux/device.h> | 28 | #include <linux/device.h> |
30 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
@@ -34,12 +33,12 @@ struct iommu_table { | |||
34 | unsigned long it_base; /* mapped address of tce table */ | 33 | unsigned long it_base; /* mapped address of tce table */ |
35 | unsigned long it_hint; /* Hint for next alloc */ | 34 | unsigned long it_hint; /* Hint for next alloc */ |
36 | unsigned long *it_map; /* A simple allocation bitmap for now */ | 35 | unsigned long *it_map; /* A simple allocation bitmap for now */ |
36 | void __iomem *bbar; /* Bridge BAR */ | ||
37 | u64 tar_val; /* Table Address Register */ | ||
38 | struct timer_list watchdog_timer; | ||
37 | spinlock_t it_lock; /* Protects it_map */ | 39 | spinlock_t it_lock; /* Protects it_map */ |
38 | unsigned int it_size; /* Size of iommu table in entries */ | 40 | unsigned int it_size; /* Size of iommu table in entries */ |
39 | unsigned char it_busno; /* Bus number this table belongs to */ | 41 | unsigned char it_busno; /* Bus number this table belongs to */ |
40 | void __iomem *bbar; | ||
41 | u64 tar_val; | ||
42 | struct timer_list watchdog_timer; | ||
43 | }; | 42 | }; |
44 | 43 | ||
45 | #define TCE_TABLE_SIZE_UNSPECIFIED ~0 | 44 | #define TCE_TABLE_SIZE_UNSPECIFIED ~0 |
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h index 0744db777676..eedc08526b0b 100644 --- a/include/asm-x86_64/dwarf2.h +++ b/include/asm-x86_64/dwarf2.h | |||
@@ -13,7 +13,7 @@ | |||
13 | away for older version. | 13 | away for older version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifdef CONFIG_UNWIND_INFO | 16 | #ifdef CONFIG_AS_CFI |
17 | 17 | ||
18 | #define CFI_STARTPROC .cfi_startproc | 18 | #define CFI_STARTPROC .cfi_startproc |
19 | #define CFI_ENDPROC .cfi_endproc | 19 | #define CFI_ENDPROC .cfi_endproc |
@@ -28,6 +28,11 @@ | |||
28 | #define CFI_REMEMBER_STATE .cfi_remember_state | 28 | #define CFI_REMEMBER_STATE .cfi_remember_state |
29 | #define CFI_RESTORE_STATE .cfi_restore_state | 29 | #define CFI_RESTORE_STATE .cfi_restore_state |
30 | #define CFI_UNDEFINED .cfi_undefined | 30 | #define CFI_UNDEFINED .cfi_undefined |
31 | #ifdef CONFIG_AS_CFI_SIGNAL_FRAME | ||
32 | #define CFI_SIGNAL_FRAME .cfi_signal_frame | ||
33 | #else | ||
34 | #define CFI_SIGNAL_FRAME | ||
35 | #endif | ||
31 | 36 | ||
32 | #else | 37 | #else |
33 | 38 | ||
@@ -45,6 +50,7 @@ | |||
45 | #define CFI_REMEMBER_STATE # | 50 | #define CFI_REMEMBER_STATE # |
46 | #define CFI_RESTORE_STATE # | 51 | #define CFI_RESTORE_STATE # |
47 | #define CFI_UNDEFINED # | 52 | #define CFI_UNDEFINED # |
53 | #define CFI_SIGNAL_FRAME # | ||
48 | 54 | ||
49 | #endif | 55 | #endif |
50 | 56 | ||
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h index f65674832318..e15d3c8628f3 100644 --- a/include/asm-x86_64/e820.h +++ b/include/asm-x86_64/e820.h | |||
@@ -19,13 +19,9 @@ | |||
19 | 19 | ||
20 | #define E820_RAM 1 | 20 | #define E820_RAM 1 |
21 | #define E820_RESERVED 2 | 21 | #define E820_RESERVED 2 |
22 | #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ | 22 | #define E820_ACPI 3 |
23 | #define E820_NVS 4 | 23 | #define E820_NVS 4 |
24 | 24 | ||
25 | #define HIGH_MEMORY (1024*1024) | ||
26 | |||
27 | #define LOWMEMSIZE() (0x9f000) | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
30 | struct e820entry { | 26 | struct e820entry { |
31 | u64 addr; /* start of memory segment */ | 27 | u64 addr; /* start of memory segment */ |
@@ -56,8 +52,7 @@ extern void e820_setup_gap(void); | |||
56 | extern unsigned long e820_hole_size(unsigned long start_pfn, | 52 | extern unsigned long e820_hole_size(unsigned long start_pfn, |
57 | unsigned long end_pfn); | 53 | unsigned long end_pfn); |
58 | 54 | ||
59 | extern void __init parse_memopt(char *p, char **end); | 55 | extern void finish_e820_parsing(void); |
60 | extern void __init parse_memmapopt(char *p, char **end); | ||
61 | 56 | ||
62 | extern struct e820map e820; | 57 | extern struct e820map e820; |
63 | 58 | ||
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h index 0b4ffbd1a125..1b620db5b9e3 100644 --- a/include/asm-x86_64/fixmap.h +++ b/include/asm-x86_64/fixmap.h | |||
@@ -37,13 +37,9 @@ enum fixed_addresses { | |||
37 | VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, | 37 | VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, |
38 | VSYSCALL_HPET, | 38 | VSYSCALL_HPET, |
39 | FIX_HPET_BASE, | 39 | FIX_HPET_BASE, |
40 | #ifdef CONFIG_X86_LOCAL_APIC | ||
41 | FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ | 40 | FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ |
42 | #endif | ||
43 | #ifdef CONFIG_X86_IO_APIC | ||
44 | FIX_IO_APIC_BASE_0, | 41 | FIX_IO_APIC_BASE_0, |
45 | FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, | 42 | FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, |
46 | #endif | ||
47 | __end_of_fixed_addresses | 43 | __end_of_fixed_addresses |
48 | }; | 44 | }; |
49 | 45 | ||
diff --git a/include/asm-x86_64/genapic.h b/include/asm-x86_64/genapic.h index 50b38e7c58e4..81e714665344 100644 --- a/include/asm-x86_64/genapic.h +++ b/include/asm-x86_64/genapic.h | |||
@@ -16,7 +16,6 @@ struct genapic { | |||
16 | char *name; | 16 | char *name; |
17 | u32 int_delivery_mode; | 17 | u32 int_delivery_mode; |
18 | u32 int_dest_mode; | 18 | u32 int_dest_mode; |
19 | u32 int_delivery_dest; /* for quick IPIs */ | ||
20 | int (*apic_id_registered)(void); | 19 | int (*apic_id_registered)(void); |
21 | cpumask_t (*target_cpus)(void); | 20 | cpumask_t (*target_cpus)(void); |
22 | void (*init_apic_ldr)(void); | 21 | void (*init_apic_ldr)(void); |
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h index cba8a3b0cded..0217b74cc9fc 100644 --- a/include/asm-x86_64/i387.h +++ b/include/asm-x86_64/i387.h | |||
@@ -24,6 +24,7 @@ extern unsigned int mxcsr_feature_mask; | |||
24 | extern void mxcsr_feature_mask_init(void); | 24 | extern void mxcsr_feature_mask_init(void); |
25 | extern void init_fpu(struct task_struct *child); | 25 | extern void init_fpu(struct task_struct *child); |
26 | extern int save_i387(struct _fpstate __user *buf); | 26 | extern int save_i387(struct _fpstate __user *buf); |
27 | extern asmlinkage void math_state_restore(void); | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * FPU lazy state save handling... | 30 | * FPU lazy state save handling... |
@@ -31,7 +32,9 @@ extern int save_i387(struct _fpstate __user *buf); | |||
31 | 32 | ||
32 | #define unlazy_fpu(tsk) do { \ | 33 | #define unlazy_fpu(tsk) do { \ |
33 | if (task_thread_info(tsk)->status & TS_USEDFPU) \ | 34 | if (task_thread_info(tsk)->status & TS_USEDFPU) \ |
34 | save_init_fpu(tsk); \ | 35 | save_init_fpu(tsk); \ |
36 | else \ | ||
37 | tsk->fpu_counter = 0; \ | ||
35 | } while (0) | 38 | } while (0) |
36 | 39 | ||
37 | /* Ignore delayed exceptions from user space */ | 40 | /* Ignore delayed exceptions from user space */ |
@@ -134,8 +137,8 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | |||
134 | #else | 137 | #else |
135 | : [fx] "cdaSDb" (fx), "0" (0)); | 138 | : [fx] "cdaSDb" (fx), "0" (0)); |
136 | #endif | 139 | #endif |
137 | if (unlikely(err)) | 140 | if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct))) |
138 | __clear_user(fx, sizeof(struct i387_fxsave_struct)); | 141 | err = -EFAULT; |
139 | /* No need to clear here because the caller clears USED_MATH */ | 142 | /* No need to clear here because the caller clears USED_MATH */ |
140 | return err; | 143 | return err; |
141 | } | 144 | } |
diff --git a/include/asm-x86_64/intel_arch_perfmon.h b/include/asm-x86_64/intel_arch_perfmon.h index 59c396431569..8633331420ec 100644 --- a/include/asm-x86_64/intel_arch_perfmon.h +++ b/include/asm-x86_64/intel_arch_perfmon.h | |||
@@ -14,6 +14,18 @@ | |||
14 | 14 | ||
15 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) | 15 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) |
16 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) | 16 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) |
17 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) | 17 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) |
18 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ | ||
19 | (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) | ||
20 | |||
21 | union cpuid10_eax { | ||
22 | struct { | ||
23 | unsigned int version_id:8; | ||
24 | unsigned int num_counters:8; | ||
25 | unsigned int bit_width:8; | ||
26 | unsigned int mask_length:8; | ||
27 | } split; | ||
28 | unsigned int full; | ||
29 | }; | ||
18 | 30 | ||
19 | #endif /* X86_64_INTEL_ARCH_PERFMON_H */ | 31 | #endif /* X86_64_INTEL_ARCH_PERFMON_H */ |
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h index fb7a0909a174..5d1b5c68e36e 100644 --- a/include/asm-x86_64/io_apic.h +++ b/include/asm-x86_64/io_apic.h | |||
@@ -10,8 +10,6 @@ | |||
10 | * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar | 10 | * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifdef CONFIG_X86_IO_APIC | ||
14 | |||
15 | #ifdef CONFIG_PCI_MSI | 13 | #ifdef CONFIG_PCI_MSI |
16 | static inline int use_pci_vector(void) {return 1;} | 14 | static inline int use_pci_vector(void) {return 1;} |
17 | static inline void disable_edge_ioapic_vector(unsigned int vector) { } | 15 | static inline void disable_edge_ioapic_vector(unsigned int vector) { } |
@@ -209,10 +207,6 @@ extern int timer_uses_ioapic_pin_0; | |||
209 | 207 | ||
210 | extern int sis_apic_bug; /* dummy */ | 208 | extern int sis_apic_bug; /* dummy */ |
211 | 209 | ||
212 | #else /* !CONFIG_X86_IO_APIC */ | ||
213 | #define io_apic_assign_pci_irqs 0 | ||
214 | #endif | ||
215 | |||
216 | extern int assign_irq_vector(int irq); | 210 | extern int assign_irq_vector(int irq); |
217 | 211 | ||
218 | void enable_NMI_through_LVT0 (void * dummy); | 212 | void enable_NMI_through_LVT0 (void * dummy); |
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index 9db5a1b4f7b1..43469d8ab71a 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h | |||
@@ -44,9 +44,7 @@ static __inline__ int irq_canonicalize(int irq) | |||
44 | return ((irq == 2) ? 9 : irq); | 44 | return ((irq == 2) ? 9 : irq); |
45 | } | 45 | } |
46 | 46 | ||
47 | #ifdef CONFIG_X86_LOCAL_APIC | ||
48 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ | 47 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ |
49 | #endif | ||
50 | 48 | ||
51 | #ifdef CONFIG_HOTPLUG_CPU | 49 | #ifdef CONFIG_HOTPLUG_CPU |
52 | #include <linux/cpumask.h> | 50 | #include <linux/cpumask.h> |
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h index c564bae03433..5fab957e1091 100644 --- a/include/asm-x86_64/kexec.h +++ b/include/asm-x86_64/kexec.h | |||
@@ -1,6 +1,27 @@ | |||
1 | #ifndef _X86_64_KEXEC_H | 1 | #ifndef _X86_64_KEXEC_H |
2 | #define _X86_64_KEXEC_H | 2 | #define _X86_64_KEXEC_H |
3 | 3 | ||
4 | #define PA_CONTROL_PAGE 0 | ||
5 | #define VA_CONTROL_PAGE 1 | ||
6 | #define PA_PGD 2 | ||
7 | #define VA_PGD 3 | ||
8 | #define PA_PUD_0 4 | ||
9 | #define VA_PUD_0 5 | ||
10 | #define PA_PMD_0 6 | ||
11 | #define VA_PMD_0 7 | ||
12 | #define PA_PTE_0 8 | ||
13 | #define VA_PTE_0 9 | ||
14 | #define PA_PUD_1 10 | ||
15 | #define VA_PUD_1 11 | ||
16 | #define PA_PMD_1 12 | ||
17 | #define VA_PMD_1 13 | ||
18 | #define PA_PTE_1 14 | ||
19 | #define VA_PTE_1 15 | ||
20 | #define PA_TABLE_PAGE 16 | ||
21 | #define PAGES_NR 17 | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | ||
24 | |||
4 | #include <linux/string.h> | 25 | #include <linux/string.h> |
5 | 26 | ||
6 | #include <asm/page.h> | 27 | #include <asm/page.h> |
@@ -64,4 +85,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs, | |||
64 | newregs->rip = (unsigned long)current_text_addr(); | 85 | newregs->rip = (unsigned long)current_text_addr(); |
65 | } | 86 | } |
66 | } | 87 | } |
88 | |||
89 | NORET_TYPE void | ||
90 | relocate_kernel(unsigned long indirection_page, | ||
91 | unsigned long page_list, | ||
92 | unsigned long start_address) ATTRIB_NORET; | ||
93 | |||
94 | #endif /* __ASSEMBLY__ */ | ||
95 | |||
67 | #endif /* _X86_64_KEXEC_H */ | 96 | #endif /* _X86_64_KEXEC_H */ |
diff --git a/include/asm-x86_64/linkage.h b/include/asm-x86_64/linkage.h index 291c2d01c44f..b5f39d0189ce 100644 --- a/include/asm-x86_64/linkage.h +++ b/include/asm-x86_64/linkage.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | 1 | #ifndef __ASM_LINKAGE_H |
2 | #define __ASM_LINKAGE_H | 2 | #define __ASM_LINKAGE_H |
3 | 3 | ||
4 | /* Nothing to see here... */ | 4 | #define __ALIGN .p2align 4,,15 |
5 | 5 | ||
6 | #endif | 6 | #endif |
diff --git a/include/asm-x86_64/mach_apic.h b/include/asm-x86_64/mach_apic.h index 0acea44c9377..d33422450c00 100644 --- a/include/asm-x86_64/mach_apic.h +++ b/include/asm-x86_64/mach_apic.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | 17 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) |
18 | #define INT_DEST_MODE (genapic->int_dest_mode) | 18 | #define INT_DEST_MODE (genapic->int_dest_mode) |
19 | #define INT_DELIVERY_DEST (genapic->int_delivery_dest) | ||
20 | #define TARGET_CPUS (genapic->target_cpus()) | 19 | #define TARGET_CPUS (genapic->target_cpus()) |
21 | #define apic_id_registered (genapic->apic_id_registered) | 20 | #define apic_id_registered (genapic->apic_id_registered) |
22 | #define init_apic_ldr (genapic->init_apic_ldr) | 21 | #define init_apic_ldr (genapic->init_apic_ldr) |
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h index d13687dfd691..5a11146d6d9c 100644 --- a/include/asm-x86_64/mce.h +++ b/include/asm-x86_64/mce.h | |||
@@ -99,6 +99,8 @@ static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) | |||
99 | } | 99 | } |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | void mce_log_therm_throt_event(unsigned int cpu, __u64 status); | ||
103 | |||
102 | extern atomic_t mce_entry; | 104 | extern atomic_t mce_entry; |
103 | 105 | ||
104 | #endif | 106 | #endif |
diff --git a/include/asm-x86_64/mmx.h b/include/asm-x86_64/mmx.h deleted file mode 100644 index 46b71da99869..000000000000 --- a/include/asm-x86_64/mmx.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #ifndef _ASM_MMX_H | ||
2 | #define _ASM_MMX_H | ||
3 | |||
4 | /* | ||
5 | * MMX 3Dnow! helper operations | ||
6 | */ | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | |||
10 | extern void *_mmx_memcpy(void *to, const void *from, size_t size); | ||
11 | extern void mmx_clear_page(void *page); | ||
12 | extern void mmx_copy_page(void *to, void *from); | ||
13 | |||
14 | #endif | ||
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 14fc3ddd9031..017fddb61dc5 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h | |||
@@ -159,13 +159,7 @@ struct mpc_config_lintsrc | |||
159 | #define MAX_MP_BUSSES 256 | 159 | #define MAX_MP_BUSSES 256 |
160 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ | 160 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ |
161 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) | 161 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) |
162 | enum mp_bustype { | 162 | extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); |
163 | MP_BUS_ISA = 1, | ||
164 | MP_BUS_EISA, | ||
165 | MP_BUS_PCI, | ||
166 | MP_BUS_MCA | ||
167 | }; | ||
168 | extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES]; | ||
169 | extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; | 163 | extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; |
170 | 164 | ||
171 | extern unsigned int boot_cpu_physical_apicid; | 165 | extern unsigned int boot_cpu_physical_apicid; |
@@ -178,18 +172,15 @@ extern int mp_irq_entries; | |||
178 | extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; | 172 | extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; |
179 | extern int mpc_default_type; | 173 | extern int mpc_default_type; |
180 | extern unsigned long mp_lapic_addr; | 174 | extern unsigned long mp_lapic_addr; |
181 | extern int pic_mode; | ||
182 | 175 | ||
183 | #ifdef CONFIG_ACPI | 176 | #ifdef CONFIG_ACPI |
184 | extern void mp_register_lapic (u8 id, u8 enabled); | 177 | extern void mp_register_lapic (u8 id, u8 enabled); |
185 | extern void mp_register_lapic_address (u64 address); | 178 | extern void mp_register_lapic_address (u64 address); |
186 | 179 | ||
187 | #ifdef CONFIG_X86_IO_APIC | ||
188 | extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); | 180 | extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); |
189 | extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); | 181 | extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); |
190 | extern void mp_config_acpi_legacy_irqs (void); | 182 | extern void mp_config_acpi_legacy_irqs (void); |
191 | extern int mp_register_gsi (u32 gsi, int triggering, int polarity); | 183 | extern int mp_register_gsi (u32 gsi, int triggering, int polarity); |
192 | #endif /*CONFIG_X86_IO_APIC*/ | ||
193 | #endif | 184 | #endif |
194 | 185 | ||
195 | extern int using_apic_timer; | 186 | extern int using_apic_timer; |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 10f8b51cec8b..37e194169fac 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -66,14 +66,25 @@ | |||
66 | #define rdtscl(low) \ | 66 | #define rdtscl(low) \ |
67 | __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") | 67 | __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") |
68 | 68 | ||
69 | #define rdtscp(low,high,aux) \ | ||
70 | asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux)) | ||
71 | |||
69 | #define rdtscll(val) do { \ | 72 | #define rdtscll(val) do { \ |
70 | unsigned int __a,__d; \ | 73 | unsigned int __a,__d; \ |
71 | asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ | 74 | asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ |
72 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ | 75 | (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ |
73 | } while(0) | 76 | } while(0) |
74 | 77 | ||
78 | #define rdtscpll(val, aux) do { \ | ||
79 | unsigned long __a, __d; \ | ||
80 | asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \ | ||
81 | (val) = (__d << 32) | __a; \ | ||
82 | } while (0) | ||
83 | |||
75 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) | 84 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) |
76 | 85 | ||
86 | #define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0) | ||
87 | |||
77 | #define rdpmc(counter,low,high) \ | 88 | #define rdpmc(counter,low,high) \ |
78 | __asm__ __volatile__("rdpmc" \ | 89 | __asm__ __volatile__("rdpmc" \ |
79 | : "=a" (low), "=d" (high) \ | 90 | : "=a" (low), "=d" (high) \ |
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h index 06fab6de2a88..16396b1de3e4 100644 --- a/include/asm-x86_64/mutex.h +++ b/include/asm-x86_64/mutex.h | |||
@@ -25,13 +25,9 @@ do { \ | |||
25 | \ | 25 | \ |
26 | __asm__ __volatile__( \ | 26 | __asm__ __volatile__( \ |
27 | LOCK_PREFIX " decl (%%rdi) \n" \ | 27 | LOCK_PREFIX " decl (%%rdi) \n" \ |
28 | " js 2f \n" \ | 28 | " jns 1f \n" \ |
29 | "1: \n" \ | 29 | " call "#fail_fn" \n" \ |
30 | \ | 30 | "1:" \ |
31 | LOCK_SECTION_START("") \ | ||
32 | "2: call "#fail_fn" \n" \ | ||
33 | " jmp 1b \n" \ | ||
34 | LOCK_SECTION_END \ | ||
35 | \ | 31 | \ |
36 | :"=D" (dummy) \ | 32 | :"=D" (dummy) \ |
37 | : "D" (v) \ | 33 | : "D" (v) \ |
@@ -75,13 +71,9 @@ do { \ | |||
75 | \ | 71 | \ |
76 | __asm__ __volatile__( \ | 72 | __asm__ __volatile__( \ |
77 | LOCK_PREFIX " incl (%%rdi) \n" \ | 73 | LOCK_PREFIX " incl (%%rdi) \n" \ |
78 | " jle 2f \n" \ | 74 | " jg 1f \n" \ |
79 | "1: \n" \ | 75 | " call "#fail_fn" \n" \ |
80 | \ | 76 | "1: " \ |
81 | LOCK_SECTION_START("") \ | ||
82 | "2: call "#fail_fn" \n" \ | ||
83 | " jmp 1b \n" \ | ||
84 | LOCK_SECTION_END \ | ||
85 | \ | 77 | \ |
86 | :"=D" (dummy) \ | 78 | :"=D" (dummy) \ |
87 | : "D" (v) \ | 79 | : "D" (v) \ |
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h index efb45c894d76..cbf2669bca71 100644 --- a/include/asm-x86_64/nmi.h +++ b/include/asm-x86_64/nmi.h | |||
@@ -7,24 +7,13 @@ | |||
7 | #include <linux/pm.h> | 7 | #include <linux/pm.h> |
8 | #include <asm/io.h> | 8 | #include <asm/io.h> |
9 | 9 | ||
10 | struct pt_regs; | ||
11 | |||
12 | typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu); | ||
13 | |||
14 | /** | ||
15 | * set_nmi_callback | ||
16 | * | ||
17 | * Set a handler for an NMI. Only one handler may be | ||
18 | * set. Return 1 if the NMI was handled. | ||
19 | */ | ||
20 | void set_nmi_callback(nmi_callback_t callback); | ||
21 | |||
22 | /** | 10 | /** |
23 | * unset_nmi_callback | 11 | * do_nmi_callback |
24 | * | 12 | * |
25 | * Remove the handler previously set. | 13 | * Check to see if a callback exists and execute it. Return 1 |
14 | * if the handler exists and was handled successfully. | ||
26 | */ | 15 | */ |
27 | void unset_nmi_callback(void); | 16 | int do_nmi_callback(struct pt_regs *regs, int cpu); |
28 | 17 | ||
29 | #ifdef CONFIG_PM | 18 | #ifdef CONFIG_PM |
30 | 19 | ||
@@ -48,25 +37,32 @@ static inline void unset_nmi_pm_callback(struct pm_dev * dev) | |||
48 | #endif /* CONFIG_PM */ | 37 | #endif /* CONFIG_PM */ |
49 | 38 | ||
50 | extern void default_do_nmi(struct pt_regs *); | 39 | extern void default_do_nmi(struct pt_regs *); |
51 | extern void die_nmi(char *str, struct pt_regs *regs); | 40 | extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); |
52 | 41 | ||
53 | #define get_nmi_reason() inb(0x61) | 42 | #define get_nmi_reason() inb(0x61) |
54 | 43 | ||
55 | extern int panic_on_timeout; | 44 | extern int panic_on_timeout; |
56 | extern int unknown_nmi_panic; | 45 | extern int unknown_nmi_panic; |
46 | extern int nmi_watchdog_enabled; | ||
57 | 47 | ||
58 | extern int check_nmi_watchdog(void); | 48 | extern int check_nmi_watchdog(void); |
59 | 49 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); | |
60 | extern void setup_apic_nmi_watchdog (void); | 50 | extern int avail_to_resrv_perfctr_nmi(unsigned int); |
61 | extern int reserve_lapic_nmi(void); | 51 | extern int reserve_perfctr_nmi(unsigned int); |
62 | extern void release_lapic_nmi(void); | 52 | extern void release_perfctr_nmi(unsigned int); |
53 | extern int reserve_evntsel_nmi(unsigned int); | ||
54 | extern void release_evntsel_nmi(unsigned int); | ||
55 | |||
56 | extern void setup_apic_nmi_watchdog (void *); | ||
57 | extern void stop_apic_nmi_watchdog (void *); | ||
63 | extern void disable_timer_nmi_watchdog(void); | 58 | extern void disable_timer_nmi_watchdog(void); |
64 | extern void enable_timer_nmi_watchdog(void); | 59 | extern void enable_timer_nmi_watchdog(void); |
65 | extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); | 60 | extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); |
66 | 61 | ||
67 | extern void nmi_watchdog_default(void); | 62 | extern void nmi_watchdog_default(void); |
68 | extern int setup_nmi_watchdog(char *); | 63 | extern int setup_nmi_watchdog(char *); |
69 | 64 | ||
65 | extern atomic_t nmi_active; | ||
70 | extern unsigned int nmi_watchdog; | 66 | extern unsigned int nmi_watchdog; |
71 | #define NMI_DEFAULT -1 | 67 | #define NMI_DEFAULT -1 |
72 | #define NMI_NONE 0 | 68 | #define NMI_NONE 0 |
diff --git a/include/asm-x86_64/pci-direct.h b/include/asm-x86_64/pci-direct.h index 036b6ca5b53b..eba9cb471df3 100644 --- a/include/asm-x86_64/pci-direct.h +++ b/include/asm-x86_64/pci-direct.h | |||
@@ -2,47 +2,15 @@ | |||
2 | #define ASM_PCI_DIRECT_H 1 | 2 | #define ASM_PCI_DIRECT_H 1 |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/io.h> | ||
6 | 5 | ||
7 | /* Direct PCI access. This is used for PCI accesses in early boot before | 6 | /* Direct PCI access. This is used for PCI accesses in early boot before |
8 | the PCI subsystem works. */ | 7 | the PCI subsystem works. */ |
9 | 8 | ||
10 | #define PDprintk(x...) | 9 | extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset); |
10 | extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset); | ||
11 | extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset); | ||
12 | extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val); | ||
11 | 13 | ||
12 | static inline u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset) | 14 | extern int early_pci_allowed(void); |
13 | { | ||
14 | u32 v; | ||
15 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
16 | v = inl(0xcfc); | ||
17 | if (v != 0xffffffff) | ||
18 | PDprintk("%x reading 4 from %x: %x\n", slot, offset, v); | ||
19 | return v; | ||
20 | } | ||
21 | |||
22 | static inline u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset) | ||
23 | { | ||
24 | u8 v; | ||
25 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
26 | v = inb(0xcfc + (offset&3)); | ||
27 | PDprintk("%x reading 1 from %x: %x\n", slot, offset, v); | ||
28 | return v; | ||
29 | } | ||
30 | |||
31 | static inline u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset) | ||
32 | { | ||
33 | u16 v; | ||
34 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
35 | v = inw(0xcfc + (offset&2)); | ||
36 | PDprintk("%x reading 2 from %x: %x\n", slot, offset, v); | ||
37 | return v; | ||
38 | } | ||
39 | |||
40 | static inline void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, | ||
41 | u32 val) | ||
42 | { | ||
43 | PDprintk("%x writing to %x: %x\n", slot, offset, val); | ||
44 | outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); | ||
45 | outl(val, 0xcfc); | ||
46 | } | ||
47 | 15 | ||
48 | #endif | 16 | #endif |
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h index b47c3df9ed1d..14996d962bac 100644 --- a/include/asm-x86_64/pda.h +++ b/include/asm-x86_64/pda.h | |||
@@ -9,20 +9,24 @@ | |||
9 | 9 | ||
10 | /* Per processor datastructure. %gs points to it while the kernel runs */ | 10 | /* Per processor datastructure. %gs points to it while the kernel runs */ |
11 | struct x8664_pda { | 11 | struct x8664_pda { |
12 | struct task_struct *pcurrent; /* Current process */ | 12 | struct task_struct *pcurrent; /* 0 Current process */ |
13 | unsigned long data_offset; /* Per cpu data offset from linker address */ | 13 | unsigned long data_offset; /* 8 Per cpu data offset from linker |
14 | unsigned long kernelstack; /* top of kernel stack for current */ | 14 | address */ |
15 | unsigned long oldrsp; /* user rsp for system call */ | 15 | unsigned long kernelstack; /* 16 top of kernel stack for current */ |
16 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | 16 | unsigned long oldrsp; /* 24 user rsp for system call */ |
17 | unsigned long debugstack; /* #DB/#BP stack. */ | 17 | int irqcount; /* 32 Irq nesting counter. Starts with -1 */ |
18 | int cpunumber; /* 36 Logical CPU number */ | ||
19 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
20 | unsigned long stack_canary; /* 40 stack canary value */ | ||
21 | /* gcc-ABI: this canary MUST be at | ||
22 | offset 40!!! */ | ||
18 | #endif | 23 | #endif |
19 | int irqcount; /* Irq nesting counter. Starts with -1 */ | 24 | char *irqstackptr; |
20 | int cpunumber; /* Logical CPU number */ | ||
21 | char *irqstackptr; /* top of irqstack */ | ||
22 | int nodenumber; /* number of current node */ | 25 | int nodenumber; /* number of current node */ |
23 | unsigned int __softirq_pending; | 26 | unsigned int __softirq_pending; |
24 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | 27 | unsigned int __nmi_count; /* number of NMI on this CPUs */ |
25 | int mmu_state; | 28 | short mmu_state; |
29 | short isidle; | ||
26 | struct mm_struct *active_mm; | 30 | struct mm_struct *active_mm; |
27 | unsigned apic_timer_irqs; | 31 | unsigned apic_timer_irqs; |
28 | } ____cacheline_aligned_in_smp; | 32 | } ____cacheline_aligned_in_smp; |
@@ -36,44 +40,69 @@ extern struct x8664_pda boot_cpu_pda[]; | |||
36 | * There is no fast way to get the base address of the PDA, all the accesses | 40 | * There is no fast way to get the base address of the PDA, all the accesses |
37 | * have to mention %fs/%gs. So it needs to be done this Torvaldian way. | 41 | * have to mention %fs/%gs. So it needs to be done this Torvaldian way. |
38 | */ | 42 | */ |
39 | #define sizeof_field(type,field) (sizeof(((type *)0)->field)) | 43 | extern void __bad_pda_field(void) __attribute__((noreturn)); |
40 | #define typeof_field(type,field) typeof(((type *)0)->field) | ||
41 | 44 | ||
42 | extern void __bad_pda_field(void); | 45 | /* |
46 | * proxy_pda doesn't actually exist, but tell gcc it is accessed for | ||
47 | * all PDA accesses so it gets read/write dependencies right. | ||
48 | */ | ||
49 | extern struct x8664_pda _proxy_pda; | ||
43 | 50 | ||
44 | #define pda_offset(field) offsetof(struct x8664_pda, field) | 51 | #define pda_offset(field) offsetof(struct x8664_pda, field) |
45 | 52 | ||
46 | #define pda_to_op(op,field,val) do { \ | 53 | #define pda_to_op(op,field,val) do { \ |
47 | typedef typeof_field(struct x8664_pda, field) T__; \ | 54 | typedef typeof(_proxy_pda.field) T__; \ |
48 | switch (sizeof_field(struct x8664_pda, field)) { \ | 55 | if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ |
49 | case 2: \ | 56 | switch (sizeof(_proxy_pda.field)) { \ |
50 | asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ | 57 | case 2: \ |
51 | case 4: \ | 58 | asm(op "w %1,%%gs:%c2" : \ |
52 | asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ | 59 | "+m" (_proxy_pda.field) : \ |
53 | case 8: \ | 60 | "ri" ((T__)val), \ |
54 | asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ | 61 | "i"(pda_offset(field))); \ |
55 | default: __bad_pda_field(); \ | 62 | break; \ |
56 | } \ | 63 | case 4: \ |
64 | asm(op "l %1,%%gs:%c2" : \ | ||
65 | "+m" (_proxy_pda.field) : \ | ||
66 | "ri" ((T__)val), \ | ||
67 | "i" (pda_offset(field))); \ | ||
68 | break; \ | ||
69 | case 8: \ | ||
70 | asm(op "q %1,%%gs:%c2": \ | ||
71 | "+m" (_proxy_pda.field) : \ | ||
72 | "ri" ((T__)val), \ | ||
73 | "i"(pda_offset(field))); \ | ||
74 | break; \ | ||
75 | default: \ | ||
76 | __bad_pda_field(); \ | ||
77 | } \ | ||
57 | } while (0) | 78 | } while (0) |
58 | 79 | ||
59 | /* | 80 | #define pda_from_op(op,field) ({ \ |
60 | * AK: PDA read accesses should be neither volatile nor have an memory clobber. | 81 | typeof(_proxy_pda.field) ret__; \ |
61 | * Unfortunately removing them causes all hell to break lose currently. | 82 | switch (sizeof(_proxy_pda.field)) { \ |
62 | */ | 83 | case 2: \ |
63 | #define pda_from_op(op,field) ({ \ | 84 | asm(op "w %%gs:%c1,%0" : \ |
64 | typeof_field(struct x8664_pda, field) ret__; \ | 85 | "=r" (ret__) : \ |
65 | switch (sizeof_field(struct x8664_pda, field)) { \ | 86 | "i" (pda_offset(field)), \ |
66 | case 2: \ | 87 | "m" (_proxy_pda.field)); \ |
67 | asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 88 | break; \ |
68 | case 4: \ | 89 | case 4: \ |
69 | asm volatile(op "l %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 90 | asm(op "l %%gs:%c1,%0": \ |
70 | case 8: \ | 91 | "=r" (ret__): \ |
71 | asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 92 | "i" (pda_offset(field)), \ |
72 | default: __bad_pda_field(); \ | 93 | "m" (_proxy_pda.field)); \ |
73 | } \ | 94 | break; \ |
95 | case 8: \ | ||
96 | asm(op "q %%gs:%c1,%0": \ | ||
97 | "=r" (ret__) : \ | ||
98 | "i" (pda_offset(field)), \ | ||
99 | "m" (_proxy_pda.field)); \ | ||
100 | break; \ | ||
101 | default: \ | ||
102 | __bad_pda_field(); \ | ||
103 | } \ | ||
74 | ret__; }) | 104 | ret__; }) |
75 | 105 | ||
76 | |||
77 | #define read_pda(field) pda_from_op("mov",field) | 106 | #define read_pda(field) pda_from_op("mov",field) |
78 | #define write_pda(field,val) pda_to_op("mov",field,val) | 107 | #define write_pda(field,val) pda_to_op("mov",field,val) |
79 | #define add_pda(field,val) pda_to_op("add",field,val) | 108 | #define add_pda(field,val) pda_to_op("add",field,val) |
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index bffb2f886a51..285756010c51 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h | |||
@@ -11,6 +11,16 @@ | |||
11 | 11 | ||
12 | #include <asm/pda.h> | 12 | #include <asm/pda.h> |
13 | 13 | ||
14 | #ifdef CONFIG_MODULES | ||
15 | # define PERCPU_MODULE_RESERVE 8192 | ||
16 | #else | ||
17 | # define PERCPU_MODULE_RESERVE 0 | ||
18 | #endif | ||
19 | |||
20 | #define PERCPU_ENOUGH_ROOM \ | ||
21 | (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \ | ||
22 | PERCPU_MODULE_RESERVE) | ||
23 | |||
14 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) | 24 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) |
15 | #define __my_cpu_offset() read_pda(data_offset) | 25 | #define __my_cpu_offset() read_pda(data_offset) |
16 | 26 | ||
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 51eba2395171..6899e770b173 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -21,12 +21,9 @@ extern unsigned long __supported_pte_mask; | |||
21 | 21 | ||
22 | #define swapper_pg_dir init_level4_pgt | 22 | #define swapper_pg_dir init_level4_pgt |
23 | 23 | ||
24 | extern int nonx_setup(char *str); | ||
25 | extern void paging_init(void); | 24 | extern void paging_init(void); |
26 | extern void clear_kernel_mapping(unsigned long addr, unsigned long size); | 25 | extern void clear_kernel_mapping(unsigned long addr, unsigned long size); |
27 | 26 | ||
28 | extern unsigned long pgkern_mask; | ||
29 | |||
30 | /* | 27 | /* |
31 | * ZERO_PAGE is a global shared page that is always zero: used | 28 | * ZERO_PAGE is a global shared page that is always zero: used |
32 | * for zero-mapped memory areas etc.. | 29 | * for zero-mapped memory areas etc.. |
@@ -265,7 +262,7 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) | |||
265 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) | 262 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) |
266 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 263 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
267 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 264 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
268 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 265 | static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); } |
269 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 266 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
270 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 267 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
271 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 268 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
@@ -278,11 +275,12 @@ static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & | |||
278 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } | 275 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } |
279 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } | 276 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } |
280 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | 277 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } |
281 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | 278 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } |
282 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 279 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
283 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 280 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
284 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } | 281 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } |
285 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; } | 282 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; } |
283 | static inline pte_t pte_clrhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_PSE)); return pte; } | ||
286 | 284 | ||
287 | struct vm_area_struct; | 285 | struct vm_area_struct; |
288 | 286 | ||
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 038fe1f47e6f..b73d0c76613c 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -51,10 +51,8 @@ extern unsigned long long monotonic_base; | |||
51 | extern int sysctl_vsyscall; | 51 | extern int sysctl_vsyscall; |
52 | extern int nohpet; | 52 | extern int nohpet; |
53 | extern unsigned long vxtime_hz; | 53 | extern unsigned long vxtime_hz; |
54 | extern void time_init_gtod(void); | ||
54 | 55 | ||
55 | extern int numa_setup(char *opt); | ||
56 | |||
57 | extern int setup_early_printk(char *); | ||
58 | extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); | 56 | extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); |
59 | 57 | ||
60 | extern void early_identify_cpu(struct cpuinfo_x86 *c); | 58 | extern void early_identify_cpu(struct cpuinfo_x86 *c); |
@@ -91,7 +89,7 @@ extern void syscall32_cpu_init(void); | |||
91 | 89 | ||
92 | extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); | 90 | extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); |
93 | 91 | ||
94 | extern void check_ioapic(void); | 92 | extern void early_quirks(void); |
95 | extern void check_efer(void); | 93 | extern void check_efer(void); |
96 | 94 | ||
97 | extern int unhandled_signal(struct task_struct *tsk, int sig); | 95 | extern int unhandled_signal(struct task_struct *tsk, int sig); |
@@ -103,13 +101,7 @@ extern void select_idle_routine(const struct cpuinfo_x86 *c); | |||
103 | extern unsigned long table_start, table_end; | 101 | extern unsigned long table_start, table_end; |
104 | 102 | ||
105 | extern int exception_trace; | 103 | extern int exception_trace; |
106 | extern int using_apic_timer; | ||
107 | extern int disable_apic; | ||
108 | extern unsigned cpu_khz; | 104 | extern unsigned cpu_khz; |
109 | extern int ioapic_force; | ||
110 | extern int skip_ioapic_setup; | ||
111 | extern int acpi_ht; | ||
112 | extern int acpi_disabled; | ||
113 | 105 | ||
114 | extern void no_iommu_init(void); | 106 | extern void no_iommu_init(void); |
115 | extern int force_iommu, no_iommu; | 107 | extern int force_iommu, no_iommu; |
@@ -131,7 +123,8 @@ extern int fix_aperture; | |||
131 | 123 | ||
132 | extern int reboot_force; | 124 | extern int reboot_force; |
133 | extern int notsc_setup(char *); | 125 | extern int notsc_setup(char *); |
134 | extern int setup_additional_cpus(char *); | 126 | |
127 | extern int gsi_irq_sharing(int gsi); | ||
135 | 128 | ||
136 | extern void smp_local_timer_interrupt(struct pt_regs * regs); | 129 | extern void smp_local_timer_interrupt(struct pt_regs * regs); |
137 | 130 | ||
diff --git a/include/asm-x86_64/rwlock.h b/include/asm-x86_64/rwlock.h index dea0e9459264..72aeebed920b 100644 --- a/include/asm-x86_64/rwlock.h +++ b/include/asm-x86_64/rwlock.h | |||
@@ -18,69 +18,9 @@ | |||
18 | #ifndef _ASM_X86_64_RWLOCK_H | 18 | #ifndef _ASM_X86_64_RWLOCK_H |
19 | #define _ASM_X86_64_RWLOCK_H | 19 | #define _ASM_X86_64_RWLOCK_H |
20 | 20 | ||
21 | #include <linux/stringify.h> | ||
22 | |||
23 | #define RW_LOCK_BIAS 0x01000000 | 21 | #define RW_LOCK_BIAS 0x01000000 |
24 | #define RW_LOCK_BIAS_STR "0x01000000" | 22 | #define RW_LOCK_BIAS_STR "0x01000000" |
25 | |||
26 | #define __build_read_lock_ptr(rw, helper) \ | ||
27 | asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" \ | ||
28 | "js 2f\n" \ | ||
29 | "1:\n" \ | ||
30 | LOCK_SECTION_START("") \ | ||
31 | "2:\tcall " helper "\n\t" \ | ||
32 | "jmp 1b\n" \ | ||
33 | LOCK_SECTION_END \ | ||
34 | ::"a" (rw) : "memory") | ||
35 | |||
36 | #define __build_read_lock_const(rw, helper) \ | ||
37 | asm volatile(LOCK_PREFIX "subl $1,%0\n\t" \ | ||
38 | "js 2f\n" \ | ||
39 | "1:\n" \ | ||
40 | LOCK_SECTION_START("") \ | ||
41 | "2:\tpushq %%rax\n\t" \ | ||
42 | "leaq %0,%%rax\n\t" \ | ||
43 | "call " helper "\n\t" \ | ||
44 | "popq %%rax\n\t" \ | ||
45 | "jmp 1b\n" \ | ||
46 | LOCK_SECTION_END \ | ||
47 | :"=m" (*((volatile int *)rw))::"memory") | ||
48 | |||
49 | #define __build_read_lock(rw, helper) do { \ | ||
50 | if (__builtin_constant_p(rw)) \ | ||
51 | __build_read_lock_const(rw, helper); \ | ||
52 | else \ | ||
53 | __build_read_lock_ptr(rw, helper); \ | ||
54 | } while (0) | ||
55 | |||
56 | #define __build_write_lock_ptr(rw, helper) \ | ||
57 | asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ | ||
58 | "jnz 2f\n" \ | ||
59 | "1:\n" \ | ||
60 | LOCK_SECTION_START("") \ | ||
61 | "2:\tcall " helper "\n\t" \ | ||
62 | "jmp 1b\n" \ | ||
63 | LOCK_SECTION_END \ | ||
64 | ::"a" (rw) : "memory") | ||
65 | |||
66 | #define __build_write_lock_const(rw, helper) \ | ||
67 | asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ | ||
68 | "jnz 2f\n" \ | ||
69 | "1:\n" \ | ||
70 | LOCK_SECTION_START("") \ | ||
71 | "2:\tpushq %%rax\n\t" \ | ||
72 | "leaq %0,%%rax\n\t" \ | ||
73 | "call " helper "\n\t" \ | ||
74 | "popq %%rax\n\t" \ | ||
75 | "jmp 1b\n" \ | ||
76 | LOCK_SECTION_END \ | ||
77 | :"=m" (*((volatile long *)rw))::"memory") | ||
78 | 23 | ||
79 | #define __build_write_lock(rw, helper) do { \ | 24 | /* Actual code is in asm/spinlock.h or in arch/x86_64/lib/rwlock.S */ |
80 | if (__builtin_constant_p(rw)) \ | ||
81 | __build_write_lock_const(rw, helper); \ | ||
82 | else \ | ||
83 | __build_write_lock_ptr(rw, helper); \ | ||
84 | } while (0) | ||
85 | 25 | ||
86 | #endif | 26 | #endif |
diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h index d4bed33fb32c..334ddcdd8f92 100644 --- a/include/asm-x86_64/segment.h +++ b/include/asm-x86_64/segment.h | |||
@@ -20,15 +20,16 @@ | |||
20 | #define __USER_CS 0x33 /* 6*8+3 */ | 20 | #define __USER_CS 0x33 /* 6*8+3 */ |
21 | #define __USER32_DS __USER_DS | 21 | #define __USER32_DS __USER_DS |
22 | 22 | ||
23 | #define GDT_ENTRY_TLS 1 | ||
24 | #define GDT_ENTRY_TSS 8 /* needs two entries */ | 23 | #define GDT_ENTRY_TSS 8 /* needs two entries */ |
25 | #define GDT_ENTRY_LDT 10 /* needs two entries */ | 24 | #define GDT_ENTRY_LDT 10 /* needs two entries */ |
26 | #define GDT_ENTRY_TLS_MIN 12 | 25 | #define GDT_ENTRY_TLS_MIN 12 |
27 | #define GDT_ENTRY_TLS_MAX 14 | 26 | #define GDT_ENTRY_TLS_MAX 14 |
28 | /* 15 free */ | ||
29 | 27 | ||
30 | #define GDT_ENTRY_TLS_ENTRIES 3 | 28 | #define GDT_ENTRY_TLS_ENTRIES 3 |
31 | 29 | ||
30 | #define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */ | ||
31 | #define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3) | ||
32 | |||
32 | /* TLS indexes for 64bit - hardcoded in arch_prctl */ | 33 | /* TLS indexes for 64bit - hardcoded in arch_prctl */ |
33 | #define FS_TLS 0 | 34 | #define FS_TLS 0 |
34 | #define GS_TLS 1 | 35 | #define GS_TLS 1 |
diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h index 064df08b9a0f..107bd90429e8 100644 --- a/include/asm-x86_64/semaphore.h +++ b/include/asm-x86_64/semaphore.h | |||
@@ -107,12 +107,9 @@ static inline void down(struct semaphore * sem) | |||
107 | __asm__ __volatile__( | 107 | __asm__ __volatile__( |
108 | "# atomic down operation\n\t" | 108 | "# atomic down operation\n\t" |
109 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ | 109 | LOCK_PREFIX "decl %0\n\t" /* --sem->count */ |
110 | "js 2f\n" | 110 | "jns 1f\n\t" |
111 | "1:\n" | 111 | "call __down_failed\n" |
112 | LOCK_SECTION_START("") | 112 | "1:" |
113 | "2:\tcall __down_failed\n\t" | ||
114 | "jmp 1b\n" | ||
115 | LOCK_SECTION_END | ||
116 | :"=m" (sem->count) | 113 | :"=m" (sem->count) |
117 | :"D" (sem) | 114 | :"D" (sem) |
118 | :"memory"); | 115 | :"memory"); |
@@ -130,14 +127,11 @@ static inline int down_interruptible(struct semaphore * sem) | |||
130 | 127 | ||
131 | __asm__ __volatile__( | 128 | __asm__ __volatile__( |
132 | "# atomic interruptible down operation\n\t" | 129 | "# atomic interruptible down operation\n\t" |
130 | "xorl %0,%0\n\t" | ||
133 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 131 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
134 | "js 2f\n\t" | 132 | "jns 2f\n\t" |
135 | "xorl %0,%0\n" | 133 | "call __down_failed_interruptible\n" |
136 | "1:\n" | 134 | "2:\n" |
137 | LOCK_SECTION_START("") | ||
138 | "2:\tcall __down_failed_interruptible\n\t" | ||
139 | "jmp 1b\n" | ||
140 | LOCK_SECTION_END | ||
141 | :"=a" (result), "=m" (sem->count) | 135 | :"=a" (result), "=m" (sem->count) |
142 | :"D" (sem) | 136 | :"D" (sem) |
143 | :"memory"); | 137 | :"memory"); |
@@ -154,14 +148,11 @@ static inline int down_trylock(struct semaphore * sem) | |||
154 | 148 | ||
155 | __asm__ __volatile__( | 149 | __asm__ __volatile__( |
156 | "# atomic interruptible down operation\n\t" | 150 | "# atomic interruptible down operation\n\t" |
151 | "xorl %0,%0\n\t" | ||
157 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ | 152 | LOCK_PREFIX "decl %1\n\t" /* --sem->count */ |
158 | "js 2f\n\t" | 153 | "jns 2f\n\t" |
159 | "xorl %0,%0\n" | 154 | "call __down_failed_trylock\n\t" |
160 | "1:\n" | 155 | "2:\n" |
161 | LOCK_SECTION_START("") | ||
162 | "2:\tcall __down_failed_trylock\n\t" | ||
163 | "jmp 1b\n" | ||
164 | LOCK_SECTION_END | ||
165 | :"=a" (result), "=m" (sem->count) | 156 | :"=a" (result), "=m" (sem->count) |
166 | :"D" (sem) | 157 | :"D" (sem) |
167 | :"memory","cc"); | 158 | :"memory","cc"); |
@@ -179,12 +170,9 @@ static inline void up(struct semaphore * sem) | |||
179 | __asm__ __volatile__( | 170 | __asm__ __volatile__( |
180 | "# atomic up operation\n\t" | 171 | "# atomic up operation\n\t" |
181 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ | 172 | LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ |
182 | "jle 2f\n" | 173 | "jg 1f\n\t" |
183 | "1:\n" | 174 | "call __up_wakeup\n" |
184 | LOCK_SECTION_START("") | 175 | "1:" |
185 | "2:\tcall __up_wakeup\n\t" | ||
186 | "jmp 1b\n" | ||
187 | LOCK_SECTION_END | ||
188 | :"=m" (sem->count) | 176 | :"=m" (sem->count) |
189 | :"D" (sem) | 177 | :"D" (sem) |
190 | :"memory"); | 178 | :"memory"); |
diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h index 3ede2a61973a..4581f978b299 100644 --- a/include/asm-x86_64/signal.h +++ b/include/asm-x86_64/signal.h | |||
@@ -24,10 +24,6 @@ typedef struct { | |||
24 | } sigset_t; | 24 | } sigset_t; |
25 | 25 | ||
26 | 26 | ||
27 | struct pt_regs; | ||
28 | asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset); | ||
29 | |||
30 | |||
31 | #else | 27 | #else |
32 | /* Here we must cater to libcs that poke about in kernel headers. */ | 28 | /* Here we must cater to libcs that poke about in kernel headers. */ |
33 | 29 | ||
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index ce97f65e1d10..d6b7c057edba 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -4,27 +4,18 @@ | |||
4 | /* | 4 | /* |
5 | * We need the APIC definitions automatically as part of 'smp.h' | 5 | * We need the APIC definitions automatically as part of 'smp.h' |
6 | */ | 6 | */ |
7 | #ifndef __ASSEMBLY__ | ||
8 | #include <linux/threads.h> | 7 | #include <linux/threads.h> |
9 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
10 | #include <linux/bitops.h> | 9 | #include <linux/bitops.h> |
11 | extern int disable_apic; | 10 | extern int disable_apic; |
12 | #endif | ||
13 | 11 | ||
14 | #ifdef CONFIG_X86_LOCAL_APIC | ||
15 | #ifndef __ASSEMBLY__ | ||
16 | #include <asm/fixmap.h> | 12 | #include <asm/fixmap.h> |
17 | #include <asm/mpspec.h> | 13 | #include <asm/mpspec.h> |
18 | #ifdef CONFIG_X86_IO_APIC | ||
19 | #include <asm/io_apic.h> | 14 | #include <asm/io_apic.h> |
20 | #endif | ||
21 | #include <asm/apic.h> | 15 | #include <asm/apic.h> |
22 | #include <asm/thread_info.h> | 16 | #include <asm/thread_info.h> |
23 | #endif | ||
24 | #endif | ||
25 | 17 | ||
26 | #ifdef CONFIG_SMP | 18 | #ifdef CONFIG_SMP |
27 | #ifndef ASSEMBLY | ||
28 | 19 | ||
29 | #include <asm/pda.h> | 20 | #include <asm/pda.h> |
30 | 21 | ||
@@ -42,7 +33,6 @@ extern cpumask_t cpu_initialized; | |||
42 | 33 | ||
43 | extern void smp_alloc_memory(void); | 34 | extern void smp_alloc_memory(void); |
44 | extern volatile unsigned long smp_invalidate_needed; | 35 | extern volatile unsigned long smp_invalidate_needed; |
45 | extern int pic_mode; | ||
46 | extern void lock_ipi_call_lock(void); | 36 | extern void lock_ipi_call_lock(void); |
47 | extern void unlock_ipi_call_lock(void); | 37 | extern void unlock_ipi_call_lock(void); |
48 | extern int smp_num_siblings; | 38 | extern int smp_num_siblings; |
@@ -74,20 +64,16 @@ static inline int hard_smp_processor_id(void) | |||
74 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); | 64 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); |
75 | } | 65 | } |
76 | 66 | ||
77 | extern int safe_smp_processor_id(void); | ||
78 | extern int __cpu_disable(void); | 67 | extern int __cpu_disable(void); |
79 | extern void __cpu_die(unsigned int cpu); | 68 | extern void __cpu_die(unsigned int cpu); |
80 | extern void prefill_possible_map(void); | 69 | extern void prefill_possible_map(void); |
81 | extern unsigned num_processors; | 70 | extern unsigned num_processors; |
82 | extern unsigned disabled_cpus; | 71 | extern unsigned disabled_cpus; |
83 | 72 | ||
84 | #endif /* !ASSEMBLY */ | ||
85 | |||
86 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 73 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
87 | 74 | ||
88 | #endif | 75 | #endif |
89 | 76 | ||
90 | #ifndef ASSEMBLY | ||
91 | /* | 77 | /* |
92 | * Some lowlevel functions might want to know about | 78 | * Some lowlevel functions might want to know about |
93 | * the real APIC ID <-> CPU # mapping. | 79 | * the real APIC ID <-> CPU # mapping. |
@@ -109,11 +95,8 @@ static inline int cpu_present_to_apicid(int mps_cpu) | |||
109 | return BAD_APICID; | 95 | return BAD_APICID; |
110 | } | 96 | } |
111 | 97 | ||
112 | #endif /* !ASSEMBLY */ | ||
113 | |||
114 | #ifndef CONFIG_SMP | 98 | #ifndef CONFIG_SMP |
115 | #define stack_smp_processor_id() 0 | 99 | #define stack_smp_processor_id() 0 |
116 | #define safe_smp_processor_id() 0 | ||
117 | #define cpu_logical_map(x) (x) | 100 | #define cpu_logical_map(x) (x) |
118 | #else | 101 | #else |
119 | #include <asm/thread_info.h> | 102 | #include <asm/thread_info.h> |
@@ -125,19 +108,23 @@ static inline int cpu_present_to_apicid(int mps_cpu) | |||
125 | }) | 108 | }) |
126 | #endif | 109 | #endif |
127 | 110 | ||
128 | #ifndef __ASSEMBLY__ | ||
129 | static __inline int logical_smp_processor_id(void) | 111 | static __inline int logical_smp_processor_id(void) |
130 | { | 112 | { |
131 | /* we don't want to mark this access volatile - bad code generation */ | 113 | /* we don't want to mark this access volatile - bad code generation */ |
132 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); | 114 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); |
133 | } | 115 | } |
134 | #endif | ||
135 | 116 | ||
136 | #ifdef CONFIG_SMP | 117 | #ifdef CONFIG_SMP |
137 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] | 118 | #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] |
138 | #else | 119 | #else |
139 | #define cpu_physical_id(cpu) boot_cpu_id | 120 | #define cpu_physical_id(cpu) boot_cpu_id |
140 | #endif | 121 | static inline int smp_call_function_single(int cpuid, void (*func) (void *info), |
141 | 122 | void *info, int retry, int wait) | |
123 | { | ||
124 | /* Disable interrupts here? */ | ||
125 | func(info); | ||
126 | return 0; | ||
127 | } | ||
128 | #endif /* !CONFIG_SMP */ | ||
142 | #endif | 129 | #endif |
143 | 130 | ||
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h index 248a79f0eaff..be7a9e629fb2 100644 --- a/include/asm-x86_64/spinlock.h +++ b/include/asm-x86_64/spinlock.h | |||
@@ -16,31 +16,23 @@ | |||
16 | * (the type definitions are in asm/spinlock_types.h) | 16 | * (the type definitions are in asm/spinlock_types.h) |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #define __raw_spin_is_locked(x) \ | 19 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
20 | (*(volatile signed int *)(&(x)->slock) <= 0) | 20 | { |
21 | 21 | return *(volatile signed int *)(&(lock)->slock) <= 0; | |
22 | #define __raw_spin_lock_string \ | 22 | } |
23 | "\n1:\t" \ | ||
24 | LOCK_PREFIX " ; decl %0\n\t" \ | ||
25 | "js 2f\n" \ | ||
26 | LOCK_SECTION_START("") \ | ||
27 | "2:\t" \ | ||
28 | "rep;nop\n\t" \ | ||
29 | "cmpl $0,%0\n\t" \ | ||
30 | "jle 2b\n\t" \ | ||
31 | "jmp 1b\n" \ | ||
32 | LOCK_SECTION_END | ||
33 | |||
34 | #define __raw_spin_lock_string_up \ | ||
35 | "\n\tdecl %0" | ||
36 | |||
37 | #define __raw_spin_unlock_string \ | ||
38 | "movl $1,%0" \ | ||
39 | :"=m" (lock->slock) : : "memory" | ||
40 | 23 | ||
41 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 24 | static inline void __raw_spin_lock(raw_spinlock_t *lock) |
42 | { | 25 | { |
43 | asm volatile(__raw_spin_lock_string : "=m" (lock->slock) : : "memory"); | 26 | asm volatile( |
27 | "\n1:\t" | ||
28 | LOCK_PREFIX " ; decl %0\n\t" | ||
29 | "jns 2f\n" | ||
30 | "3:\n" | ||
31 | "rep;nop\n\t" | ||
32 | "cmpl $0,%0\n\t" | ||
33 | "jle 3b\n\t" | ||
34 | "jmp 1b\n" | ||
35 | "2:\t" : "=m" (lock->slock) : : "memory"); | ||
44 | } | 36 | } |
45 | 37 | ||
46 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) | 38 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) |
@@ -49,7 +41,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
49 | { | 41 | { |
50 | int oldval; | 42 | int oldval; |
51 | 43 | ||
52 | __asm__ __volatile__( | 44 | asm volatile( |
53 | "xchgl %0,%1" | 45 | "xchgl %0,%1" |
54 | :"=q" (oldval), "=m" (lock->slock) | 46 | :"=q" (oldval), "=m" (lock->slock) |
55 | :"0" (0) : "memory"); | 47 | :"0" (0) : "memory"); |
@@ -59,13 +51,14 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
59 | 51 | ||
60 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 52 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
61 | { | 53 | { |
62 | __asm__ __volatile__( | 54 | asm volatile("movl $1,%0" :"=m" (lock->slock) :: "memory"); |
63 | __raw_spin_unlock_string | ||
64 | ); | ||
65 | } | 55 | } |
66 | 56 | ||
67 | #define __raw_spin_unlock_wait(lock) \ | 57 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
68 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | 58 | { |
59 | while (__raw_spin_is_locked(lock)) | ||
60 | cpu_relax(); | ||
61 | } | ||
69 | 62 | ||
70 | /* | 63 | /* |
71 | * Read-write spinlocks, allowing multiple readers | 64 | * Read-write spinlocks, allowing multiple readers |
@@ -79,26 +72,34 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
79 | * | 72 | * |
80 | * On x86, we implement read-write locks as a 32-bit counter | 73 | * On x86, we implement read-write locks as a 32-bit counter |
81 | * with the high bit (sign) being the "contended" bit. | 74 | * with the high bit (sign) being the "contended" bit. |
82 | * | ||
83 | * The inline assembly is non-obvious. Think about it. | ||
84 | * | ||
85 | * Changed to use the same technique as rw semaphores. See | ||
86 | * semaphore.h for details. -ben | ||
87 | * | ||
88 | * the helpers are in arch/i386/kernel/semaphore.c | ||
89 | */ | 75 | */ |
90 | 76 | ||
91 | #define __raw_read_can_lock(x) ((int)(x)->lock > 0) | 77 | static inline int __raw_read_can_lock(raw_rwlock_t *lock) |
92 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 78 | { |
79 | return (int)(lock)->lock > 0; | ||
80 | } | ||
81 | |||
82 | static inline int __raw_write_can_lock(raw_rwlock_t *lock) | ||
83 | { | ||
84 | return (lock)->lock == RW_LOCK_BIAS; | ||
85 | } | ||
93 | 86 | ||
94 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 87 | static inline void __raw_read_lock(raw_rwlock_t *rw) |
95 | { | 88 | { |
96 | __build_read_lock(rw, "__read_lock_failed"); | 89 | asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" |
90 | "jns 1f\n" | ||
91 | "call __read_lock_failed\n" | ||
92 | "1:\n" | ||
93 | ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); | ||
97 | } | 94 | } |
98 | 95 | ||
99 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 96 | static inline void __raw_write_lock(raw_rwlock_t *rw) |
100 | { | 97 | { |
101 | __build_write_lock(rw, "__write_lock_failed"); | 98 | asm volatile(LOCK_PREFIX "subl %1,(%0)\n\t" |
99 | "jz 1f\n" | ||
100 | "\tcall __write_lock_failed\n\t" | ||
101 | "1:\n" | ||
102 | ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); | ||
102 | } | 103 | } |
103 | 104 | ||
104 | static inline int __raw_read_trylock(raw_rwlock_t *lock) | 105 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
diff --git a/include/asm-x86_64/stacktrace.h b/include/asm-x86_64/stacktrace.h new file mode 100644 index 000000000000..5eb9799bef76 --- /dev/null +++ b/include/asm-x86_64/stacktrace.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _ASM_STACKTRACE_H | ||
2 | #define _ASM_STACKTRACE_H 1 | ||
3 | |||
4 | /* Generic stack tracer with callbacks */ | ||
5 | |||
6 | struct stacktrace_ops { | ||
7 | void (*warning)(void *data, char *msg); | ||
8 | /* msg must contain %s for the symbol */ | ||
9 | void (*warning_symbol)(void *data, char *msg, unsigned long symbol); | ||
10 | void (*address)(void *data, unsigned long address); | ||
11 | /* On negative return stop dumping */ | ||
12 | int (*stack)(void *data, char *name); | ||
13 | }; | ||
14 | |||
15 | void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, | ||
16 | struct stacktrace_ops *ops, void *data); | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 6bf170bceae1..bd376bc8c4ab 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -14,12 +14,13 @@ | |||
14 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" | 14 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" |
15 | 15 | ||
16 | /* frame pointer must be last for get_wchan */ | 16 | /* frame pointer must be last for get_wchan */ |
17 | #define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" | 17 | #define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" |
18 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" | 18 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" |
19 | 19 | ||
20 | #define __EXTRA_CLOBBER \ | 20 | #define __EXTRA_CLOBBER \ |
21 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" | 21 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" |
22 | 22 | ||
23 | /* Save restore flags to clear handle leaking NT */ | ||
23 | #define switch_to(prev,next,last) \ | 24 | #define switch_to(prev,next,last) \ |
24 | asm volatile(SAVE_CONTEXT \ | 25 | asm volatile(SAVE_CONTEXT \ |
25 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | 26 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ |
diff --git a/include/asm-x86_64/tce.h b/include/asm-x86_64/tce.h index 53e9a68b3336..dbb047febc5e 100644 --- a/include/asm-x86_64/tce.h +++ b/include/asm-x86_64/tce.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifndef _ASM_X86_64_TCE_H | 24 | #ifndef _ASM_X86_64_TCE_H |
25 | #define _ASM_X86_64_TCE_H | 25 | #define _ASM_X86_64_TCE_H |
26 | 26 | ||
27 | extern void* tce_table_kva[]; | ||
28 | extern unsigned int specified_table_size; | 27 | extern unsigned int specified_table_size; |
29 | struct iommu_table; | 28 | struct iommu_table; |
30 | 29 | ||
diff --git a/include/asm-x86_64/therm_throt.h b/include/asm-x86_64/therm_throt.h new file mode 100644 index 000000000000..5aac059007ba --- /dev/null +++ b/include/asm-x86_64/therm_throt.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-i386/therm_throt.h> | |||
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index 2029b00351f3..787a08114b48 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h | |||
@@ -114,11 +114,14 @@ static inline struct thread_info *stack_thread_info(void) | |||
114 | #define TIF_IRET 5 /* force IRET */ | 114 | #define TIF_IRET 5 /* force IRET */ |
115 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ | 115 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ |
116 | #define TIF_SECCOMP 8 /* secure computing */ | 116 | #define TIF_SECCOMP 8 /* secure computing */ |
117 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */ | ||
117 | /* 16 free */ | 118 | /* 16 free */ |
118 | #define TIF_IA32 17 /* 32bit process */ | 119 | #define TIF_IA32 17 /* 32bit process */ |
119 | #define TIF_FORK 18 /* ret_from_fork */ | 120 | #define TIF_FORK 18 /* ret_from_fork */ |
120 | #define TIF_ABI_PENDING 19 | 121 | #define TIF_ABI_PENDING 19 |
121 | #define TIF_MEMDIE 20 | 122 | #define TIF_MEMDIE 20 |
123 | #define TIF_DEBUG 21 /* uses debug registers */ | ||
124 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ | ||
122 | 125 | ||
123 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 126 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
124 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 127 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
@@ -128,9 +131,12 @@ static inline struct thread_info *stack_thread_info(void) | |||
128 | #define _TIF_IRET (1<<TIF_IRET) | 131 | #define _TIF_IRET (1<<TIF_IRET) |
129 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 132 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
130 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 133 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
134 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
131 | #define _TIF_IA32 (1<<TIF_IA32) | 135 | #define _TIF_IA32 (1<<TIF_IA32) |
132 | #define _TIF_FORK (1<<TIF_FORK) | 136 | #define _TIF_FORK (1<<TIF_FORK) |
133 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | 137 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
138 | #define _TIF_DEBUG (1<<TIF_DEBUG) | ||
139 | #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) | ||
134 | 140 | ||
135 | /* work to do on interrupt/exception return */ | 141 | /* work to do on interrupt/exception return */ |
136 | #define _TIF_WORK_MASK \ | 142 | #define _TIF_WORK_MASK \ |
@@ -138,6 +144,9 @@ static inline struct thread_info *stack_thread_info(void) | |||
138 | /* work to do on any return to user space */ | 144 | /* work to do on any return to user space */ |
139 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) | 145 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) |
140 | 146 | ||
147 | /* flags to check in __switch_to() */ | ||
148 | #define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP) | ||
149 | |||
141 | #define PREEMPT_ACTIVE 0x10000000 | 150 | #define PREEMPT_ACTIVE 0x10000000 |
142 | 151 | ||
143 | /* | 152 | /* |
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h index d16d5b60f419..983bd296c81a 100644 --- a/include/asm-x86_64/tlbflush.h +++ b/include/asm-x86_64/tlbflush.h | |||
@@ -4,44 +4,44 @@ | |||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <asm/processor.h> | 5 | #include <asm/processor.h> |
6 | 6 | ||
7 | #define __flush_tlb() \ | 7 | static inline unsigned long get_cr3(void) |
8 | do { \ | 8 | { |
9 | unsigned long tmpreg; \ | 9 | unsigned long cr3; |
10 | \ | 10 | asm volatile("mov %%cr3,%0" : "=r" (cr3)); |
11 | __asm__ __volatile__( \ | 11 | return cr3; |
12 | "movq %%cr3, %0; # flush TLB \n" \ | 12 | } |
13 | "movq %0, %%cr3; \n" \ | ||
14 | : "=r" (tmpreg) \ | ||
15 | :: "memory"); \ | ||
16 | } while (0) | ||
17 | 13 | ||
18 | /* | 14 | static inline void set_cr3(unsigned long cr3) |
19 | * Global pages have to be flushed a bit differently. Not a real | 15 | { |
20 | * performance problem because this does not happen often. | 16 | asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory"); |
21 | */ | 17 | } |
22 | #define __flush_tlb_global() \ | 18 | |
23 | do { \ | 19 | static inline void __flush_tlb(void) |
24 | unsigned long tmpreg, cr4, cr4_orig; \ | 20 | { |
25 | \ | 21 | set_cr3(get_cr3()); |
26 | __asm__ __volatile__( \ | 22 | } |
27 | "movq %%cr4, %2; # turn off PGE \n" \ | 23 | |
28 | "movq %2, %1; \n" \ | 24 | static inline unsigned long get_cr4(void) |
29 | "andq %3, %1; \n" \ | 25 | { |
30 | "movq %1, %%cr4; \n" \ | 26 | unsigned long cr4; |
31 | "movq %%cr3, %0; # flush TLB \n" \ | 27 | asm volatile("mov %%cr4,%0" : "=r" (cr4)); |
32 | "movq %0, %%cr3; \n" \ | 28 | return cr4; |
33 | "movq %2, %%cr4; # turn PGE back on \n" \ | 29 | } |
34 | : "=&r" (tmpreg), "=&r" (cr4), "=&r" (cr4_orig) \ | 30 | |
35 | : "i" (~X86_CR4_PGE) \ | 31 | static inline void set_cr4(unsigned long cr4) |
36 | : "memory"); \ | 32 | { |
37 | } while (0) | 33 | asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory"); |
38 | 34 | } | |
39 | extern unsigned long pgkern_mask; | 35 | |
40 | 36 | static inline void __flush_tlb_all(void) | |
41 | #define __flush_tlb_all() __flush_tlb_global() | 37 | { |
38 | unsigned long cr4 = get_cr4(); | ||
39 | set_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */ | ||
40 | set_cr4(cr4); /* write old PGE again and flush TLBs */ | ||
41 | } | ||
42 | 42 | ||
43 | #define __flush_tlb_one(addr) \ | 43 | #define __flush_tlb_one(addr) \ |
44 | __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) | 44 | __asm__ __volatile__("invlpg (%0)" :: "r" (addr) : "memory") |
45 | 45 | ||
46 | 46 | ||
47 | /* | 47 | /* |
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h index 1e1fa003daa3..e856570c0689 100644 --- a/include/asm-x86_64/uaccess.h +++ b/include/asm-x86_64/uaccess.h | |||
@@ -84,7 +84,7 @@ struct exception_table_entry | |||
84 | */ | 84 | */ |
85 | 85 | ||
86 | #define __get_user_x(size,ret,x,ptr) \ | 86 | #define __get_user_x(size,ret,x,ptr) \ |
87 | __asm__ __volatile__("call __get_user_" #size \ | 87 | asm volatile("call __get_user_" #size \ |
88 | :"=a" (ret),"=d" (x) \ | 88 | :"=a" (ret),"=d" (x) \ |
89 | :"c" (ptr) \ | 89 | :"c" (ptr) \ |
90 | :"r8") | 90 | :"r8") |
@@ -101,7 +101,7 @@ struct exception_table_entry | |||
101 | case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ | 101 | case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ |
102 | default: __get_user_bad(); break; \ | 102 | default: __get_user_bad(); break; \ |
103 | } \ | 103 | } \ |
104 | (x) = (__typeof__(*(ptr)))__val_gu; \ | 104 | (x) = (typeof(*(ptr)))__val_gu; \ |
105 | __ret_gu; \ | 105 | __ret_gu; \ |
106 | }) | 106 | }) |
107 | 107 | ||
@@ -112,7 +112,7 @@ extern void __put_user_8(void); | |||
112 | extern void __put_user_bad(void); | 112 | extern void __put_user_bad(void); |
113 | 113 | ||
114 | #define __put_user_x(size,ret,x,ptr) \ | 114 | #define __put_user_x(size,ret,x,ptr) \ |
115 | __asm__ __volatile__("call __put_user_" #size \ | 115 | asm volatile("call __put_user_" #size \ |
116 | :"=a" (ret) \ | 116 | :"=a" (ret) \ |
117 | :"c" (ptr),"d" (x) \ | 117 | :"c" (ptr),"d" (x) \ |
118 | :"r8") | 118 | :"r8") |
@@ -139,7 +139,7 @@ extern void __put_user_bad(void); | |||
139 | #define __put_user_check(x,ptr,size) \ | 139 | #define __put_user_check(x,ptr,size) \ |
140 | ({ \ | 140 | ({ \ |
141 | int __pu_err; \ | 141 | int __pu_err; \ |
142 | __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ | 142 | typeof(*(ptr)) __user *__pu_addr = (ptr); \ |
143 | switch (size) { \ | 143 | switch (size) { \ |
144 | case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \ | 144 | case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \ |
145 | case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \ | 145 | case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \ |
@@ -173,7 +173,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
173 | * aliasing issues. | 173 | * aliasing issues. |
174 | */ | 174 | */ |
175 | #define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ | 175 | #define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ |
176 | __asm__ __volatile__( \ | 176 | asm volatile( \ |
177 | "1: mov"itype" %"rtype"1,%2\n" \ | 177 | "1: mov"itype" %"rtype"1,%2\n" \ |
178 | "2:\n" \ | 178 | "2:\n" \ |
179 | ".section .fixup,\"ax\"\n" \ | 179 | ".section .fixup,\"ax\"\n" \ |
@@ -193,7 +193,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
193 | int __gu_err; \ | 193 | int __gu_err; \ |
194 | unsigned long __gu_val; \ | 194 | unsigned long __gu_val; \ |
195 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | 195 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ |
196 | (x) = (__typeof__(*(ptr)))__gu_val; \ | 196 | (x) = (typeof(*(ptr)))__gu_val; \ |
197 | __gu_err; \ | 197 | __gu_err; \ |
198 | }) | 198 | }) |
199 | 199 | ||
@@ -217,7 +217,7 @@ do { \ | |||
217 | } while (0) | 217 | } while (0) |
218 | 218 | ||
219 | #define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \ | 219 | #define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \ |
220 | __asm__ __volatile__( \ | 220 | asm volatile( \ |
221 | "1: mov"itype" %2,%"rtype"1\n" \ | 221 | "1: mov"itype" %2,%"rtype"1\n" \ |
222 | "2:\n" \ | 222 | "2:\n" \ |
223 | ".section .fixup,\"ax\"\n" \ | 223 | ".section .fixup,\"ax\"\n" \ |
@@ -237,15 +237,20 @@ do { \ | |||
237 | */ | 237 | */ |
238 | 238 | ||
239 | /* Handles exceptions in both to and from, but doesn't do access_ok */ | 239 | /* Handles exceptions in both to and from, but doesn't do access_ok */ |
240 | extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); | 240 | __must_check unsigned long |
241 | 241 | copy_user_generic(void *to, const void *from, unsigned len); | |
242 | extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); | 242 | |
243 | extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); | 243 | __must_check unsigned long |
244 | extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); | 244 | copy_to_user(void __user *to, const void *from, unsigned len); |
245 | 245 | __must_check unsigned long | |
246 | static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) | 246 | copy_from_user(void *to, const void __user *from, unsigned len); |
247 | __must_check unsigned long | ||
248 | copy_in_user(void __user *to, const void __user *from, unsigned len); | ||
249 | |||
250 | static __always_inline __must_check | ||
251 | int __copy_from_user(void *dst, const void __user *src, unsigned size) | ||
247 | { | 252 | { |
248 | int ret = 0; | 253 | int ret = 0; |
249 | if (!__builtin_constant_p(size)) | 254 | if (!__builtin_constant_p(size)) |
250 | return copy_user_generic(dst,(__force void *)src,size); | 255 | return copy_user_generic(dst,(__force void *)src,size); |
251 | switch (size) { | 256 | switch (size) { |
@@ -272,9 +277,10 @@ static __always_inline int __copy_from_user(void *dst, const void __user *src, u | |||
272 | } | 277 | } |
273 | } | 278 | } |
274 | 279 | ||
275 | static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) | 280 | static __always_inline __must_check |
281 | int __copy_to_user(void __user *dst, const void *src, unsigned size) | ||
276 | { | 282 | { |
277 | int ret = 0; | 283 | int ret = 0; |
278 | if (!__builtin_constant_p(size)) | 284 | if (!__builtin_constant_p(size)) |
279 | return copy_user_generic((__force void *)dst,src,size); | 285 | return copy_user_generic((__force void *)dst,src,size); |
280 | switch (size) { | 286 | switch (size) { |
@@ -303,10 +309,10 @@ static __always_inline int __copy_to_user(void __user *dst, const void *src, uns | |||
303 | } | 309 | } |
304 | } | 310 | } |
305 | 311 | ||
306 | 312 | static __always_inline __must_check | |
307 | static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) | 313 | int __copy_in_user(void __user *dst, const void __user *src, unsigned size) |
308 | { | 314 | { |
309 | int ret = 0; | 315 | int ret = 0; |
310 | if (!__builtin_constant_p(size)) | 316 | if (!__builtin_constant_p(size)) |
311 | return copy_user_generic((__force void *)dst,(__force void *)src,size); | 317 | return copy_user_generic((__force void *)dst,(__force void *)src,size); |
312 | switch (size) { | 318 | switch (size) { |
@@ -344,15 +350,17 @@ static __always_inline int __copy_in_user(void __user *dst, const void __user *s | |||
344 | } | 350 | } |
345 | } | 351 | } |
346 | 352 | ||
347 | long strncpy_from_user(char *dst, const char __user *src, long count); | 353 | __must_check long |
348 | long __strncpy_from_user(char *dst, const char __user *src, long count); | 354 | strncpy_from_user(char *dst, const char __user *src, long count); |
349 | long strnlen_user(const char __user *str, long n); | 355 | __must_check long |
350 | long __strnlen_user(const char __user *str, long n); | 356 | __strncpy_from_user(char *dst, const char __user *src, long count); |
351 | long strlen_user(const char __user *str); | 357 | __must_check long strnlen_user(const char __user *str, long n); |
352 | unsigned long clear_user(void __user *mem, unsigned long len); | 358 | __must_check long __strnlen_user(const char __user *str, long n); |
353 | unsigned long __clear_user(void __user *mem, unsigned long len); | 359 | __must_check long strlen_user(const char __user *str); |
354 | 360 | __must_check unsigned long clear_user(void __user *mem, unsigned long len); | |
355 | #define __copy_to_user_inatomic __copy_to_user | 361 | __must_check unsigned long __clear_user(void __user *mem, unsigned long len); |
356 | #define __copy_from_user_inatomic __copy_from_user | 362 | |
363 | __must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size); | ||
364 | #define __copy_to_user_inatomic copy_user_generic | ||
357 | 365 | ||
358 | #endif /* __X86_64_UACCESS_H */ | 366 | #endif /* __X86_64_UACCESS_H */ |
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 80fd48e84bbb..eeb98c168e98 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h | |||
@@ -600,9 +600,9 @@ __SYSCALL(__NR_fchmodat, sys_fchmodat) | |||
600 | #define __NR_faccessat 269 | 600 | #define __NR_faccessat 269 |
601 | __SYSCALL(__NR_faccessat, sys_faccessat) | 601 | __SYSCALL(__NR_faccessat, sys_faccessat) |
602 | #define __NR_pselect6 270 | 602 | #define __NR_pselect6 270 |
603 | __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */ | 603 | __SYSCALL(__NR_pselect6, sys_pselect6) |
604 | #define __NR_ppoll 271 | 604 | #define __NR_ppoll 271 |
605 | __SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ | 605 | __SYSCALL(__NR_ppoll, sys_ppoll) |
606 | #define __NR_unshare 272 | 606 | #define __NR_unshare 272 |
607 | __SYSCALL(__NR_unshare, sys_unshare) | 607 | __SYSCALL(__NR_unshare, sys_unshare) |
608 | #define __NR_set_robust_list 273 | 608 | #define __NR_set_robust_list 273 |
@@ -658,6 +658,7 @@ do { \ | |||
658 | #define __ARCH_WANT_SYS_SIGPENDING | 658 | #define __ARCH_WANT_SYS_SIGPENDING |
659 | #define __ARCH_WANT_SYS_SIGPROCMASK | 659 | #define __ARCH_WANT_SYS_SIGPROCMASK |
660 | #define __ARCH_WANT_SYS_RT_SIGACTION | 660 | #define __ARCH_WANT_SYS_RT_SIGACTION |
661 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
661 | #define __ARCH_WANT_SYS_TIME | 662 | #define __ARCH_WANT_SYS_TIME |
662 | #define __ARCH_WANT_COMPAT_SYS_TIME | 663 | #define __ARCH_WANT_COMPAT_SYS_TIME |
663 | 664 | ||
diff --git a/include/asm-x86_64/unwind.h b/include/asm-x86_64/unwind.h index 1f6e9bfb569e..2e7ff10fd775 100644 --- a/include/asm-x86_64/unwind.h +++ b/include/asm-x86_64/unwind.h | |||
@@ -18,6 +18,7 @@ struct unwind_frame_info | |||
18 | { | 18 | { |
19 | struct pt_regs regs; | 19 | struct pt_regs regs; |
20 | struct task_struct *task; | 20 | struct task_struct *task; |
21 | unsigned call_frame:1; | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | #define UNW_PC(frame) (frame)->regs.rip | 24 | #define UNW_PC(frame) (frame)->regs.rip |
@@ -57,6 +58,10 @@ struct unwind_frame_info | |||
57 | PTREGS_INFO(r15), \ | 58 | PTREGS_INFO(r15), \ |
58 | PTREGS_INFO(rip) | 59 | PTREGS_INFO(rip) |
59 | 60 | ||
61 | #define UNW_DEFAULT_RA(raItem, dataAlign) \ | ||
62 | ((raItem).where == Memory && \ | ||
63 | !((raItem).value * (dataAlign) + 8)) | ||
64 | |||
60 | static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, | 65 | static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, |
61 | /*const*/ struct pt_regs *regs) | 66 | /*const*/ struct pt_regs *regs) |
62 | { | 67 | { |
@@ -94,8 +99,8 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info) | |||
94 | 99 | ||
95 | #else | 100 | #else |
96 | 101 | ||
97 | #define UNW_PC(frame) ((void)(frame), 0) | 102 | #define UNW_PC(frame) ((void)(frame), 0UL) |
98 | #define UNW_SP(frame) ((void)(frame), 0) | 103 | #define UNW_SP(frame) ((void)(frame), 0UL) |
99 | 104 | ||
100 | static inline int arch_unw_user_mode(const void *info) | 105 | static inline int arch_unw_user_mode(const void *info) |
101 | { | 106 | { |
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index 146b24402a5f..2281e9399b96 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h | |||
@@ -4,6 +4,7 @@ | |||
4 | enum vsyscall_num { | 4 | enum vsyscall_num { |
5 | __NR_vgettimeofday, | 5 | __NR_vgettimeofday, |
6 | __NR_vtime, | 6 | __NR_vtime, |
7 | __NR_vgetcpu, | ||
7 | }; | 8 | }; |
8 | 9 | ||
9 | #define VSYSCALL_START (-10UL << 20) | 10 | #define VSYSCALL_START (-10UL << 20) |
@@ -15,6 +16,7 @@ enum vsyscall_num { | |||
15 | #include <linux/seqlock.h> | 16 | #include <linux/seqlock.h> |
16 | 17 | ||
17 | #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) | 18 | #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) |
19 | #define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16))) | ||
18 | #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) | 20 | #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) |
19 | #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) | 21 | #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) |
20 | #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) | 22 | #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) |
@@ -26,6 +28,9 @@ enum vsyscall_num { | |||
26 | #define VXTIME_HPET 2 | 28 | #define VXTIME_HPET 2 |
27 | #define VXTIME_PMTMR 3 | 29 | #define VXTIME_PMTMR 3 |
28 | 30 | ||
31 | #define VGETCPU_RDTSCP 1 | ||
32 | #define VGETCPU_LSL 2 | ||
33 | |||
29 | struct vxtime_data { | 34 | struct vxtime_data { |
30 | long hpet_address; /* HPET base address */ | 35 | long hpet_address; /* HPET base address */ |
31 | int last; | 36 | int last; |
@@ -40,6 +45,7 @@ struct vxtime_data { | |||
40 | 45 | ||
41 | /* vsyscall space (readonly) */ | 46 | /* vsyscall space (readonly) */ |
42 | extern struct vxtime_data __vxtime; | 47 | extern struct vxtime_data __vxtime; |
48 | extern int __vgetcpu_mode; | ||
43 | extern struct timespec __xtime; | 49 | extern struct timespec __xtime; |
44 | extern volatile unsigned long __jiffies; | 50 | extern volatile unsigned long __jiffies; |
45 | extern unsigned long __wall_jiffies; | 51 | extern unsigned long __wall_jiffies; |
@@ -48,6 +54,7 @@ extern seqlock_t __xtime_lock; | |||
48 | 54 | ||
49 | /* kernel space (writeable) */ | 55 | /* kernel space (writeable) */ |
50 | extern struct vxtime_data vxtime; | 56 | extern struct vxtime_data vxtime; |
57 | extern int vgetcpu_mode; | ||
51 | extern unsigned long wall_jiffies; | 58 | extern unsigned long wall_jiffies; |
52 | extern struct timezone sys_tz; | 59 | extern struct timezone sys_tz; |
53 | extern int sysctl_vsyscall; | 60 | extern int sysctl_vsyscall; |
@@ -55,6 +62,8 @@ extern seqlock_t xtime_lock; | |||
55 | 62 | ||
56 | extern int sysctl_vsyscall; | 63 | extern int sysctl_vsyscall; |
57 | 64 | ||
65 | extern void vsyscall_set_cpu(int cpu); | ||
66 | |||
58 | #define ARCH_HAVE_XTIME_LOCK 1 | 67 | #define ARCH_HAVE_XTIME_LOCK 1 |
59 | 68 | ||
60 | #endif /* __KERNEL__ */ | 69 | #endif /* __KERNEL__ */ |