aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/paravirt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/paravirt.h')
-rw-r--r--include/asm-i386/paravirt.h168
1 files changed, 109 insertions, 59 deletions
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 9f06265065f4..6317e0a4d735 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -59,90 +59,102 @@ struct paravirt_ops
59 convention. This makes it easier to implement inline 59 convention. This makes it easier to implement inline
60 assembler replacements. */ 60 assembler replacements. */
61 61
62 void (fastcall *cpuid)(unsigned int *eax, unsigned int *ebx, 62 void (*cpuid)(unsigned int *eax, unsigned int *ebx,
63 unsigned int *ecx, unsigned int *edx); 63 unsigned int *ecx, unsigned int *edx);
64 64
65 unsigned long (fastcall *get_debugreg)(int regno); 65 unsigned long (*get_debugreg)(int regno);
66 void (fastcall *set_debugreg)(int regno, unsigned long value); 66 void (*set_debugreg)(int regno, unsigned long value);
67 67
68 void (fastcall *clts)(void); 68 void (*clts)(void);
69 69
70 unsigned long (fastcall *read_cr0)(void); 70 unsigned long (*read_cr0)(void);
71 void (fastcall *write_cr0)(unsigned long); 71 void (*write_cr0)(unsigned long);
72 72
73 unsigned long (fastcall *read_cr2)(void); 73 unsigned long (*read_cr2)(void);
74 void (fastcall *write_cr2)(unsigned long); 74 void (*write_cr2)(unsigned long);
75 75
76 unsigned long (fastcall *read_cr3)(void); 76 unsigned long (*read_cr3)(void);
77 void (fastcall *write_cr3)(unsigned long); 77 void (*write_cr3)(unsigned long);
78 78
79 unsigned long (fastcall *read_cr4_safe)(void); 79 unsigned long (*read_cr4_safe)(void);
80 unsigned long (fastcall *read_cr4)(void); 80 unsigned long (*read_cr4)(void);
81 void (fastcall *write_cr4)(unsigned long); 81 void (*write_cr4)(unsigned long);
82 82
83 unsigned long (fastcall *save_fl)(void); 83 unsigned long (*save_fl)(void);
84 void (fastcall *restore_fl)(unsigned long); 84 void (*restore_fl)(unsigned long);
85 void (fastcall *irq_disable)(void); 85 void (*irq_disable)(void);
86 void (fastcall *irq_enable)(void); 86 void (*irq_enable)(void);
87 void (fastcall *safe_halt)(void); 87 void (*safe_halt)(void);
88 void (fastcall *halt)(void); 88 void (*halt)(void);
89 void (fastcall *wbinvd)(void); 89 void (*wbinvd)(void);
90 90
91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ 91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
92 u64 (fastcall *read_msr)(unsigned int msr, int *err); 92 u64 (*read_msr)(unsigned int msr, int *err);
93 int (fastcall *write_msr)(unsigned int msr, u64 val); 93 int (*write_msr)(unsigned int msr, u64 val);
94 94
95 u64 (fastcall *read_tsc)(void); 95 u64 (*read_tsc)(void);
96 u64 (fastcall *read_pmc)(void); 96 u64 (*read_pmc)(void);
97 97
98 void (fastcall *load_tr_desc)(void); 98 void (*load_tr_desc)(void);
99 void (fastcall *load_gdt)(const struct Xgt_desc_struct *); 99 void (*load_gdt)(const struct Xgt_desc_struct *);
100 void (fastcall *load_idt)(const struct Xgt_desc_struct *); 100 void (*load_idt)(const struct Xgt_desc_struct *);
101 void (fastcall *store_gdt)(struct Xgt_desc_struct *); 101 void (*store_gdt)(struct Xgt_desc_struct *);
102 void (fastcall *store_idt)(struct Xgt_desc_struct *); 102 void (*store_idt)(struct Xgt_desc_struct *);
103 void (fastcall *set_ldt)(const void *desc, unsigned entries); 103 void (*set_ldt)(const void *desc, unsigned entries);
104 unsigned long (fastcall *store_tr)(void); 104 unsigned long (*store_tr)(void);
105 void (fastcall *load_tls)(struct thread_struct *t, unsigned int cpu); 105 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
106 void (fastcall *write_ldt_entry)(void *dt, int entrynum, 106 void (*write_ldt_entry)(void *dt, int entrynum,
107 u32 low, u32 high); 107 u32 low, u32 high);
108 void (fastcall *write_gdt_entry)(void *dt, int entrynum, 108 void (*write_gdt_entry)(void *dt, int entrynum,
109 u32 low, u32 high); 109 u32 low, u32 high);
110 void (fastcall *write_idt_entry)(void *dt, int entrynum, 110 void (*write_idt_entry)(void *dt, int entrynum,
111 u32 low, u32 high); 111 u32 low, u32 high);
112 void (fastcall *load_esp0)(struct tss_struct *tss, 112 void (*load_esp0)(struct tss_struct *tss,
113 struct thread_struct *thread); 113 struct thread_struct *thread);
114 114
115 void (fastcall *set_iopl_mask)(unsigned mask); 115 void (*set_iopl_mask)(unsigned mask);
116 116
117 void (fastcall *io_delay)(void); 117 void (*io_delay)(void);
118 void (*const_udelay)(unsigned long loops); 118 void (*const_udelay)(unsigned long loops);
119 119
120#ifdef CONFIG_X86_LOCAL_APIC 120#ifdef CONFIG_X86_LOCAL_APIC
121 void (fastcall *apic_write)(unsigned long reg, unsigned long v); 121 void (*apic_write)(unsigned long reg, unsigned long v);
122 void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v); 122 void (*apic_write_atomic)(unsigned long reg, unsigned long v);
123 unsigned long (fastcall *apic_read)(unsigned long reg); 123 unsigned long (*apic_read)(unsigned long reg);
124 void (*setup_boot_clock)(void);
125 void (*setup_secondary_clock)(void);
124#endif 126#endif
125 127
126 void (fastcall *flush_tlb_user)(void); 128 void (*flush_tlb_user)(void);
127 void (fastcall *flush_tlb_kernel)(void); 129 void (*flush_tlb_kernel)(void);
128 void (fastcall *flush_tlb_single)(u32 addr); 130 void (*flush_tlb_single)(u32 addr);
129 131
130 void (fastcall *set_pte)(pte_t *ptep, pte_t pteval); 132 void (*alloc_pt)(u32 pfn);
131 void (fastcall *set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval); 133 void (*alloc_pd)(u32 pfn);
132 void (fastcall *set_pmd)(pmd_t *pmdp, pmd_t pmdval); 134 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
133 void (fastcall *pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep); 135 void (*release_pt)(u32 pfn);
134 void (fastcall *pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep); 136 void (*release_pd)(u32 pfn);
137
138 void (*set_pte)(pte_t *ptep, pte_t pteval);
139 void (*set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval);
140 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
141 void (*pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep);
142 void (*pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep);
135#ifdef CONFIG_X86_PAE 143#ifdef CONFIG_X86_PAE
136 void (fastcall *set_pte_atomic)(pte_t *ptep, pte_t pteval); 144 void (*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); 145 void (*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); 146 void (*set_pud)(pud_t *pudp, pud_t pudval);
139 void (fastcall *pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 147 void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
140 void (fastcall *pmd_clear)(pmd_t *pmdp); 148 void (*pmd_clear)(pmd_t *pmdp);
141#endif 149#endif
142 150
151 void (*set_lazy_mode)(int mode);
152
143 /* These two are jmp to, not actually called. */ 153 /* These two are jmp to, not actually called. */
144 void (fastcall *irq_enable_sysexit)(void); 154 void (*irq_enable_sysexit)(void);
145 void (fastcall *iret)(void); 155 void (*iret)(void);
156
157 void (*startup_ipi_hook)(int phys_apicid, unsigned long start_eip, unsigned long start_esp);
146}; 158};
147 159
148/* Mark a paravirt probe function. */ 160/* Mark a paravirt probe function. */
@@ -313,13 +325,38 @@ static inline unsigned long apic_read(unsigned long reg)
313{ 325{
314 return paravirt_ops.apic_read(reg); 326 return paravirt_ops.apic_read(reg);
315} 327}
328
329static inline void setup_boot_clock(void)
330{
331 paravirt_ops.setup_boot_clock();
332}
333
334static inline void setup_secondary_clock(void)
335{
336 paravirt_ops.setup_secondary_clock();
337}
316#endif 338#endif
317 339
340#ifdef CONFIG_SMP
341static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
342 unsigned long start_esp)
343{
344 return paravirt_ops.startup_ipi_hook(phys_apicid, start_eip, start_esp);
345}
346#endif
318 347
319#define __flush_tlb() paravirt_ops.flush_tlb_user() 348#define __flush_tlb() paravirt_ops.flush_tlb_user()
320#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel() 349#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel()
321#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr) 350#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr)
322 351
352#define paravirt_alloc_pt(pfn) paravirt_ops.alloc_pt(pfn)
353#define paravirt_release_pt(pfn) paravirt_ops.release_pt(pfn)
354
355#define paravirt_alloc_pd(pfn) paravirt_ops.alloc_pd(pfn)
356#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) \
357 paravirt_ops.alloc_pd_clone(pfn, clonepfn, start, count)
358#define paravirt_release_pd(pfn) paravirt_ops.release_pd(pfn)
359
323static inline void set_pte(pte_t *ptep, pte_t pteval) 360static inline void set_pte(pte_t *ptep, pte_t pteval)
324{ 361{
325 paravirt_ops.set_pte(ptep, pteval); 362 paravirt_ops.set_pte(ptep, pteval);
@@ -372,6 +409,19 @@ static inline void pmd_clear(pmd_t *pmdp)
372} 409}
373#endif 410#endif
374 411
412/* Lazy mode for batching updates / context switch */
413#define PARAVIRT_LAZY_NONE 0
414#define PARAVIRT_LAZY_MMU 1
415#define PARAVIRT_LAZY_CPU 2
416
417#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
418#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU)
419#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
420
421#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
422#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU)
423#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
424
375/* These all sit in the .parainstructions section to tell us what to patch. */ 425/* These all sit in the .parainstructions section to tell us what to patch. */
376struct paravirt_patch { 426struct paravirt_patch {
377 u8 *instr; /* original instructions */ 427 u8 *instr; /* original instructions */