aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-04 12:16:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-02-04 12:16:03 -0500
commitd2fc0bacd5c438cb459fdf531eff00ab18422a00 (patch)
treed0ea52e4d2ad2fac12e19eaf6891c6af98353cfc /include/asm-x86
parent93890b71a34f9490673a6edd56b61c2124215e46 (diff)
parent795d45b22c079946332bf3825afefe5a981a97b6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86: (78 commits) x86: fix RTC lockdep warning: potential hardirq recursion x86: cpa, micro-optimization x86: cpa, clean up code flow x86: cpa, eliminate CPA_ enum x86: cpa, cleanups x86: implement gbpages support in change_page_attr() x86: support gbpages in pagetable dump x86: add gbpages support to lookup_address x86: add pgtable accessor functions for gbpages x86: add PUD_PAGE_SIZE x86: add feature macros for the gbpages cpuid bit x86: switch direct mapping setup over to set_pte x86: fix page-present check in cpa_flush_range x86: remove cpa warning x86: remove now unused clear_kernel_mapping x86: switch pci-gart over to using set_memory_np() instead of clear_kernel_mapping() x86: cpa selftest, skip non present entries x86: CPA fix pagetable split x86: rename LARGE_PAGE_SIZE to PMD_PAGE_SIZE x86: cpa, fix lookup_address ...
Diffstat (limited to 'include/asm-x86')
-rw-r--r--include/asm-x86/asm.h7
-rw-r--r--include/asm-x86/bugs.h2
-rw-r--r--include/asm-x86/cpufeature.h14
-rw-r--r--include/asm-x86/efi.h4
-rw-r--r--include/asm-x86/futex.h23
-rw-r--r--include/asm-x86/highmem.h4
-rw-r--r--include/asm-x86/hw_irq_32.h2
-rw-r--r--include/asm-x86/i387.h16
-rw-r--r--include/asm-x86/io_32.h25
-rw-r--r--include/asm-x86/mach-numaq/mach_apic.h2
-rw-r--r--include/asm-x86/msr.h10
-rw-r--r--include/asm-x86/page.h4
-rw-r--r--include/asm-x86/page_64.h3
-rw-r--r--include/asm-x86/pgalloc_32.h6
-rw-r--r--include/asm-x86/pgtable-3level.h26
-rw-r--r--include/asm-x86/pgtable.h4
-rw-r--r--include/asm-x86/pgtable_32.h2
-rw-r--r--include/asm-x86/pgtable_64.h7
-rw-r--r--include/asm-x86/string_32.h8
-rw-r--r--include/asm-x86/system.h23
-rw-r--r--include/asm-x86/uaccess_32.h18
-rw-r--r--include/asm-x86/uaccess_64.h10
-rw-r--r--include/asm-x86/vm86.h1
23 files changed, 91 insertions, 130 deletions
diff --git a/include/asm-x86/asm.h b/include/asm-x86/asm.h
index 1a6980a60fc6..90dec0c23646 100644
--- a/include/asm-x86/asm.h
+++ b/include/asm-x86/asm.h
@@ -29,4 +29,11 @@
29 29
30#endif /* CONFIG_X86_32 */ 30#endif /* CONFIG_X86_32 */
31 31
32/* Exception table entry */
33# define _ASM_EXTABLE(from,to) \
34 " .section __ex_table,\"a\"\n" \
35 _ASM_ALIGN "\n" \
36 _ASM_PTR #from "," #to "\n" \
37 " .previous\n"
38
32#endif /* _ASM_X86_ASM_H */ 39#endif /* _ASM_X86_ASM_H */
diff --git a/include/asm-x86/bugs.h b/include/asm-x86/bugs.h
index 3fcc30dc0731..021cbdd5f258 100644
--- a/include/asm-x86/bugs.h
+++ b/include/asm-x86/bugs.h
@@ -2,6 +2,6 @@
2#define _ASM_X86_BUGS_H 2#define _ASM_X86_BUGS_H
3 3
4extern void check_bugs(void); 4extern void check_bugs(void);
5extern int ppro_with_ram_bug(void); 5int ppro_with_ram_bug(void);
6 6
7#endif /* _ASM_X86_BUGS_H */ 7#endif /* _ASM_X86_BUGS_H */
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h
index 3fb7dfa7fc91..065e92966c7c 100644
--- a/include/asm-x86/cpufeature.h
+++ b/include/asm-x86/cpufeature.h
@@ -4,9 +4,6 @@
4#ifndef _ASM_X86_CPUFEATURE_H 4#ifndef _ASM_X86_CPUFEATURE_H
5#define _ASM_X86_CPUFEATURE_H 5#define _ASM_X86_CPUFEATURE_H
6 6
7#ifndef __ASSEMBLY__
8#include <linux/bitops.h>
9#endif
10#include <asm/required-features.h> 7#include <asm/required-features.h>
11 8
12#define NCAPINTS 8 /* N 32-bit words worth of info */ 9#define NCAPINTS 8 /* N 32-bit words worth of info */
@@ -49,6 +46,7 @@
49#define X86_FEATURE_MP (1*32+19) /* MP Capable. */ 46#define X86_FEATURE_MP (1*32+19) /* MP Capable. */
50#define X86_FEATURE_NX (1*32+20) /* Execute Disable */ 47#define X86_FEATURE_NX (1*32+20) /* Execute Disable */
51#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ 48#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
49#define X86_FEATURE_GBPAGES (1*32+26) /* GB pages */
52#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ 50#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
53#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ 51#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
54#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ 52#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
@@ -115,6 +113,13 @@
115 */ 113 */
116#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ 114#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
117 115
116#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
117
118#include <linux/bitops.h>
119
120extern const char * const x86_cap_flags[NCAPINTS*32];
121extern const char * const x86_power_flags[32];
122
118#define cpu_has(c, bit) \ 123#define cpu_has(c, bit) \
119 (__builtin_constant_p(bit) && \ 124 (__builtin_constant_p(bit) && \
120 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ 125 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
@@ -175,6 +180,7 @@
175#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) 180#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
176#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) 181#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
177#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) 182#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
183#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
178 184
179#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) 185#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
180# define cpu_has_invlpg 1 186# define cpu_has_invlpg 1
@@ -204,4 +210,6 @@
204 210
205#endif /* CONFIG_X86_64 */ 211#endif /* CONFIG_X86_64 */
206 212
213#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
214
207#endif /* _ASM_X86_CPUFEATURE_H */ 215#endif /* _ASM_X86_CPUFEATURE_H */
diff --git a/include/asm-x86/efi.h b/include/asm-x86/efi.h
index 9c68a1f098d8..ea9734b74aca 100644
--- a/include/asm-x86/efi.h
+++ b/include/asm-x86/efi.h
@@ -33,7 +33,7 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
33#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ 33#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
34 efi_call_virt(f, a1, a2, a3, a4, a5, a6) 34 efi_call_virt(f, a1, a2, a3, a4, a5, a6)
35 35
36#define efi_ioremap(addr, size) ioremap(addr, size) 36#define efi_ioremap(addr, size) ioremap_cache(addr, size)
37 37
38#else /* !CONFIG_X86_32 */ 38#else /* !CONFIG_X86_32 */
39 39
@@ -86,7 +86,7 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
86 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 86 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
87 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) 87 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
88 88
89extern void *efi_ioremap(unsigned long offset, unsigned long size); 89extern void *efi_ioremap(unsigned long addr, unsigned long size);
90 90
91#endif /* CONFIG_X86_32 */ 91#endif /* CONFIG_X86_32 */
92 92
diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h
index 9d919264923a..cd9f894dd2d7 100644
--- a/include/asm-x86/futex.h
+++ b/include/asm-x86/futex.h
@@ -17,11 +17,8 @@
17"2: .section .fixup,\"ax\"\n \ 17"2: .section .fixup,\"ax\"\n \
183: mov %3, %1\n \ 183: mov %3, %1\n \
19 jmp 2b\n \ 19 jmp 2b\n \
20 .previous\n \ 20 .previous\n" \
21 .section __ex_table,\"a\"\n \ 21 _ASM_EXTABLE(1b,3b) \
22 .align 8\n" \
23 _ASM_PTR "1b,3b\n \
24 .previous" \
25 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \ 22 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
26 : "i" (-EFAULT), "0" (oparg), "1" (0)) 23 : "i" (-EFAULT), "0" (oparg), "1" (0))
27 24
@@ -35,11 +32,9 @@
353: .section .fixup,\"ax\"\n \ 323: .section .fixup,\"ax\"\n \
364: mov %5, %1\n \ 334: mov %5, %1\n \
37 jmp 3b\n \ 34 jmp 3b\n \
38 .previous\n \ 35 .previous\n" \
39 .section __ex_table,\"a\"\n \ 36 _ASM_EXTABLE(1b,4b) \
40 .align 8\n" \ 37 _ASM_EXTABLE(2b,4b) \
41 _ASM_PTR "1b,4b,2b,4b\n \
42 .previous" \
43 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \ 38 : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \
44 "=&r" (tem) \ 39 "=&r" (tem) \
45 : "r" (oparg), "i" (-EFAULT), "1" (0)) 40 : "r" (oparg), "i" (-EFAULT), "1" (0))
@@ -111,18 +106,12 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
111 return -EFAULT; 106 return -EFAULT;
112 107
113 __asm__ __volatile__( 108 __asm__ __volatile__(
114
115 "1: lock; cmpxchgl %3, %1 \n" 109 "1: lock; cmpxchgl %3, %1 \n"
116 "2: .section .fixup, \"ax\" \n" 110 "2: .section .fixup, \"ax\" \n"
117 "3: mov %2, %0 \n" 111 "3: mov %2, %0 \n"
118 " jmp 2b \n" 112 " jmp 2b \n"
119 " .previous \n" 113 " .previous \n"
120 114 _ASM_EXTABLE(1b,3b)
121 " .section __ex_table, \"a\" \n"
122 " .align 8 \n"
123 _ASM_PTR " 1b,3b \n"
124 " .previous \n"
125
126 : "=a" (oldval), "+m" (*uaddr) 115 : "=a" (oldval), "+m" (*uaddr)
127 : "i" (-EFAULT), "r" (newval), "0" (oldval) 116 : "i" (-EFAULT), "r" (newval), "0" (oldval)
128 : "memory" 117 : "memory"
diff --git a/include/asm-x86/highmem.h b/include/asm-x86/highmem.h
index 13cdcd66fff2..c25cfcaab589 100644
--- a/include/asm-x86/highmem.h
+++ b/include/asm-x86/highmem.h
@@ -63,8 +63,8 @@ extern pte_t *pkmap_page_table;
63#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 63#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
64#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 64#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
65 65
66extern void * FASTCALL(kmap_high(struct page *page)); 66extern void *kmap_high(struct page *page);
67extern void FASTCALL(kunmap_high(struct page *page)); 67extern void kunmap_high(struct page *page);
68 68
69void *kmap(struct page *page); 69void *kmap(struct page *page);
70void kunmap(struct page *page); 70void kunmap(struct page *page);
diff --git a/include/asm-x86/hw_irq_32.h b/include/asm-x86/hw_irq_32.h
index 6d65fbb6358b..ea88054e03f3 100644
--- a/include/asm-x86/hw_irq_32.h
+++ b/include/asm-x86/hw_irq_32.h
@@ -47,7 +47,7 @@ void enable_8259A_irq(unsigned int irq);
47int i8259A_irq_pending(unsigned int irq); 47int i8259A_irq_pending(unsigned int irq);
48void make_8259A_irq(unsigned int irq); 48void make_8259A_irq(unsigned int irq);
49void init_8259A(int aeoi); 49void init_8259A(int aeoi);
50void FASTCALL(send_IPI_self(int vector)); 50void send_IPI_self(int vector);
51void init_VISWS_APIC_irqs(void); 51void init_VISWS_APIC_irqs(void);
52void setup_IO_APIC(void); 52void setup_IO_APIC(void);
53void disable_IO_APIC(void); 53void disable_IO_APIC(void);
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
index ba8105ca822b..6b1895ccd6b7 100644
--- a/include/asm-x86/i387.h
+++ b/include/asm-x86/i387.h
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/regset.h> 15#include <linux/regset.h>
16#include <asm/asm.h>
16#include <asm/processor.h> 17#include <asm/processor.h>
17#include <asm/sigcontext.h> 18#include <asm/sigcontext.h>
18#include <asm/user.h> 19#include <asm/user.h>
@@ -41,10 +42,7 @@ static inline void tolerant_fwait(void)
41{ 42{
42 asm volatile("1: fwait\n" 43 asm volatile("1: fwait\n"
43 "2:\n" 44 "2:\n"
44 " .section __ex_table,\"a\"\n" 45 _ASM_EXTABLE(1b,2b));
45 " .align 8\n"
46 " .quad 1b,2b\n"
47 " .previous\n");
48} 46}
49 47
50static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) 48static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
@@ -57,10 +55,7 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
57 "3: movl $-1,%[err]\n" 55 "3: movl $-1,%[err]\n"
58 " jmp 2b\n" 56 " jmp 2b\n"
59 ".previous\n" 57 ".previous\n"
60 ".section __ex_table,\"a\"\n" 58 _ASM_EXTABLE(1b,3b)
61 " .align 8\n"
62 " .quad 1b,3b\n"
63 ".previous"
64 : [err] "=r" (err) 59 : [err] "=r" (err)
65#if 0 /* See comment in __save_init_fpu() below. */ 60#if 0 /* See comment in __save_init_fpu() below. */
66 : [fx] "r" (fx), "m" (*fx), "0" (0)); 61 : [fx] "r" (fx), "m" (*fx), "0" (0));
@@ -99,10 +94,7 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
99 "3: movl $-1,%[err]\n" 94 "3: movl $-1,%[err]\n"
100 " jmp 2b\n" 95 " jmp 2b\n"
101 ".previous\n" 96 ".previous\n"
102 ".section __ex_table,\"a\"\n" 97 _ASM_EXTABLE(1b,3b)
103 " .align 8\n"
104 " .quad 1b,3b\n"
105 ".previous"
106 : [err] "=r" (err), "=m" (*fx) 98 : [err] "=r" (err), "=m" (*fx)
107#if 0 /* See comment in __fxsave_clear() below. */ 99#if 0 /* See comment in __fxsave_clear() below. */
108 : [fx] "r" (fx), "0" (0)); 100 : [fx] "r" (fx), "0" (0));
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
index 586d7aa54ceb..58d2c45cd0b1 100644
--- a/include/asm-x86/io_32.h
+++ b/include/asm-x86/io_32.h
@@ -275,29 +275,6 @@ static inline void slow_down_io(void) {
275 275
276#endif 276#endif
277 277
278#ifdef CONFIG_X86_NUMAQ
279extern void *xquad_portio; /* Where the IO area was mapped */
280#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port)
281#define __BUILDIO(bwl,bw,type) \
282static inline void out##bwl##_quad(unsigned type value, int port, int quad) { \
283 if (xquad_portio) \
284 write##bwl(value, XQUAD_PORT_ADDR(port, quad)); \
285 else \
286 out##bwl##_local(value, port); \
287} \
288static inline void out##bwl(unsigned type value, int port) { \
289 out##bwl##_quad(value, port, 0); \
290} \
291static inline unsigned type in##bwl##_quad(int port, int quad) { \
292 if (xquad_portio) \
293 return read##bwl(XQUAD_PORT_ADDR(port, quad)); \
294 else \
295 return in##bwl##_local(port); \
296} \
297static inline unsigned type in##bwl(int port) { \
298 return in##bwl##_quad(port, 0); \
299}
300#else
301#define __BUILDIO(bwl,bw,type) \ 278#define __BUILDIO(bwl,bw,type) \
302static inline void out##bwl(unsigned type value, int port) { \ 279static inline void out##bwl(unsigned type value, int port) { \
303 out##bwl##_local(value, port); \ 280 out##bwl##_local(value, port); \
@@ -305,8 +282,6 @@ static inline void out##bwl(unsigned type value, int port) { \
305static inline unsigned type in##bwl(int port) { \ 282static inline unsigned type in##bwl(int port) { \
306 return in##bwl##_local(port); \ 283 return in##bwl##_local(port); \
307} 284}
308#endif
309
310 285
311#define BUILDIO(bwl,bw,type) \ 286#define BUILDIO(bwl,bw,type) \
312static inline void out##bwl##_local(unsigned type value, int port) { \ 287static inline void out##bwl##_local(unsigned type value, int port) { \
diff --git a/include/asm-x86/mach-numaq/mach_apic.h b/include/asm-x86/mach-numaq/mach_apic.h
index 17e183bd39c1..3b637fac890b 100644
--- a/include/asm-x86/mach-numaq/mach_apic.h
+++ b/include/asm-x86/mach-numaq/mach_apic.h
@@ -109,6 +109,8 @@ static inline int mpc_apic_id(struct mpc_config_processor *m,
109 return logical_apicid; 109 return logical_apicid;
110} 110}
111 111
112extern void *xquad_portio;
113
112static inline void setup_portio_remap(void) 114static inline void setup_portio_remap(void)
113{ 115{
114 int num_quads = num_online_nodes(); 116 int num_quads = num_online_nodes();
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index 204a8a30fecf..3ca29ebebbb1 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -57,10 +57,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
57 ".section .fixup,\"ax\"\n\t" 57 ".section .fixup,\"ax\"\n\t"
58 "3: mov %3,%0 ; jmp 1b\n\t" 58 "3: mov %3,%0 ; jmp 1b\n\t"
59 ".previous\n\t" 59 ".previous\n\t"
60 ".section __ex_table,\"a\"\n" 60 _ASM_EXTABLE(2b,3b)
61 _ASM_ALIGN "\n\t"
62 _ASM_PTR " 2b,3b\n\t"
63 ".previous"
64 : "=r" (*err), EAX_EDX_RET(val, low, high) 61 : "=r" (*err), EAX_EDX_RET(val, low, high)
65 : "c" (msr), "i" (-EFAULT)); 62 : "c" (msr), "i" (-EFAULT));
66 return EAX_EDX_VAL(val, low, high); 63 return EAX_EDX_VAL(val, low, high);
@@ -81,10 +78,7 @@ static inline int native_write_msr_safe(unsigned int msr,
81 ".section .fixup,\"ax\"\n\t" 78 ".section .fixup,\"ax\"\n\t"
82 "3: mov %4,%0 ; jmp 1b\n\t" 79 "3: mov %4,%0 ; jmp 1b\n\t"
83 ".previous\n\t" 80 ".previous\n\t"
84 ".section __ex_table,\"a\"\n" 81 _ASM_EXTABLE(2b,3b)
85 _ASM_ALIGN "\n\t"
86 _ASM_PTR " 2b,3b\n\t"
87 ".previous"
88 : "=a" (err) 82 : "=a" (err)
89 : "c" (msr), "0" (low), "d" (high), 83 : "c" (msr), "0" (low), "d" (high),
90 "i" (-EFAULT)); 84 "i" (-EFAULT));
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index c8b30efeed85..1cb7c51bc296 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -13,8 +13,8 @@
13#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) 13#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK)
14#define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK)) 14#define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK))
15 15
16#define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT) 16#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
17#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) 17#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
18 18
19#define HPAGE_SHIFT PMD_SHIFT 19#define HPAGE_SHIFT PMD_SHIFT
20#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 20#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
index c1ac42d8707f..dcf0c0746075 100644
--- a/include/asm-x86/page_64.h
+++ b/include/asm-x86/page_64.h
@@ -23,6 +23,9 @@
23#define MCE_STACK 5 23#define MCE_STACK 5
24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ 24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
25 25
26#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
27#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
28
26#define __PAGE_OFFSET _AC(0xffff810000000000, UL) 29#define __PAGE_OFFSET _AC(0xffff810000000000, UL)
27 30
28#define __PHYSICAL_START CONFIG_PHYSICAL_START 31#define __PHYSICAL_START CONFIG_PHYSICAL_START
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h
index 7641e7b5d931..6c21ef951dab 100644
--- a/include/asm-x86/pgalloc_32.h
+++ b/include/asm-x86/pgalloc_32.h
@@ -80,8 +80,10 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
80 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT)); 80 set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT));
81 81
82 /* 82 /*
83 * Pentium-II erratum A13: in PAE mode we explicitly have to flush 83 * According to Intel App note "TLBs, Paging-Structure Caches,
84 * the TLB via cr3 if the top-level pgd is changed... 84 * and Their Invalidation", April 2007, document 317080-001,
85 * section 8.1: in PAE mode we explicitly have to flush the
86 * TLB via cr3 if the top-level pgd is changed...
85 */ 87 */
86 if (mm == current->active_mm) 88 if (mm == current->active_mm)
87 write_cr3(read_cr3()); 89 write_cr3(read_cr3());
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h
index a195c3e757b9..1d763eec740f 100644
--- a/include/asm-x86/pgtable-3level.h
+++ b/include/asm-x86/pgtable-3level.h
@@ -93,26 +93,22 @@ static inline void native_pmd_clear(pmd_t *pmd)
93 93
94static inline void pud_clear(pud_t *pudp) 94static inline void pud_clear(pud_t *pudp)
95{ 95{
96 unsigned long pgd;
97
96 set_pud(pudp, __pud(0)); 98 set_pud(pudp, __pud(0));
97 99
98 /* 100 /*
99 * In principle we need to do a cr3 reload here to make sure 101 * According to Intel App note "TLBs, Paging-Structure Caches,
100 * the processor recognizes the changed pgd. In practice, all 102 * and Their Invalidation", April 2007, document 317080-001,
101 * the places where pud_clear() gets called are followed by 103 * section 8.1: in PAE mode we explicitly have to flush the
102 * full tlb flushes anyway, so we can defer the cost here. 104 * TLB via cr3 if the top-level pgd is changed...
103 *
104 * Specifically:
105 *
106 * mm/memory.c:free_pmd_range() - immediately after the
107 * pud_clear() it does a pmd_free_tlb(). We change the
108 * mmu_gather structure to do a full tlb flush (which has the
109 * effect of reloading cr3) when the pagetable free is
110 * complete.
111 * 105 *
112 * arch/x86/mm/hugetlbpage.c:huge_pmd_unshare() - the call to 106 * Make sure the pud entry we're updating is within the
113 * this is followed by a flush_tlb_range, which on x86 does a 107 * current pgd to avoid unnecessary TLB flushes.
114 * full tlb flush.
115 */ 108 */
109 pgd = read_cr3();
110 if (__pa(pudp) >= pgd && __pa(pudp) < (pgd + sizeof(pgd_t)*PTRS_PER_PGD))
111 write_cr3(pgd);
116} 112}
117 113
118#define pud_page(pud) \ 114#define pud_page(pud) \
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index cd2524f07452..44c0a4f1b1eb 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -13,10 +13,12 @@
13#define _PAGE_BIT_DIRTY 6 13#define _PAGE_BIT_DIRTY 6
14#define _PAGE_BIT_FILE 6 14#define _PAGE_BIT_FILE 6
15#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ 15#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */
16#define _PAGE_BIT_PAT 7 /* on 4KB pages */
16#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ 17#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */
17#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ 18#define _PAGE_BIT_UNUSED1 9 /* available for programmer */
18#define _PAGE_BIT_UNUSED2 10 19#define _PAGE_BIT_UNUSED2 10
19#define _PAGE_BIT_UNUSED3 11 20#define _PAGE_BIT_UNUSED3 11
21#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
20#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ 22#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
21 23
22/* 24/*
@@ -36,6 +38,8 @@
36#define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1) 38#define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1)
37#define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2) 39#define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2)
38#define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3) 40#define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3)
41#define _PAGE_PAT (_AC(1, L)<<_PAGE_BIT_PAT)
42#define _PAGE_PAT_LARGE (_AC(1, L)<<_PAGE_BIT_PAT_LARGE)
39 43
40#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 44#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
41#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX) 45#define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX)
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index 21e70fbf1dae..935630d17304 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -148,6 +148,8 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
148 */ 148 */
149#define pgd_offset_k(address) pgd_offset(&init_mm, address) 149#define pgd_offset_k(address) pgd_offset(&init_mm, address)
150 150
151static inline int pud_large(pud_t pud) { return 0; }
152
151/* 153/*
152 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] 154 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
153 * 155 *
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index 6e615a103c2f..bd4740a60f29 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -21,7 +21,6 @@ extern pgd_t init_level4_pgt[];
21#define swapper_pg_dir init_level4_pgt 21#define swapper_pg_dir init_level4_pgt
22 22
23extern void paging_init(void); 23extern void paging_init(void);
24extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
25 24
26#endif /* !__ASSEMBLY__ */ 25#endif /* !__ASSEMBLY__ */
27 26
@@ -199,6 +198,12 @@ static inline unsigned long pmd_bad(pmd_t pmd)
199#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) 198#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address))
200#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) 199#define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT)
201 200
201static inline int pud_large(pud_t pte)
202{
203 return (pud_val(pte) & (_PAGE_PSE|_PAGE_PRESENT)) ==
204 (_PAGE_PSE|_PAGE_PRESENT);
205}
206
202/* PMD - Level 2 access */ 207/* PMD - Level 2 access */
203#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) 208#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
204#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 209#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
diff --git a/include/asm-x86/string_32.h b/include/asm-x86/string_32.h
index 55bfa308f900..c5d13a86dea7 100644
--- a/include/asm-x86/string_32.h
+++ b/include/asm-x86/string_32.h
@@ -213,14 +213,14 @@ static __always_inline void * __constant_c_and_count_memset(void * s, unsigned l
213 case 0: 213 case 0:
214 return s; 214 return s;
215 case 1: 215 case 1:
216 *(unsigned char *)s = pattern; 216 *(unsigned char *)s = pattern & 0xff;
217 return s; 217 return s;
218 case 2: 218 case 2:
219 *(unsigned short *)s = pattern; 219 *(unsigned short *)s = pattern & 0xffff;
220 return s; 220 return s;
221 case 3: 221 case 3:
222 *(unsigned short *)s = pattern; 222 *(unsigned short *)s = pattern & 0xffff;
223 *(2+(unsigned char *)s) = pattern; 223 *(2+(unsigned char *)s) = pattern & 0xff;
224 return s; 224 return s;
225 case 4: 225 case 4:
226 *(unsigned long *)s = pattern; 226 *(unsigned long *)s = pattern;
diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h
index ee32ef9367f4..9cff02ffe6c2 100644
--- a/include/asm-x86/system.h
+++ b/include/asm-x86/system.h
@@ -20,8 +20,8 @@
20#ifdef CONFIG_X86_32 20#ifdef CONFIG_X86_32
21 21
22struct task_struct; /* one of the stranger aspects of C forward declarations */ 22struct task_struct; /* one of the stranger aspects of C forward declarations */
23extern struct task_struct *FASTCALL(__switch_to(struct task_struct *prev, 23struct task_struct *__switch_to(struct task_struct *prev,
24 struct task_struct *next)); 24 struct task_struct *next);
25 25
26/* 26/*
27 * Saving eflags is important. It switches not only IOPL between tasks, 27 * Saving eflags is important. It switches not only IOPL between tasks,
@@ -130,10 +130,7 @@ extern void load_gs_index(unsigned);
130 "movl %k1, %%" #seg "\n\t" \ 130 "movl %k1, %%" #seg "\n\t" \
131 "jmp 2b\n" \ 131 "jmp 2b\n" \
132 ".previous\n" \ 132 ".previous\n" \
133 ".section __ex_table,\"a\"\n\t" \ 133 _ASM_EXTABLE(1b,3b) \
134 _ASM_ALIGN "\n\t" \
135 _ASM_PTR " 1b,3b\n" \
136 ".previous" \
137 : :"r" (value), "r" (0)) 134 : :"r" (value), "r" (0))
138 135
139 136
@@ -214,12 +211,10 @@ static inline unsigned long native_read_cr4_safe(void)
214 /* This could fault if %cr4 does not exist. In x86_64, a cr4 always 211 /* This could fault if %cr4 does not exist. In x86_64, a cr4 always
215 * exists, so it will never fail. */ 212 * exists, so it will never fail. */
216#ifdef CONFIG_X86_32 213#ifdef CONFIG_X86_32
217 asm volatile("1: mov %%cr4, %0 \n" 214 asm volatile("1: mov %%cr4, %0\n"
218 "2: \n" 215 "2:\n"
219 ".section __ex_table,\"a\" \n" 216 _ASM_EXTABLE(1b,2b)
220 ".long 1b,2b \n" 217 : "=r" (val), "=m" (__force_order) : "0" (0));
221 ".previous \n"
222 : "=r" (val), "=m" (__force_order) : "0" (0));
223#else 218#else
224 val = native_read_cr4(); 219 val = native_read_cr4();
225#endif 220#endif
@@ -276,9 +271,9 @@ static inline void native_wbinvd(void)
276 271
277#endif /* __KERNEL__ */ 272#endif /* __KERNEL__ */
278 273
279static inline void clflush(void *__p) 274static inline void clflush(volatile void *__p)
280{ 275{
281 asm volatile("clflush %0" : "+m" (*(char __force *)__p)); 276 asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p));
282} 277}
283 278
284#define nop() __asm__ __volatile__ ("nop") 279#define nop() __asm__ __volatile__ ("nop")
diff --git a/include/asm-x86/uaccess_32.h b/include/asm-x86/uaccess_32.h
index d2a4f7be9c2c..fcc570ec4fee 100644
--- a/include/asm-x86/uaccess_32.h
+++ b/include/asm-x86/uaccess_32.h
@@ -8,6 +8,7 @@
8#include <linux/thread_info.h> 8#include <linux/thread_info.h>
9#include <linux/prefetch.h> 9#include <linux/prefetch.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <asm/asm.h>
11#include <asm/page.h> 12#include <asm/page.h>
12 13
13#define VERIFY_READ 0 14#define VERIFY_READ 0
@@ -287,11 +288,8 @@ extern void __put_user_8(void);
287 "4: movl %3,%0\n" \ 288 "4: movl %3,%0\n" \
288 " jmp 3b\n" \ 289 " jmp 3b\n" \
289 ".previous\n" \ 290 ".previous\n" \
290 ".section __ex_table,\"a\"\n" \ 291 _ASM_EXTABLE(1b,4b) \
291 " .align 4\n" \ 292 _ASM_EXTABLE(2b,4b) \
292 " .long 1b,4b\n" \
293 " .long 2b,4b\n" \
294 ".previous" \
295 : "=r"(err) \ 293 : "=r"(err) \
296 : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err)) 294 : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err))
297 295
@@ -338,10 +336,7 @@ struct __large_struct { unsigned long buf[100]; };
338 "3: movl %3,%0\n" \ 336 "3: movl %3,%0\n" \
339 " jmp 2b\n" \ 337 " jmp 2b\n" \
340 ".previous\n" \ 338 ".previous\n" \
341 ".section __ex_table,\"a\"\n" \ 339 _ASM_EXTABLE(1b,3b) \
342 " .align 4\n" \
343 " .long 1b,3b\n" \
344 ".previous" \
345 : "=r"(err) \ 340 : "=r"(err) \
346 : ltype (x), "m"(__m(addr)), "i"(errret), "0"(err)) 341 : ltype (x), "m"(__m(addr)), "i"(errret), "0"(err))
347 342
@@ -378,10 +373,7 @@ do { \
378 " xor"itype" %"rtype"1,%"rtype"1\n" \ 373 " xor"itype" %"rtype"1,%"rtype"1\n" \
379 " jmp 2b\n" \ 374 " jmp 2b\n" \
380 ".previous\n" \ 375 ".previous\n" \
381 ".section __ex_table,\"a\"\n" \ 376 _ASM_EXTABLE(1b,3b) \
382 " .align 4\n" \
383 " .long 1b,3b\n" \
384 ".previous" \
385 : "=r"(err), ltype (x) \ 377 : "=r"(err), ltype (x) \
386 : "m"(__m(addr)), "i"(errret), "0"(err)) 378 : "m"(__m(addr)), "i"(errret), "0"(err))
387 379
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h
index 31d794702719..b87eb4ba8f9d 100644
--- a/include/asm-x86/uaccess_64.h
+++ b/include/asm-x86/uaccess_64.h
@@ -181,10 +181,7 @@ struct __large_struct { unsigned long buf[100]; };
181 "3: mov %3,%0\n" \ 181 "3: mov %3,%0\n" \
182 " jmp 2b\n" \ 182 " jmp 2b\n" \
183 ".previous\n" \ 183 ".previous\n" \
184 ".section __ex_table,\"a\"\n" \ 184 _ASM_EXTABLE(1b,3b) \
185 " .align 8\n" \
186 " .quad 1b,3b\n" \
187 ".previous" \
188 : "=r"(err) \ 185 : "=r"(err) \
189 : ltype (x), "m"(__m(addr)), "i"(errno), "0"(err)) 186 : ltype (x), "m"(__m(addr)), "i"(errno), "0"(err))
190 187
@@ -226,10 +223,7 @@ do { \
226 " xor"itype" %"rtype"1,%"rtype"1\n" \ 223 " xor"itype" %"rtype"1,%"rtype"1\n" \
227 " jmp 2b\n" \ 224 " jmp 2b\n" \
228 ".previous\n" \ 225 ".previous\n" \
229 ".section __ex_table,\"a\"\n" \ 226 _ASM_EXTABLE(1b,3b) \
230 " .align 8\n" \
231 " .quad 1b,3b\n" \
232 ".previous" \
233 : "=r"(err), ltype (x) \ 227 : "=r"(err), ltype (x) \
234 : "m"(__m(addr)), "i"(errno), "0"(err)) 228 : "m"(__m(addr)), "i"(errno), "0"(err))
235 229
diff --git a/include/asm-x86/vm86.h b/include/asm-x86/vm86.h
index a5edf517b992..c92fe4af52e8 100644
--- a/include/asm-x86/vm86.h
+++ b/include/asm-x86/vm86.h
@@ -195,6 +195,7 @@ struct kernel_vm86_struct {
195 195
196void handle_vm86_fault(struct kernel_vm86_regs *, long); 196void handle_vm86_fault(struct kernel_vm86_regs *, long);
197int handle_vm86_trap(struct kernel_vm86_regs *, long, int); 197int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
198struct pt_regs *save_v86_state(struct kernel_vm86_regs *);
198 199
199struct task_struct; 200struct task_struct;
200void release_vm86_irqs(struct task_struct *); 201void release_vm86_irqs(struct task_struct *);