diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-01-30 07:32:58 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:58 -0500 |
commit | 4891645e764d2e181b834509a689fcd12e890c10 (patch) | |
tree | f347227c2d5a5b112bca8fe76b149ccc5157ef84 /include/asm-x86/pgtable.h | |
parent | 8405b122ad0dd75354b3bfed4de9a96514fd40cb (diff) |
x86: unify paravirt pagetable accessors
Put all the defines for mapping pagetable operations to their native
versions (for the non-paravirt case) into one place. Make the
corresponding changes to paravirt.h.
The tricky part here is that when a pagetable entry can't be updated
atomically (ie, 32-bit PAE), we need special handlers for pte_clear,
set_pte_atomic and set_pte_present. However, the other two modes
don't need special handling for these, and can use a common
set_pte(_at) path.
[ mingo@elte.hu: fixes ]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/pgtable.h')
-rw-r--r-- | include/asm-x86/pgtable.h | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index eb14a70a4728..a1eeacdf9d8c 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -178,6 +178,39 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
178 | return __pte(val); | 178 | return __pte(val); |
179 | } | 179 | } |
180 | 180 | ||
181 | #ifdef CONFIG_PARAVIRT | ||
182 | #include <asm/paravirt.h> | ||
183 | #else /* !CONFIG_PARAVIRT */ | ||
184 | #define set_pte(ptep, pte) native_set_pte(ptep, pte) | ||
185 | #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte) | ||
186 | |||
187 | #define set_pte_present(mm, addr, ptep, pte) \ | ||
188 | native_set_pte_present(mm, addr, ptep, pte) | ||
189 | #define set_pte_atomic(ptep, pte) \ | ||
190 | native_set_pte_atomic(ptep, pte) | ||
191 | |||
192 | #define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd) | ||
193 | |||
194 | #ifndef __PAGETABLE_PUD_FOLDED | ||
195 | #define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd) | ||
196 | #define pgd_clear(pgd) native_pgd_clear(pgd) | ||
197 | #endif | ||
198 | |||
199 | #ifndef set_pud | ||
200 | # define set_pud(pudp, pud) native_set_pud(pudp, pud) | ||
201 | #endif | ||
202 | |||
203 | #ifndef __PAGETABLE_PMD_FOLDED | ||
204 | #define pud_clear(pud) native_pud_clear(pud) | ||
205 | #endif | ||
206 | |||
207 | #define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep) | ||
208 | #define pmd_clear(pmd) native_pmd_clear(pmd) | ||
209 | |||
210 | #define pte_update(mm, addr, ptep) do { } while (0) | ||
211 | #define pte_update_defer(mm, addr, ptep) do { } while (0) | ||
212 | #endif /* CONFIG_PARAVIRT */ | ||
213 | |||
181 | #endif /* __ASSEMBLY__ */ | 214 | #endif /* __ASSEMBLY__ */ |
182 | 215 | ||
183 | #ifdef CONFIG_X86_32 | 216 | #ifdef CONFIG_X86_32 |
@@ -188,6 +221,22 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
188 | 221 | ||
189 | #ifndef __ASSEMBLY__ | 222 | #ifndef __ASSEMBLY__ |
190 | 223 | ||
224 | /* local pte updates need not use xchg for locking */ | ||
225 | static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep) | ||
226 | { | ||
227 | pte_t res = *ptep; | ||
228 | |||
229 | /* Pure native function needs no input for mm, addr */ | ||
230 | native_pte_clear(NULL, 0, ptep); | ||
231 | return res; | ||
232 | } | ||
233 | |||
234 | static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, | ||
235 | pte_t *ptep , pte_t pte) | ||
236 | { | ||
237 | native_set_pte(ptep, pte); | ||
238 | } | ||
239 | |||
191 | #ifndef CONFIG_PARAVIRT | 240 | #ifndef CONFIG_PARAVIRT |
192 | /* | 241 | /* |
193 | * Rules for using pte_update - it must be called after any PTE update which | 242 | * Rules for using pte_update - it must be called after any PTE update which |
@@ -206,16 +255,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
206 | #define pte_update_defer(mm, addr, ptep) do { } while (0) | 255 | #define pte_update_defer(mm, addr, ptep) do { } while (0) |
207 | #endif | 256 | #endif |
208 | 257 | ||
209 | /* local pte updates need not use xchg for locking */ | ||
210 | static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep) | ||
211 | { | ||
212 | pte_t res = *ptep; | ||
213 | |||
214 | /* Pure native function needs no input for mm, addr */ | ||
215 | native_pte_clear(NULL, 0, ptep); | ||
216 | return res; | ||
217 | } | ||
218 | |||
219 | /* | 258 | /* |
220 | * We only update the dirty/accessed state if we set | 259 | * We only update the dirty/accessed state if we set |
221 | * the dirty bit by hand in the kernel, since the hardware | 260 | * the dirty bit by hand in the kernel, since the hardware |
@@ -287,10 +326,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
287 | pte_update(mm, addr, ptep); | 326 | pte_update(mm, addr, ptep); |
288 | } | 327 | } |
289 | 328 | ||
290 | #ifndef CONFIG_PARAVIRT | ||
291 | #define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep) | ||
292 | #endif /* !CONFIG_PARAVIRT */ | ||
293 | |||
294 | #include <asm-generic/pgtable.h> | 329 | #include <asm-generic/pgtable.h> |
295 | #endif /* __ASSEMBLY__ */ | 330 | #endif /* __ASSEMBLY__ */ |
296 | 331 | ||