diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2006-12-06 20:14:08 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:08 -0500 |
commit | da181a8b3916aa7f2e3c5775d2bd2fe3454cf82d (patch) | |
tree | c5be6c957d57563b9854732df1210aad97027b03 /include/asm-i386/paravirt.h | |
parent | 13623d79309dd82e1964458fa017979d16f33fa8 (diff) |
[PATCH] paravirt: Add MMU virtualization to paravirt_ops
Add the three bare TLB accessor functions to paravirt-ops. Most amusingly,
flush_tlb is redefined on SMP, so I can't call the paravirt op flush_tlb.
Instead, I chose to indicate the actual flush type, kernel (global) vs. user
(non-global). Global in this sense means using the global bit in the page
table entry, which makes TLB entries persistent across CR3 reloads, not
global as in the SMP sense of invoking remote shootdowns, so the term is
confusingly overloaded.
AK: folded in fix from Zach for PAE compilation
Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'include/asm-i386/paravirt.h')
-rw-r--r-- | include/asm-i386/paravirt.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h index e2c803fadb14..9f06265065f4 100644 --- a/include/asm-i386/paravirt.h +++ b/include/asm-i386/paravirt.h | |||
@@ -4,6 +4,7 @@ | |||
4 | * para-virtualization: those hooks are defined here. */ | 4 | * para-virtualization: those hooks are defined here. */ |
5 | #include <linux/linkage.h> | 5 | #include <linux/linkage.h> |
6 | #include <linux/stringify.h> | 6 | #include <linux/stringify.h> |
7 | #include <asm/page.h> | ||
7 | 8 | ||
8 | #ifdef CONFIG_PARAVIRT | 9 | #ifdef CONFIG_PARAVIRT |
9 | /* These are the most performance critical ops, so we want to be able to patch | 10 | /* These are the most performance critical ops, so we want to be able to patch |
@@ -27,6 +28,7 @@ | |||
27 | struct thread_struct; | 28 | struct thread_struct; |
28 | struct Xgt_desc_struct; | 29 | struct Xgt_desc_struct; |
29 | struct tss_struct; | 30 | struct tss_struct; |
31 | struct mm_struct; | ||
30 | struct paravirt_ops | 32 | struct paravirt_ops |
31 | { | 33 | { |
32 | unsigned int kernel_rpl; | 34 | unsigned int kernel_rpl; |
@@ -121,6 +123,23 @@ struct paravirt_ops | |||
121 | unsigned long (fastcall *apic_read)(unsigned long reg); | 123 | unsigned long (fastcall *apic_read)(unsigned long reg); |
122 | #endif | 124 | #endif |
123 | 125 | ||
126 | void (fastcall *flush_tlb_user)(void); | ||
127 | void (fastcall *flush_tlb_kernel)(void); | ||
128 | void (fastcall *flush_tlb_single)(u32 addr); | ||
129 | |||
130 | void (fastcall *set_pte)(pte_t *ptep, pte_t pteval); | ||
131 | void (fastcall *set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval); | ||
132 | void (fastcall *set_pmd)(pmd_t *pmdp, pmd_t pmdval); | ||
133 | void (fastcall *pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep); | ||
134 | void (fastcall *pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep); | ||
135 | #ifdef CONFIG_X86_PAE | ||
136 | void (fastcall *set_pte_atomic)(pte_t *ptep, pte_t pteval); | ||
137 | void (fastcall *set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); | ||
138 | void (fastcall *set_pud)(pud_t *pudp, pud_t pudval); | ||
139 | void (fastcall *pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); | ||
140 | void (fastcall *pmd_clear)(pmd_t *pmdp); | ||
141 | #endif | ||
142 | |||
124 | /* These two are jmp to, not actually called. */ | 143 | /* These two are jmp to, not actually called. */ |
125 | void (fastcall *irq_enable_sysexit)(void); | 144 | void (fastcall *irq_enable_sysexit)(void); |
126 | void (fastcall *iret)(void); | 145 | void (fastcall *iret)(void); |
@@ -297,6 +316,62 @@ static inline unsigned long apic_read(unsigned long reg) | |||
297 | #endif | 316 | #endif |
298 | 317 | ||
299 | 318 | ||
319 | #define __flush_tlb() paravirt_ops.flush_tlb_user() | ||
320 | #define __flush_tlb_global() paravirt_ops.flush_tlb_kernel() | ||
321 | #define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr) | ||
322 | |||
323 | static inline void set_pte(pte_t *ptep, pte_t pteval) | ||
324 | { | ||
325 | paravirt_ops.set_pte(ptep, pteval); | ||
326 | } | ||
327 | |||
328 | static inline void set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) | ||
329 | { | ||
330 | paravirt_ops.set_pte_at(mm, addr, ptep, pteval); | ||
331 | } | ||
332 | |||
333 | static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval) | ||
334 | { | ||
335 | paravirt_ops.set_pmd(pmdp, pmdval); | ||
336 | } | ||
337 | |||
338 | static inline void pte_update(struct mm_struct *mm, u32 addr, pte_t *ptep) | ||
339 | { | ||
340 | paravirt_ops.pte_update(mm, addr, ptep); | ||
341 | } | ||
342 | |||
343 | static inline void pte_update_defer(struct mm_struct *mm, u32 addr, pte_t *ptep) | ||
344 | { | ||
345 | paravirt_ops.pte_update_defer(mm, addr, ptep); | ||
346 | } | ||
347 | |||
348 | #ifdef CONFIG_X86_PAE | ||
349 | static inline void set_pte_atomic(pte_t *ptep, pte_t pteval) | ||
350 | { | ||
351 | paravirt_ops.set_pte_atomic(ptep, pteval); | ||
352 | } | ||
353 | |||
354 | static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) | ||
355 | { | ||
356 | paravirt_ops.set_pte_present(mm, addr, ptep, pte); | ||
357 | } | ||
358 | |||
359 | static inline void set_pud(pud_t *pudp, pud_t pudval) | ||
360 | { | ||
361 | paravirt_ops.set_pud(pudp, pudval); | ||
362 | } | ||
363 | |||
364 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
365 | { | ||
366 | paravirt_ops.pte_clear(mm, addr, ptep); | ||
367 | } | ||
368 | |||
369 | static inline void pmd_clear(pmd_t *pmdp) | ||
370 | { | ||
371 | paravirt_ops.pmd_clear(pmdp); | ||
372 | } | ||
373 | #endif | ||
374 | |||
300 | /* These all sit in the .parainstructions section to tell us what to patch. */ | 375 | /* These all sit in the .parainstructions section to tell us what to patch. */ |
301 | struct paravirt_patch { | 376 | struct paravirt_patch { |
302 | u8 *instr; /* original instructions */ | 377 | u8 *instr; /* original instructions */ |