aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86_64')
-rw-r--r--include/asm-x86_64/apicdef.h1
-rw-r--r--include/asm-x86_64/atomic.h8
-rw-r--r--include/asm-x86_64/bitops.h42
-rw-r--r--include/asm-x86_64/cache.h2
-rw-r--r--include/asm-x86_64/dmi.h27
-rw-r--r--include/asm-x86_64/elf.h4
-rw-r--r--include/asm-x86_64/floppy.h2
-rw-r--r--include/asm-x86_64/futex.h27
-rw-r--r--include/asm-x86_64/io.h38
-rw-r--r--include/asm-x86_64/kdebug.h23
-rw-r--r--include/asm-x86_64/local.h18
-rw-r--r--include/asm-x86_64/mmu_context.h6
-rw-r--r--include/asm-x86_64/mmzone.h13
-rw-r--r--include/asm-x86_64/numa.h4
-rw-r--r--include/asm-x86_64/page.h3
-rw-r--r--include/asm-x86_64/pda.h2
-rw-r--r--include/asm-x86_64/percpu.h7
-rw-r--r--include/asm-x86_64/pgalloc.h28
-rw-r--r--include/asm-x86_64/pgtable.h14
-rw-r--r--include/asm-x86_64/poll.h1
-rw-r--r--include/asm-x86_64/processor.h7
-rw-r--r--include/asm-x86_64/proto.h3
-rw-r--r--include/asm-x86_64/smp.h1
-rw-r--r--include/asm-x86_64/string.h17
-rw-r--r--include/asm-x86_64/suspend.h4
-rw-r--r--include/asm-x86_64/system.h6
-rw-r--r--include/asm-x86_64/topology.h2
-rw-r--r--include/asm-x86_64/unistd.h10
28 files changed, 172 insertions, 148 deletions
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index decaa2d540e8..5a48e9bcf218 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -39,6 +39,7 @@
39#define APIC_SPIV_FOCUS_DISABLED (1<<9) 39#define APIC_SPIV_FOCUS_DISABLED (1<<9)
40#define APIC_SPIV_APIC_ENABLED (1<<8) 40#define APIC_SPIV_APIC_ENABLED (1<<8)
41#define APIC_ISR 0x100 41#define APIC_ISR 0x100
42#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */
42#define APIC_TMR 0x180 43#define APIC_TMR 0x180
43#define APIC_IRR 0x200 44#define APIC_IRR 0x200
44#define APIC_ESR 0x280 45#define APIC_ESR 0x280
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 4b5cd553e772..cecbf7baa6aa 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -405,8 +405,14 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t *v)
405({ \ 405({ \
406 int c, old; \ 406 int c, old; \
407 c = atomic_read(v); \ 407 c = atomic_read(v); \
408 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 408 for (;;) { \
409 if (unlikely(c == (u))) \
410 break; \
411 old = atomic_cmpxchg((v), c, c + (a)); \
412 if (likely(old == c)) \
413 break; \
409 c = old; \ 414 c = old; \
415 } \
410 c != (u); \ 416 c != (u); \
411}) 417})
412#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 418#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index eb4df23e1e41..79212128d0f7 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -356,14 +356,7 @@ static __inline__ unsigned long __fls(unsigned long word)
356 356
357#ifdef __KERNEL__ 357#ifdef __KERNEL__
358 358
359static inline int sched_find_first_bit(const unsigned long *b) 359#include <asm-generic/bitops/sched.h>
360{
361 if (b[0])
362 return __ffs(b[0]);
363 if (b[1])
364 return __ffs(b[1]) + 64;
365 return __ffs(b[2]) + 128;
366}
367 360
368/** 361/**
369 * ffs - find first bit set 362 * ffs - find first bit set
@@ -412,43 +405,20 @@ static __inline__ int fls(int x)
412 return r+1; 405 return r+1;
413} 406}
414 407
415/** 408#include <asm-generic/bitops/hweight.h>
416 * hweightN - returns the hamming weight of a N-bit word
417 * @x: the word to weigh
418 *
419 * The Hamming Weight of a number is the total number of bits set in it.
420 */
421
422#define hweight64(x) generic_hweight64(x)
423#define hweight32(x) generic_hweight32(x)
424#define hweight16(x) generic_hweight16(x)
425#define hweight8(x) generic_hweight8(x)
426 409
427#endif /* __KERNEL__ */ 410#endif /* __KERNEL__ */
428 411
429#ifdef __KERNEL__ 412#ifdef __KERNEL__
430 413
431#define ext2_set_bit(nr,addr) \ 414#include <asm-generic/bitops/ext2-non-atomic.h>
432 __test_and_set_bit((nr),(unsigned long*)addr) 415
433#define ext2_set_bit_atomic(lock,nr,addr) \ 416#define ext2_set_bit_atomic(lock,nr,addr) \
434 test_and_set_bit((nr),(unsigned long*)addr) 417 test_and_set_bit((nr),(unsigned long*)addr)
435#define ext2_clear_bit(nr, addr) \
436 __test_and_clear_bit((nr),(unsigned long*)addr)
437#define ext2_clear_bit_atomic(lock,nr,addr) \ 418#define ext2_clear_bit_atomic(lock,nr,addr) \
438 test_and_clear_bit((nr),(unsigned long*)addr) 419 test_and_clear_bit((nr),(unsigned long*)addr)
439#define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) 420
440#define ext2_find_first_zero_bit(addr, size) \ 421#include <asm-generic/bitops/minix.h>
441 find_first_zero_bit((unsigned long*)addr, size)
442#define ext2_find_next_zero_bit(addr, size, off) \
443 find_next_zero_bit((unsigned long*)addr, size, off)
444
445/* Bitmap functions for the minix filesystem. */
446#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
447#define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
448#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
449#define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
450#define minix_find_first_zero_bit(addr,size) \
451 find_first_zero_bit((void*)addr,size)
452 422
453#endif /* __KERNEL__ */ 423#endif /* __KERNEL__ */
454 424
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h
index 263f0a211ed7..c8043a16152e 100644
--- a/include/asm-x86_64/cache.h
+++ b/include/asm-x86_64/cache.h
@@ -20,6 +20,8 @@
20 __attribute__((__section__(".data.page_aligned"))) 20 __attribute__((__section__(".data.page_aligned")))
21#endif 21#endif
22 22
23#define __read_mostly __attribute__((__section__(".data.read_mostly")))
24
23#endif 25#endif
24 26
25#endif 27#endif
diff --git a/include/asm-x86_64/dmi.h b/include/asm-x86_64/dmi.h
new file mode 100644
index 000000000000..93b2b15d4325
--- /dev/null
+++ b/include/asm-x86_64/dmi.h
@@ -0,0 +1,27 @@
1#ifndef _ASM_DMI_H
2#define _ASM_DMI_H 1
3
4#include <asm/io.h>
5
6extern void *dmi_ioremap(unsigned long addr, unsigned long size);
7extern void dmi_iounmap(void *addr, unsigned long size);
8
9#define DMI_MAX_DATA 2048
10
11extern int dmi_alloc_index;
12extern char dmi_alloc_data[DMI_MAX_DATA];
13
14/* This is so early that there is no good way to allocate dynamic memory.
15 Allocate data in an BSS array. */
16static inline void *dmi_alloc(unsigned len)
17{
18 int idx = dmi_alloc_index;
19 if ((dmi_alloc_index += len) > DMI_MAX_DATA)
20 return NULL;
21 return dmi_alloc_data + idx;
22}
23
24#define dmi_ioremap early_ioremap
25#define dmi_iounmap early_iounmap
26
27#endif
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index 43862cd6a569..c98633af07d2 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -8,6 +8,7 @@
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <asm/user.h> 9#include <asm/user.h>
10#include <asm/processor.h> 10#include <asm/processor.h>
11#include <asm/compat.h>
11 12
12/* x86-64 relocation types */ 13/* x86-64 relocation types */
13#define R_X86_64_NONE 0 /* No reloc */ 14#define R_X86_64_NONE 0 /* No reloc */
@@ -157,6 +158,9 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
157#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) 158#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
158#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 159#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
159 160
161/* 1GB for 64bit, 8MB for 32bit */
162#define STACK_RND_MASK (is_compat_task() ? 0x7ff : 0x3fffff)
163
160#endif 164#endif
161 165
162#endif 166#endif
diff --git a/include/asm-x86_64/floppy.h b/include/asm-x86_64/floppy.h
index af7ded63b517..52825ce689f2 100644
--- a/include/asm-x86_64/floppy.h
+++ b/include/asm-x86_64/floppy.h
@@ -155,7 +155,7 @@ static int fd_request_irq(void)
155 155
156static unsigned long dma_mem_alloc(unsigned long size) 156static unsigned long dma_mem_alloc(unsigned long size)
157{ 157{
158 return __get_dma_pages(GFP_KERNEL,get_order(size)); 158 return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY,get_order(size));
159} 159}
160 160
161 161
diff --git a/include/asm-x86_64/futex.h b/include/asm-x86_64/futex.h
index 8602c09bf89e..9804bf07b092 100644
--- a/include/asm-x86_64/futex.h
+++ b/include/asm-x86_64/futex.h
@@ -94,5 +94,32 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
94 return ret; 94 return ret;
95} 95}
96 96
97static inline int
98futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
99{
100 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
101 return -EFAULT;
102
103 __asm__ __volatile__(
104 "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
105
106 "2: .section .fixup, \"ax\" \n"
107 "3: mov %2, %0 \n"
108 " jmp 2b \n"
109 " .previous \n"
110
111 " .section __ex_table, \"a\" \n"
112 " .align 8 \n"
113 " .quad 1b,3b \n"
114 " .previous \n"
115
116 : "=a" (oldval), "=m" (*uaddr)
117 : "i" (-EFAULT), "r" (newval), "0" (oldval)
118 : "memory"
119 );
120
121 return oldval;
122}
123
97#endif 124#endif
98#endif 125#endif
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 9dac18db8291..cafdfb37f0d8 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -135,6 +135,9 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
135 return __ioremap(offset, size, 0); 135 return __ioremap(offset, size, 0);
136} 136}
137 137
138extern void *early_ioremap(unsigned long addr, unsigned long size);
139extern void early_iounmap(void *addr, unsigned long size);
140
138/* 141/*
139 * This one maps high address device memory and turns off caching for that area. 142 * This one maps high address device memory and turns off caching for that area.
140 * it's useful if some control registers are in such an area and write combining 143 * it's useful if some control registers are in such an area and write combining
@@ -143,11 +146,6 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
143extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 146extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
144extern void iounmap(volatile void __iomem *addr); 147extern void iounmap(volatile void __iomem *addr);
145 148
146/* Use normal IO mappings for DMI */
147#define dmi_ioremap ioremap
148#define dmi_iounmap(x,l) iounmap(x)
149#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
150
151/* 149/*
152 * ISA I/O bus memory addresses are 1:1 with the physical address. 150 * ISA I/O bus memory addresses are 1:1 with the physical address.
153 */ 151 */
@@ -202,23 +200,6 @@ static inline __u64 __readq(const volatile void __iomem *addr)
202 200
203#define mmiowb() 201#define mmiowb()
204 202
205#ifdef CONFIG_UNORDERED_IO
206static inline void __writel(__u32 val, volatile void __iomem *addr)
207{
208 volatile __u32 __iomem *target = addr;
209 asm volatile("movnti %1,%0"
210 : "=m" (*target)
211 : "r" (val) : "memory");
212}
213
214static inline void __writeq(__u64 val, volatile void __iomem *addr)
215{
216 volatile __u64 __iomem *target = addr;
217 asm volatile("movnti %1,%0"
218 : "=m" (*target)
219 : "r" (val) : "memory");
220}
221#else
222static inline void __writel(__u32 b, volatile void __iomem *addr) 203static inline void __writel(__u32 b, volatile void __iomem *addr)
223{ 204{
224 *(__force volatile __u32 *)addr = b; 205 *(__force volatile __u32 *)addr = b;
@@ -227,7 +208,6 @@ static inline void __writeq(__u64 b, volatile void __iomem *addr)
227{ 208{
228 *(__force volatile __u64 *)addr = b; 209 *(__force volatile __u64 *)addr = b;
229} 210}
230#endif
231static inline void __writeb(__u8 b, volatile void __iomem *addr) 211static inline void __writeb(__u8 b, volatile void __iomem *addr)
232{ 212{
233 *(__force volatile __u8 *)addr = b; 213 *(__force volatile __u8 *)addr = b;
@@ -269,23 +249,11 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
269 */ 249 */
270#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 250#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
271 251
272#define isa_readb(a) readb(__ISA_IO_base + (a))
273#define isa_readw(a) readw(__ISA_IO_base + (a))
274#define isa_readl(a) readl(__ISA_IO_base + (a))
275#define isa_writeb(b,a) writeb(b,__ISA_IO_base + (a))
276#define isa_writew(w,a) writew(w,__ISA_IO_base + (a))
277#define isa_writel(l,a) writel(l,__ISA_IO_base + (a))
278#define isa_memset_io(a,b,c) memset_io(__ISA_IO_base + (a),(b),(c))
279#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c))
280#define isa_memcpy_toio(a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c))
281
282
283/* 252/*
284 * Again, x86-64 does not require mem IO specific function. 253 * Again, x86-64 does not require mem IO specific function.
285 */ 254 */
286 255
287#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) 256#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
288#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(__ISA_IO_base + (b)),(c),(d))
289 257
290/** 258/**
291 * check_signature - find BIOS signatures 259 * check_signature - find BIOS signatures
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h
index b9ed4c0c8783..cf795631d9b4 100644
--- a/include/asm-x86_64/kdebug.h
+++ b/include/asm-x86_64/kdebug.h
@@ -5,21 +5,20 @@
5 5
6struct pt_regs; 6struct pt_regs;
7 7
8struct die_args { 8struct die_args {
9 struct pt_regs *regs; 9 struct pt_regs *regs;
10 const char *str; 10 const char *str;
11 long err; 11 long err;
12 int trapnr; 12 int trapnr;
13 int signr; 13 int signr;
14}; 14};
15
16extern int register_die_notifier(struct notifier_block *);
17extern int unregister_die_notifier(struct notifier_block *);
18extern struct atomic_notifier_head die_chain;
15 19
16/* Note - you should never unregister because that can race with NMIs.
17 If you really want to do it first unregister - then synchronize_sched - then free.
18 */
19int register_die_notifier(struct notifier_block *nb);
20extern struct notifier_block *die_chain;
21/* Grossly misnamed. */ 20/* Grossly misnamed. */
22enum die_val { 21enum die_val {
23 DIE_OOPS = 1, 22 DIE_OOPS = 1,
24 DIE_INT3, 23 DIE_INT3,
25 DIE_DEBUG, 24 DIE_DEBUG,
@@ -33,8 +32,8 @@ enum die_val {
33 DIE_CALL, 32 DIE_CALL,
34 DIE_NMI_IPI, 33 DIE_NMI_IPI,
35 DIE_PAGE_FAULT, 34 DIE_PAGE_FAULT,
36}; 35};
37 36
38static inline int notify_die(enum die_val val, const char *str, 37static inline int notify_die(enum die_val val, const char *str,
39 struct pt_regs *regs, long err, int trap, int sig) 38 struct pt_regs *regs, long err, int trap, int sig)
40{ 39{
@@ -45,7 +44,7 @@ static inline int notify_die(enum die_val val, const char *str,
45 .trapnr = trap, 44 .trapnr = trap,
46 .signr = sig 45 .signr = sig
47 }; 46 };
48 return notifier_call_chain(&die_chain, val, &args); 47 return atomic_notifier_call_chain(&die_chain, val, &args);
49} 48}
50 49
51extern int printk_address(unsigned long address); 50extern int printk_address(unsigned long address);
diff --git a/include/asm-x86_64/local.h b/include/asm-x86_64/local.h
index 3e72c41727c5..cd17945bf218 100644
--- a/include/asm-x86_64/local.h
+++ b/include/asm-x86_64/local.h
@@ -5,7 +5,7 @@
5 5
6typedef struct 6typedef struct
7{ 7{
8 volatile unsigned int counter; 8 volatile long counter;
9} local_t; 9} local_t;
10 10
11#define LOCAL_INIT(i) { (i) } 11#define LOCAL_INIT(i) { (i) }
@@ -13,34 +13,34 @@ typedef struct
13#define local_read(v) ((v)->counter) 13#define local_read(v) ((v)->counter)
14#define local_set(v,i) (((v)->counter) = (i)) 14#define local_set(v,i) (((v)->counter) = (i))
15 15
16static __inline__ void local_inc(local_t *v) 16static inline void local_inc(local_t *v)
17{ 17{
18 __asm__ __volatile__( 18 __asm__ __volatile__(
19 "incl %0" 19 "incq %0"
20 :"=m" (v->counter) 20 :"=m" (v->counter)
21 :"m" (v->counter)); 21 :"m" (v->counter));
22} 22}
23 23
24static __inline__ void local_dec(local_t *v) 24static inline void local_dec(local_t *v)
25{ 25{
26 __asm__ __volatile__( 26 __asm__ __volatile__(
27 "decl %0" 27 "decq %0"
28 :"=m" (v->counter) 28 :"=m" (v->counter)
29 :"m" (v->counter)); 29 :"m" (v->counter));
30} 30}
31 31
32static __inline__ void local_add(unsigned int i, local_t *v) 32static inline void local_add(long i, local_t *v)
33{ 33{
34 __asm__ __volatile__( 34 __asm__ __volatile__(
35 "addl %1,%0" 35 "addq %1,%0"
36 :"=m" (v->counter) 36 :"=m" (v->counter)
37 :"ir" (i), "m" (v->counter)); 37 :"ir" (i), "m" (v->counter));
38} 38}
39 39
40static __inline__ void local_sub(unsigned int i, local_t *v) 40static inline void local_sub(long i, local_t *v)
41{ 41{
42 __asm__ __volatile__( 42 __asm__ __volatile__(
43 "subl %1,%0" 43 "subq %1,%0"
44 :"=m" (v->counter) 44 :"=m" (v->counter)
45 :"ir" (i), "m" (v->counter)); 45 :"ir" (i), "m" (v->counter));
46} 46}
diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h
index 16e4be4de0c5..19f0c83d0792 100644
--- a/include/asm-x86_64/mmu_context.h
+++ b/include/asm-x86_64/mmu_context.h
@@ -34,12 +34,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
34 unsigned cpu = smp_processor_id(); 34 unsigned cpu = smp_processor_id();
35 if (likely(prev != next)) { 35 if (likely(prev != next)) {
36 /* stop flush ipis for the previous mm */ 36 /* stop flush ipis for the previous mm */
37 clear_bit(cpu, &prev->cpu_vm_mask); 37 cpu_clear(cpu, prev->cpu_vm_mask);
38#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
39 write_pda(mmu_state, TLBSTATE_OK); 39 write_pda(mmu_state, TLBSTATE_OK);
40 write_pda(active_mm, next); 40 write_pda(active_mm, next);
41#endif 41#endif
42 set_bit(cpu, &next->cpu_vm_mask); 42 cpu_set(cpu, next->cpu_vm_mask);
43 load_cr3(next->pgd); 43 load_cr3(next->pgd);
44 44
45 if (unlikely(next->context.ldt != prev->context.ldt)) 45 if (unlikely(next->context.ldt != prev->context.ldt))
@@ -50,7 +50,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
50 write_pda(mmu_state, TLBSTATE_OK); 50 write_pda(mmu_state, TLBSTATE_OK);
51 if (read_pda(active_mm) != next) 51 if (read_pda(active_mm) != next)
52 out_of_line_bug(); 52 out_of_line_bug();
53 if(!test_and_set_bit(cpu, &next->cpu_vm_mask)) { 53 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
54 /* We were in lazy tlb mode and leave_mm disabled 54 /* We were in lazy tlb mode and leave_mm disabled
55 * tlb flush IPI delivery. We must reload CR3 55 * tlb flush IPI delivery. We must reload CR3
56 * to make sure to use no freed page tables. 56 * to make sure to use no freed page tables.
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index 972c9359f7d7..6b18cd8f293d 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -15,8 +15,13 @@
15#define NODEMAPSIZE 0xfff 15#define NODEMAPSIZE 0xfff
16 16
17/* Simple perfect hash to map physical addresses to node numbers */ 17/* Simple perfect hash to map physical addresses to node numbers */
18extern int memnode_shift; 18struct memnode {
19extern u8 memnodemap[NODEMAPSIZE]; 19 int shift;
20 u8 map[NODEMAPSIZE];
21} ____cacheline_aligned;
22extern struct memnode memnode;
23#define memnode_shift memnode.shift
24#define memnodemap memnode.map
20 25
21extern struct pglist_data *node_data[]; 26extern struct pglist_data *node_data[];
22 27
@@ -39,12 +44,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
39#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) 44#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
40#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) 45#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
41 46
42extern struct page *pfn_to_page(unsigned long pfn);
43extern unsigned long page_to_pfn(struct page *page);
44extern int pfn_valid(unsigned long pfn); 47extern int pfn_valid(unsigned long pfn);
45#endif 48#endif
46 49
47#define local_mapnr(kvaddr) \
48 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) )
49#endif 50#endif
50#endif 51#endif
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index dffe276ca2df..f6cbb4cbb5a3 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -4,11 +4,11 @@
4#include <linux/nodemask.h> 4#include <linux/nodemask.h>
5#include <asm/numnodes.h> 5#include <asm/numnodes.h>
6 6
7struct node { 7struct bootnode {
8 u64 start,end; 8 u64 start,end;
9}; 9};
10 10
11extern int compute_hash_shift(struct node *nodes, int numnodes); 11extern int compute_hash_shift(struct bootnode *nodes, int numnodes);
12extern int pxm_to_node(int nid); 12extern int pxm_to_node(int nid);
13 13
14#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) 14#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 615e3e494929..408185bac351 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -123,8 +123,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
123#define __boot_va(x) __va(x) 123#define __boot_va(x) __va(x)
124#define __boot_pa(x) __pa(x) 124#define __boot_pa(x) __pa(x)
125#ifdef CONFIG_FLATMEM 125#ifdef CONFIG_FLATMEM
126#define pfn_to_page(pfn) (mem_map + (pfn))
127#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
128#define pfn_valid(pfn) ((pfn) < end_pfn) 126#define pfn_valid(pfn) ((pfn) < end_pfn)
129#endif 127#endif
130 128
@@ -140,6 +138,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
140 138
141#endif /* __KERNEL__ */ 139#endif /* __KERNEL__ */
142 140
141#include <asm-generic/memory_model.h>
143#include <asm-generic/page.h> 142#include <asm-generic/page.h>
144 143
145#endif /* _X86_64_PAGE_H */ 144#endif /* _X86_64_PAGE_H */
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index c7ab38a601af..b47c3df9ed1d 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -22,8 +22,8 @@ struct x8664_pda {
22 int nodenumber; /* number of current node */ 22 int nodenumber; /* number of current node */
23 unsigned int __softirq_pending; 23 unsigned int __softirq_pending;
24 unsigned int __nmi_count; /* number of NMI on this CPUs */ 24 unsigned int __nmi_count; /* number of NMI on this CPUs */
25 struct mm_struct *active_mm;
26 int mmu_state; 25 int mmu_state;
26 struct mm_struct *active_mm;
27 unsigned apic_timer_irqs; 27 unsigned apic_timer_irqs;
28} ____cacheline_aligned_in_smp; 28} ____cacheline_aligned_in_smp;
29 29
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 29a6b0408f75..4405b4adeaba 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -26,10 +26,9 @@
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for (__i = 0; __i < NR_CPUS; __i++) \ 29 for_each_cpu(__i) \
30 if (cpu_possible(__i)) \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 memcpy((pcpudst)+__per_cpu_offset(__i), \ 31 (src), (size)); \
32 (src), (size)); \
33} while (0) 32} while (0)
34 33
35extern void setup_per_cpu_areas(void); 34extern void setup_per_cpu_areas(void);
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 08cad2482bcb..43d4c333a8b1 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -45,12 +45,39 @@ static inline void pud_free (pud_t *pud)
45 free_page((unsigned long)pud); 45 free_page((unsigned long)pud);
46} 46}
47 47
48static inline void pgd_list_add(pgd_t *pgd)
49{
50 struct page *page = virt_to_page(pgd);
51
52 spin_lock(&pgd_lock);
53 page->index = (pgoff_t)pgd_list;
54 if (pgd_list)
55 pgd_list->private = (unsigned long)&page->index;
56 pgd_list = page;
57 page->private = (unsigned long)&pgd_list;
58 spin_unlock(&pgd_lock);
59}
60
61static inline void pgd_list_del(pgd_t *pgd)
62{
63 struct page *next, **pprev, *page = virt_to_page(pgd);
64
65 spin_lock(&pgd_lock);
66 next = (struct page *)page->index;
67 pprev = (struct page **)page->private;
68 *pprev = next;
69 if (next)
70 next->private = (unsigned long)pprev;
71 spin_unlock(&pgd_lock);
72}
73
48static inline pgd_t *pgd_alloc(struct mm_struct *mm) 74static inline pgd_t *pgd_alloc(struct mm_struct *mm)
49{ 75{
50 unsigned boundary; 76 unsigned boundary;
51 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 77 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
52 if (!pgd) 78 if (!pgd)
53 return NULL; 79 return NULL;
80 pgd_list_add(pgd);
54 /* 81 /*
55 * Copy kernel pointers in from init. 82 * Copy kernel pointers in from init.
56 * Could keep a freelist or slab cache of those because the kernel 83 * Could keep a freelist or slab cache of those because the kernel
@@ -67,6 +94,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
67static inline void pgd_free(pgd_t *pgd) 94static inline void pgd_free(pgd_t *pgd)
68{ 95{
69 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1)); 96 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
97 pgd_list_del(pgd);
70 free_page((unsigned long)pgd); 98 free_page((unsigned long)pgd);
71} 99}
72 100
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 715fd94cf577..31e83c3bd022 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -273,7 +273,7 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
273static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 273static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
274static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 274static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
275static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 275static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
276static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; } 276static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; }
277 277
278static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 278static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
279static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 279static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
@@ -285,7 +285,7 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _
285static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 285static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
286static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 286static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
287static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 287static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
288static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; } 288static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; }
289 289
290struct vm_area_struct; 290struct vm_area_struct;
291 291
@@ -293,19 +293,19 @@ static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned
293{ 293{
294 if (!pte_dirty(*ptep)) 294 if (!pte_dirty(*ptep))
295 return 0; 295 return 0;
296 return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); 296 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte);
297} 297}
298 298
299static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 299static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
300{ 300{
301 if (!pte_young(*ptep)) 301 if (!pte_young(*ptep))
302 return 0; 302 return 0;
303 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); 303 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte);
304} 304}
305 305
306static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 306static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
307{ 307{
308 clear_bit(_PAGE_BIT_RW, ptep); 308 clear_bit(_PAGE_BIT_RW, &ptep->pte);
309} 309}
310 310
311/* 311/*
@@ -420,6 +420,10 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
420#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 420#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
421#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 421#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
422 422
423extern spinlock_t pgd_lock;
424extern struct page *pgd_list;
425void vmalloc_sync_all(void);
426
423#endif /* !__ASSEMBLY__ */ 427#endif /* !__ASSEMBLY__ */
424 428
425extern int kern_addr_valid(unsigned long addr); 429extern int kern_addr_valid(unsigned long addr);
diff --git a/include/asm-x86_64/poll.h b/include/asm-x86_64/poll.h
index c43cbba31913..c0475a9d8bb8 100644
--- a/include/asm-x86_64/poll.h
+++ b/include/asm-x86_64/poll.h
@@ -16,6 +16,7 @@
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000 18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
19 20
20struct pollfd { 21struct pollfd {
21 int fd; 22 int fd;
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 8c8d88c036ed..37a3ec433ee5 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -20,6 +20,7 @@
20#include <asm/mmsegment.h> 20#include <asm/mmsegment.h>
21#include <asm/percpu.h> 21#include <asm/percpu.h>
22#include <linux/personality.h> 22#include <linux/personality.h>
23#include <linux/cpumask.h>
23 24
24#define TF_MASK 0x00000100 25#define TF_MASK 0x00000100
25#define IF_MASK 0x00000200 26#define IF_MASK 0x00000200
@@ -65,6 +66,9 @@ struct cpuinfo_x86 {
65 __u32 x86_power; 66 __u32 x86_power;
66 __u32 extended_cpuid_level; /* Max extended CPUID function supported */ 67 __u32 extended_cpuid_level; /* Max extended CPUID function supported */
67 unsigned long loops_per_jiffy; 68 unsigned long loops_per_jiffy;
69#ifdef CONFIG_SMP
70 cpumask_t llc_shared_map; /* cpus sharing the last level cache */
71#endif
68 __u8 apicid; 72 __u8 apicid;
69 __u8 booted_cores; /* number of cores as seen by OS */ 73 __u8 booted_cores; /* number of cores as seen by OS */
70} ____cacheline_aligned; 74} ____cacheline_aligned;
@@ -354,9 +358,6 @@ struct extended_sigtable {
354 struct extended_signature sigs[0]; 358 struct extended_signature sigs[0];
355}; 359};
356 360
357/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */
358#define MICROCODE_IOCFREE _IO('6',0)
359
360 361
361#define ASM_NOP1 K8_NOP1 362#define ASM_NOP1 K8_NOP1
362#define ASM_NOP2 K8_NOP2 363#define ASM_NOP2 K8_NOP2
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 3ba8fd45fcb3..8abf2a43c944 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -53,8 +53,6 @@ extern int sysctl_vsyscall;
53extern int nohpet; 53extern int nohpet;
54extern unsigned long vxtime_hz; 54extern unsigned long vxtime_hz;
55 55
56extern void do_softirq_thunk(void);
57
58extern int numa_setup(char *opt); 56extern int numa_setup(char *opt);
59 57
60extern int setup_early_printk(char *); 58extern int setup_early_printk(char *);
@@ -129,7 +127,6 @@ extern int fix_aperture;
129#define iommu_aperture 0 127#define iommu_aperture 0
130#define iommu_aperture_allowed 0 128#define iommu_aperture_allowed 0
131#endif 129#endif
132extern int force_iommu;
133 130
134extern int reboot_force; 131extern int reboot_force;
135extern int notsc_setup(char *); 132extern int notsc_setup(char *);
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index 9ccbb2cfd5c0..a4fdaeb5c397 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -56,6 +56,7 @@ extern cpumask_t cpu_sibling_map[NR_CPUS];
56extern cpumask_t cpu_core_map[NR_CPUS]; 56extern cpumask_t cpu_core_map[NR_CPUS];
57extern u8 phys_proc_id[NR_CPUS]; 57extern u8 phys_proc_id[NR_CPUS];
58extern u8 cpu_core_id[NR_CPUS]; 58extern u8 cpu_core_id[NR_CPUS];
59extern u8 cpu_llc_id[NR_CPUS];
59 60
60#define SMP_TRAMPOLINE_BASE 0x6000 61#define SMP_TRAMPOLINE_BASE 0x6000
61 62
diff --git a/include/asm-x86_64/string.h b/include/asm-x86_64/string.h
index a3493ee282bb..ee6bf275349e 100644
--- a/include/asm-x86_64/string.h
+++ b/include/asm-x86_64/string.h
@@ -40,26 +40,15 @@ extern void *__memcpy(void *to, const void *from, size_t len);
40 40
41 41
42#define __HAVE_ARCH_MEMSET 42#define __HAVE_ARCH_MEMSET
43#define memset __builtin_memset 43void *memset(void *s, int c, size_t n);
44 44
45#define __HAVE_ARCH_MEMMOVE 45#define __HAVE_ARCH_MEMMOVE
46void * memmove(void * dest,const void *src,size_t count); 46void * memmove(void * dest,const void *src,size_t count);
47 47
48/* Use C out of line version for memcmp */
49#define memcmp __builtin_memcmp
50int memcmp(const void * cs,const void * ct,size_t count); 48int memcmp(const void * cs,const void * ct,size_t count);
51
52/* out of line string functions use always C versions */
53#define strlen __builtin_strlen
54size_t strlen(const char * s); 49size_t strlen(const char * s);
55 50char *strcpy(char * dest,const char *src);
56#define strcpy __builtin_strcpy 51char *strcat(char * dest, const char * src);
57char * strcpy(char * dest,const char *src);
58
59#define strcat __builtin_strcat
60char * strcat(char * dest, const char * src);
61
62#define strcmp __builtin_strcmp
63int strcmp(const char * cs,const char * ct); 52int strcmp(const char * cs,const char * ct);
64 53
65#endif /* __KERNEL__ */ 54#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h
index bb9f40597d09..bc7f81715e5e 100644
--- a/include/asm-x86_64/suspend.h
+++ b/include/asm-x86_64/suspend.h
@@ -39,9 +39,7 @@ extern unsigned long saved_context_r12, saved_context_r13, saved_context_r14, sa
39extern unsigned long saved_context_eflags; 39extern unsigned long saved_context_eflags;
40 40
41#define loaddebug(thread,register) \ 41#define loaddebug(thread,register) \
42 __asm__("movq %0,%%db" #register \ 42 set_debugreg((thread)->debugreg##register, register)
43 : /* no output */ \
44 :"r" ((thread)->debugreg##register))
45 43
46extern void fix_processor_context(void); 44extern void fix_processor_context(void);
47 45
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index b7f66034ae7a..397598980228 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -70,12 +70,6 @@ extern void load_gs_index(unsigned);
70 ".previous" \ 70 ".previous" \
71 : :"r" (value), "r" (0)) 71 : :"r" (value), "r" (0))
72 72
73#define set_debug(value,register) \
74 __asm__("movq %0,%%db" #register \
75 : /* no output */ \
76 :"r" ((unsigned long) value))
77
78
79#ifdef __KERNEL__ 73#ifdef __KERNEL__
80struct alt_instr { 74struct alt_instr {
81 __u8 *instr; /* original instruction */ 75 __u8 *instr; /* original instruction */
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index c642f5d9882d..9db54e9d17bb 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -68,4 +68,6 @@ extern int __node_distance(int, int);
68 68
69#include <asm-generic/topology.h> 69#include <asm-generic/topology.h>
70 70
71extern cpumask_t cpu_coregroup_map(int cpu);
72
71#endif 73#endif
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index da0341c57949..f21ff2c1e960 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -605,8 +605,14 @@ __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */
605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ 605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */
606#define __NR_unshare 272 606#define __NR_unshare 272
607__SYSCALL(__NR_unshare, sys_unshare) 607__SYSCALL(__NR_unshare, sys_unshare)
608 608#define __NR_set_robust_list 273
609#define __NR_syscall_max __NR_unshare 609__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
610#define __NR_get_robust_list 274
611__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
612#define __NR_splice 275
613__SYSCALL(__NR_splice, sys_splice)
614
615#define __NR_syscall_max __NR_splice
610 616
611#ifndef __NO_STUBS 617#ifndef __NO_STUBS
612 618