diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-08 06:24:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 06:24:29 -0400 |
commit | 6236af82d8a989e150a02800c210eb61cb1e17be (patch) | |
tree | d5e83e66b09fc405ac70925f9b83152abaf48a03 /include/asm-x86 | |
parent | e3ae0acf59244ecf5b023ec99cef4b6b29d649bc (diff) | |
parent | 8b7ef4ec5b1ac8b6feebf5ae9cda85a7514728f8 (diff) |
Merge branch 'x86/fixmap' into x86/devel
Conflicts:
arch/x86/mm/init_64.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/fixmap.h | 55 | ||||
-rw-r--r-- | include/asm-x86/fixmap_32.h | 42 | ||||
-rw-r--r-- | include/asm-x86/fixmap_64.h | 37 | ||||
-rw-r--r-- | include/asm-x86/paravirt.h | 13 | ||||
-rw-r--r-- | include/asm-x86/pgtable.h | 3 |
5 files changed, 71 insertions, 79 deletions
diff --git a/include/asm-x86/fixmap.h b/include/asm-x86/fixmap.h index 5bd206973dca..44d4f8217349 100644 --- a/include/asm-x86/fixmap.h +++ b/include/asm-x86/fixmap.h | |||
@@ -7,7 +7,62 @@ | |||
7 | # include "fixmap_64.h" | 7 | # include "fixmap_64.h" |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | extern int fixmaps_set; | ||
11 | |||
12 | void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); | ||
13 | void native_set_fixmap(enum fixed_addresses idx, | ||
14 | unsigned long phys, pgprot_t flags); | ||
15 | |||
16 | #ifndef CONFIG_PARAVIRT | ||
17 | static inline void __set_fixmap(enum fixed_addresses idx, | ||
18 | unsigned long phys, pgprot_t flags) | ||
19 | { | ||
20 | native_set_fixmap(idx, phys, flags); | ||
21 | } | ||
22 | #endif | ||
23 | |||
24 | #define set_fixmap(idx, phys) \ | ||
25 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
26 | |||
27 | /* | ||
28 | * Some hardware wants to get fixmapped without caching. | ||
29 | */ | ||
30 | #define set_fixmap_nocache(idx, phys) \ | ||
31 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
32 | |||
10 | #define clear_fixmap(idx) \ | 33 | #define clear_fixmap(idx) \ |
11 | __set_fixmap(idx, 0, __pgprot(0)) | 34 | __set_fixmap(idx, 0, __pgprot(0)) |
12 | 35 | ||
36 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
37 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
38 | |||
39 | extern void __this_fixmap_does_not_exist(void); | ||
40 | |||
41 | /* | ||
42 | * 'index to address' translation. If anyone tries to use the idx | ||
43 | * directly without translation, we catch the bug with a NULL-deference | ||
44 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
45 | */ | ||
46 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
47 | { | ||
48 | /* | ||
49 | * this branch gets completely eliminated after inlining, | ||
50 | * except when someone tries to use fixaddr indices in an | ||
51 | * illegal way. (such as mixing up address types or using | ||
52 | * out-of-range indices). | ||
53 | * | ||
54 | * If it doesn't get removed, the linker will complain | ||
55 | * loudly with a reasonably clear error message.. | ||
56 | */ | ||
57 | if (idx >= __end_of_fixed_addresses) | ||
58 | __this_fixmap_does_not_exist(); | ||
59 | |||
60 | return __fix_to_virt(idx); | ||
61 | } | ||
62 | |||
63 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
64 | { | ||
65 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
66 | return __virt_to_fix(vaddr); | ||
67 | } | ||
13 | #endif | 68 | #endif |
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h index f0df7ee96816..aae2f0501a40 100644 --- a/include/asm-x86/fixmap_32.h +++ b/include/asm-x86/fixmap_32.h | |||
@@ -109,17 +109,8 @@ enum fixed_addresses { | |||
109 | __end_of_fixed_addresses | 109 | __end_of_fixed_addresses |
110 | }; | 110 | }; |
111 | 111 | ||
112 | extern void __set_fixmap(enum fixed_addresses idx, | ||
113 | unsigned long phys, pgprot_t flags); | ||
114 | extern void reserve_top_address(unsigned long reserve); | 112 | extern void reserve_top_address(unsigned long reserve); |
115 | 113 | ||
116 | #define set_fixmap(idx, phys) \ | ||
117 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
118 | /* | ||
119 | * Some hardware wants to get fixmapped without caching. | ||
120 | */ | ||
121 | #define set_fixmap_nocache(idx, phys) \ | ||
122 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
123 | 114 | ||
124 | #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) | 115 | #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) |
125 | 116 | ||
@@ -128,38 +119,5 @@ extern void reserve_top_address(unsigned long reserve); | |||
128 | #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) | 119 | #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) |
129 | #define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE) | 120 | #define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE) |
130 | 121 | ||
131 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
132 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
133 | |||
134 | extern void __this_fixmap_does_not_exist(void); | ||
135 | |||
136 | /* | ||
137 | * 'index to address' translation. If anyone tries to use the idx | ||
138 | * directly without tranlation, we catch the bug with a NULL-deference | ||
139 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
140 | */ | ||
141 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
142 | { | ||
143 | /* | ||
144 | * this branch gets completely eliminated after inlining, | ||
145 | * except when someone tries to use fixaddr indices in an | ||
146 | * illegal way. (such as mixing up address types or using | ||
147 | * out-of-range indices). | ||
148 | * | ||
149 | * If it doesn't get removed, the linker will complain | ||
150 | * loudly with a reasonably clear error message.. | ||
151 | */ | ||
152 | if (idx >= __end_of_fixed_addresses) | ||
153 | __this_fixmap_does_not_exist(); | ||
154 | |||
155 | return __fix_to_virt(idx); | ||
156 | } | ||
157 | |||
158 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
159 | { | ||
160 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
161 | return __virt_to_fix(vaddr); | ||
162 | } | ||
163 | |||
164 | #endif /* !__ASSEMBLY__ */ | 122 | #endif /* !__ASSEMBLY__ */ |
165 | #endif | 123 | #endif |
diff --git a/include/asm-x86/fixmap_64.h b/include/asm-x86/fixmap_64.h index 355d26a75a82..626098823a0c 100644 --- a/include/asm-x86/fixmap_64.h +++ b/include/asm-x86/fixmap_64.h | |||
@@ -52,17 +52,6 @@ enum fixed_addresses { | |||
52 | __end_of_fixed_addresses | 52 | __end_of_fixed_addresses |
53 | }; | 53 | }; |
54 | 54 | ||
55 | extern void __set_fixmap(enum fixed_addresses idx, | ||
56 | unsigned long phys, pgprot_t flags); | ||
57 | |||
58 | #define set_fixmap(idx, phys) \ | ||
59 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
60 | /* | ||
61 | * Some hardware wants to get fixmapped without caching. | ||
62 | */ | ||
63 | #define set_fixmap_nocache(idx, phys) \ | ||
64 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
65 | |||
66 | #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) | 55 | #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) |
67 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 56 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
68 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | 57 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
@@ -71,30 +60,4 @@ extern void __set_fixmap(enum fixed_addresses idx, | |||
71 | #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) | 60 | #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) |
72 | #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) | 61 | #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) |
73 | 62 | ||
74 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
75 | |||
76 | extern void __this_fixmap_does_not_exist(void); | ||
77 | |||
78 | /* | ||
79 | * 'index to address' translation. If anyone tries to use the idx | ||
80 | * directly without translation, we catch the bug with a NULL-deference | ||
81 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
82 | */ | ||
83 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
84 | { | ||
85 | /* | ||
86 | * this branch gets completely eliminated after inlining, | ||
87 | * except when someone tries to use fixaddr indices in an | ||
88 | * illegal way. (such as mixing up address types or using | ||
89 | * out-of-range indices). | ||
90 | * | ||
91 | * If it doesn't get removed, the linker will complain | ||
92 | * loudly with a reasonably clear error message.. | ||
93 | */ | ||
94 | if (idx >= __end_of_fixed_addresses) | ||
95 | __this_fixmap_does_not_exist(); | ||
96 | |||
97 | return __fix_to_virt(idx); | ||
98 | } | ||
99 | |||
100 | #endif | 63 | #endif |
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index e9ada314dfc1..41f5447efd88 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -279,6 +279,13 @@ struct pv_mmu_ops { | |||
279 | #endif | 279 | #endif |
280 | 280 | ||
281 | struct pv_lazy_ops lazy_mode; | 281 | struct pv_lazy_ops lazy_mode; |
282 | |||
283 | /* dom0 ops */ | ||
284 | |||
285 | /* Sometimes the physical address is a pfn, and sometimes its | ||
286 | an mfn. We can tell which is which from the index. */ | ||
287 | void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx, | ||
288 | unsigned long phys, pgprot_t flags); | ||
282 | }; | 289 | }; |
283 | 290 | ||
284 | /* This contains all the paravirt structures: we get a convenient | 291 | /* This contains all the paravirt structures: we get a convenient |
@@ -1295,6 +1302,12 @@ static inline void arch_flush_lazy_mmu_mode(void) | |||
1295 | } | 1302 | } |
1296 | } | 1303 | } |
1297 | 1304 | ||
1305 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | ||
1306 | unsigned long phys, pgprot_t flags) | ||
1307 | { | ||
1308 | pv_mmu_ops.set_fixmap(idx, phys, flags); | ||
1309 | } | ||
1310 | |||
1298 | void _paravirt_nop(void); | 1311 | void _paravirt_nop(void); |
1299 | #define paravirt_nop ((void *)_paravirt_nop) | 1312 | #define paravirt_nop ((void *)_paravirt_nop) |
1300 | 1313 | ||
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index bcb5446a08d1..f048975b31a4 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -313,6 +313,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
313 | unsigned long size, pgprot_t *vma_prot); | 313 | unsigned long size, pgprot_t *vma_prot); |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | /* Install a pte for a particular vaddr in kernel space. */ | ||
317 | void set_pte_vaddr(unsigned long vaddr, pte_t pte); | ||
318 | |||
316 | #ifdef CONFIG_PARAVIRT | 319 | #ifdef CONFIG_PARAVIRT |
317 | #include <asm/paravirt.h> | 320 | #include <asm/paravirt.h> |
318 | #else /* !CONFIG_PARAVIRT */ | 321 | #else /* !CONFIG_PARAVIRT */ |