diff options
Diffstat (limited to 'include/asm-x86/paravirt.h')
-rw-r--r-- | include/asm-x86/paravirt.h | 87 |
1 files changed, 50 insertions, 37 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index fbbde93f12d6..8d6ae2f760d0 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __ASM_PARAVIRT_H | 1 | #ifndef ASM_X86__PARAVIRT_H |
2 | #define __ASM_PARAVIRT_H | 2 | #define ASM_X86__PARAVIRT_H |
3 | /* Various instructions on x86 need to be replaced for | 3 | /* Various instructions on x86 need to be replaced for |
4 | * para-virtualization: those hooks are defined here. */ | 4 | * para-virtualization: those hooks are defined here. */ |
5 | 5 | ||
@@ -124,6 +124,9 @@ struct pv_cpu_ops { | |||
124 | int entrynum, const void *desc, int size); | 124 | int entrynum, const void *desc, int size); |
125 | void (*write_idt_entry)(gate_desc *, | 125 | void (*write_idt_entry)(gate_desc *, |
126 | int entrynum, const gate_desc *gate); | 126 | int entrynum, const gate_desc *gate); |
127 | void (*alloc_ldt)(struct desc_struct *ldt, unsigned entries); | ||
128 | void (*free_ldt)(struct desc_struct *ldt, unsigned entries); | ||
129 | |||
127 | void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); | 130 | void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t); |
128 | 131 | ||
129 | void (*set_iopl_mask)(unsigned mask); | 132 | void (*set_iopl_mask)(unsigned mask); |
@@ -137,6 +140,7 @@ struct pv_cpu_ops { | |||
137 | 140 | ||
138 | /* MSR, PMC and TSR operations. | 141 | /* MSR, PMC and TSR operations. |
139 | err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ | 142 | err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ |
143 | u64 (*read_msr_amd)(unsigned int msr, int *err); | ||
140 | u64 (*read_msr)(unsigned int msr, int *err); | 144 | u64 (*read_msr)(unsigned int msr, int *err); |
141 | int (*write_msr)(unsigned int msr, unsigned low, unsigned high); | 145 | int (*write_msr)(unsigned int msr, unsigned low, unsigned high); |
142 | 146 | ||
@@ -200,12 +204,6 @@ struct pv_irq_ops { | |||
200 | 204 | ||
201 | struct pv_apic_ops { | 205 | struct pv_apic_ops { |
202 | #ifdef CONFIG_X86_LOCAL_APIC | 206 | #ifdef CONFIG_X86_LOCAL_APIC |
203 | /* | ||
204 | * Direct APIC operations, principally for VMI. Ideally | ||
205 | * these shouldn't be in this interface. | ||
206 | */ | ||
207 | void (*apic_write)(unsigned long reg, u32 v); | ||
208 | u32 (*apic_read)(unsigned long reg); | ||
209 | void (*setup_boot_clock)(void); | 207 | void (*setup_boot_clock)(void); |
210 | void (*setup_secondary_clock)(void); | 208 | void (*setup_secondary_clock)(void); |
211 | 209 | ||
@@ -257,13 +255,13 @@ struct pv_mmu_ops { | |||
257 | * Hooks for allocating/releasing pagetable pages when they're | 255 | * Hooks for allocating/releasing pagetable pages when they're |
258 | * attached to a pagetable | 256 | * attached to a pagetable |
259 | */ | 257 | */ |
260 | void (*alloc_pte)(struct mm_struct *mm, u32 pfn); | 258 | void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn); |
261 | void (*alloc_pmd)(struct mm_struct *mm, u32 pfn); | 259 | void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn); |
262 | void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); | 260 | void (*alloc_pmd_clone)(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count); |
263 | void (*alloc_pud)(struct mm_struct *mm, u32 pfn); | 261 | void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn); |
264 | void (*release_pte)(u32 pfn); | 262 | void (*release_pte)(unsigned long pfn); |
265 | void (*release_pmd)(u32 pfn); | 263 | void (*release_pmd)(unsigned long pfn); |
266 | void (*release_pud)(u32 pfn); | 264 | void (*release_pud)(unsigned long pfn); |
267 | 265 | ||
268 | /* Pagetable manipulation functions */ | 266 | /* Pagetable manipulation functions */ |
269 | void (*set_pte)(pte_t *ptep, pte_t pteval); | 267 | void (*set_pte)(pte_t *ptep, pte_t pteval); |
@@ -330,6 +328,7 @@ struct pv_lock_ops { | |||
330 | int (*spin_is_locked)(struct raw_spinlock *lock); | 328 | int (*spin_is_locked)(struct raw_spinlock *lock); |
331 | int (*spin_is_contended)(struct raw_spinlock *lock); | 329 | int (*spin_is_contended)(struct raw_spinlock *lock); |
332 | void (*spin_lock)(struct raw_spinlock *lock); | 330 | void (*spin_lock)(struct raw_spinlock *lock); |
331 | void (*spin_lock_flags)(struct raw_spinlock *lock, unsigned long flags); | ||
333 | int (*spin_trylock)(struct raw_spinlock *lock); | 332 | int (*spin_trylock)(struct raw_spinlock *lock); |
334 | void (*spin_unlock)(struct raw_spinlock *lock); | 333 | void (*spin_unlock)(struct raw_spinlock *lock); |
335 | }; | 334 | }; |
@@ -726,6 +725,10 @@ static inline u64 paravirt_read_msr(unsigned msr, int *err) | |||
726 | { | 725 | { |
727 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); | 726 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); |
728 | } | 727 | } |
728 | static inline u64 paravirt_read_msr_amd(unsigned msr, int *err) | ||
729 | { | ||
730 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr_amd, msr, err); | ||
731 | } | ||
729 | static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) | 732 | static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) |
730 | { | 733 | { |
731 | return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); | 734 | return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); |
@@ -771,6 +774,13 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) | |||
771 | *p = paravirt_read_msr(msr, &err); | 774 | *p = paravirt_read_msr(msr, &err); |
772 | return err; | 775 | return err; |
773 | } | 776 | } |
777 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) | ||
778 | { | ||
779 | int err; | ||
780 | |||
781 | *p = paravirt_read_msr_amd(msr, &err); | ||
782 | return err; | ||
783 | } | ||
774 | 784 | ||
775 | static inline u64 paravirt_read_tsc(void) | 785 | static inline u64 paravirt_read_tsc(void) |
776 | { | 786 | { |
@@ -824,6 +834,16 @@ do { \ | |||
824 | (aux) = __aux; \ | 834 | (aux) = __aux; \ |
825 | } while (0) | 835 | } while (0) |
826 | 836 | ||
837 | static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries) | ||
838 | { | ||
839 | PVOP_VCALL2(pv_cpu_ops.alloc_ldt, ldt, entries); | ||
840 | } | ||
841 | |||
842 | static inline void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries) | ||
843 | { | ||
844 | PVOP_VCALL2(pv_cpu_ops.free_ldt, ldt, entries); | ||
845 | } | ||
846 | |||
827 | static inline void load_TR_desc(void) | 847 | static inline void load_TR_desc(void) |
828 | { | 848 | { |
829 | PVOP_VCALL0(pv_cpu_ops.load_tr_desc); | 849 | PVOP_VCALL0(pv_cpu_ops.load_tr_desc); |
@@ -898,19 +918,6 @@ static inline void slow_down_io(void) | |||
898 | } | 918 | } |
899 | 919 | ||
900 | #ifdef CONFIG_X86_LOCAL_APIC | 920 | #ifdef CONFIG_X86_LOCAL_APIC |
901 | /* | ||
902 | * Basic functions accessing APICs. | ||
903 | */ | ||
904 | static inline void apic_write(unsigned long reg, u32 v) | ||
905 | { | ||
906 | PVOP_VCALL2(pv_apic_ops.apic_write, reg, v); | ||
907 | } | ||
908 | |||
909 | static inline u32 apic_read(unsigned long reg) | ||
910 | { | ||
911 | return PVOP_CALL1(unsigned long, pv_apic_ops.apic_read, reg); | ||
912 | } | ||
913 | |||
914 | static inline void setup_boot_clock(void) | 921 | static inline void setup_boot_clock(void) |
915 | { | 922 | { |
916 | PVOP_VCALL0(pv_apic_ops.setup_boot_clock); | 923 | PVOP_VCALL0(pv_apic_ops.setup_boot_clock); |
@@ -993,35 +1000,35 @@ static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
993 | PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); | 1000 | PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); |
994 | } | 1001 | } |
995 | 1002 | ||
996 | static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn) | 1003 | static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) |
997 | { | 1004 | { |
998 | PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); | 1005 | PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); |
999 | } | 1006 | } |
1000 | static inline void paravirt_release_pte(unsigned pfn) | 1007 | static inline void paravirt_release_pte(unsigned long pfn) |
1001 | { | 1008 | { |
1002 | PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); | 1009 | PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); |
1003 | } | 1010 | } |
1004 | 1011 | ||
1005 | static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn) | 1012 | static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) |
1006 | { | 1013 | { |
1007 | PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); | 1014 | PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); |
1008 | } | 1015 | } |
1009 | 1016 | ||
1010 | static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn, | 1017 | static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn, |
1011 | unsigned start, unsigned count) | 1018 | unsigned long start, unsigned long count) |
1012 | { | 1019 | { |
1013 | PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); | 1020 | PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); |
1014 | } | 1021 | } |
1015 | static inline void paravirt_release_pmd(unsigned pfn) | 1022 | static inline void paravirt_release_pmd(unsigned long pfn) |
1016 | { | 1023 | { |
1017 | PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); | 1024 | PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); |
1018 | } | 1025 | } |
1019 | 1026 | ||
1020 | static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn) | 1027 | static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) |
1021 | { | 1028 | { |
1022 | PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); | 1029 | PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); |
1023 | } | 1030 | } |
1024 | static inline void paravirt_release_pud(unsigned pfn) | 1031 | static inline void paravirt_release_pud(unsigned long pfn) |
1025 | { | 1032 | { |
1026 | PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); | 1033 | PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); |
1027 | } | 1034 | } |
@@ -1401,6 +1408,12 @@ static __always_inline void __raw_spin_lock(struct raw_spinlock *lock) | |||
1401 | PVOP_VCALL1(pv_lock_ops.spin_lock, lock); | 1408 | PVOP_VCALL1(pv_lock_ops.spin_lock, lock); |
1402 | } | 1409 | } |
1403 | 1410 | ||
1411 | static __always_inline void __raw_spin_lock_flags(struct raw_spinlock *lock, | ||
1412 | unsigned long flags) | ||
1413 | { | ||
1414 | PVOP_VCALL2(pv_lock_ops.spin_lock_flags, lock, flags); | ||
1415 | } | ||
1416 | |||
1404 | static __always_inline int __raw_spin_trylock(struct raw_spinlock *lock) | 1417 | static __always_inline int __raw_spin_trylock(struct raw_spinlock *lock) |
1405 | { | 1418 | { |
1406 | return PVOP_CALL1(int, pv_lock_ops.spin_trylock, lock); | 1419 | return PVOP_CALL1(int, pv_lock_ops.spin_trylock, lock); |
@@ -1634,4 +1647,4 @@ static inline unsigned long __raw_local_irq_save(void) | |||
1634 | 1647 | ||
1635 | #endif /* __ASSEMBLY__ */ | 1648 | #endif /* __ASSEMBLY__ */ |
1636 | #endif /* CONFIG_PARAVIRT */ | 1649 | #endif /* CONFIG_PARAVIRT */ |
1637 | #endif /* __ASM_PARAVIRT_H */ | 1650 | #endif /* ASM_X86__PARAVIRT_H */ |