diff options
Diffstat (limited to 'include/asm-x86/paravirt.h')
| -rw-r--r-- | include/asm-x86/paravirt.h | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index fbbde93f12d6..891971f57d35 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 | ||
| @@ -137,6 +137,7 @@ struct pv_cpu_ops { | |||
| 137 | 137 | ||
| 138 | /* MSR, PMC and TSR operations. | 138 | /* MSR, PMC and TSR operations. |
| 139 | err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ | 139 | err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ |
| 140 | u64 (*read_msr_amd)(unsigned int msr, int *err); | ||
| 140 | u64 (*read_msr)(unsigned int msr, int *err); | 141 | u64 (*read_msr)(unsigned int msr, int *err); |
| 141 | int (*write_msr)(unsigned int msr, unsigned low, unsigned high); | 142 | int (*write_msr)(unsigned int msr, unsigned low, unsigned high); |
| 142 | 143 | ||
| @@ -257,13 +258,13 @@ struct pv_mmu_ops { | |||
| 257 | * Hooks for allocating/releasing pagetable pages when they're | 258 | * Hooks for allocating/releasing pagetable pages when they're |
| 258 | * attached to a pagetable | 259 | * attached to a pagetable |
| 259 | */ | 260 | */ |
| 260 | void (*alloc_pte)(struct mm_struct *mm, u32 pfn); | 261 | void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn); |
| 261 | void (*alloc_pmd)(struct mm_struct *mm, u32 pfn); | 262 | void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn); |
| 262 | void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); | 263 | 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); | 264 | void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn); |
| 264 | void (*release_pte)(u32 pfn); | 265 | void (*release_pte)(unsigned long pfn); |
| 265 | void (*release_pmd)(u32 pfn); | 266 | void (*release_pmd)(unsigned long pfn); |
| 266 | void (*release_pud)(u32 pfn); | 267 | void (*release_pud)(unsigned long pfn); |
| 267 | 268 | ||
| 268 | /* Pagetable manipulation functions */ | 269 | /* Pagetable manipulation functions */ |
| 269 | void (*set_pte)(pte_t *ptep, pte_t pteval); | 270 | void (*set_pte)(pte_t *ptep, pte_t pteval); |
| @@ -726,6 +727,10 @@ static inline u64 paravirt_read_msr(unsigned msr, int *err) | |||
| 726 | { | 727 | { |
| 727 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); | 728 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); |
| 728 | } | 729 | } |
| 730 | static inline u64 paravirt_read_msr_amd(unsigned msr, int *err) | ||
| 731 | { | ||
| 732 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr_amd, msr, err); | ||
| 733 | } | ||
| 729 | static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) | 734 | static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) |
| 730 | { | 735 | { |
| 731 | return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); | 736 | return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); |
| @@ -771,6 +776,13 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) | |||
| 771 | *p = paravirt_read_msr(msr, &err); | 776 | *p = paravirt_read_msr(msr, &err); |
| 772 | return err; | 777 | return err; |
| 773 | } | 778 | } |
| 779 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) | ||
| 780 | { | ||
| 781 | int err; | ||
| 782 | |||
| 783 | *p = paravirt_read_msr_amd(msr, &err); | ||
| 784 | return err; | ||
| 785 | } | ||
| 774 | 786 | ||
| 775 | static inline u64 paravirt_read_tsc(void) | 787 | static inline u64 paravirt_read_tsc(void) |
| 776 | { | 788 | { |
| @@ -993,35 +1005,35 @@ static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
| 993 | PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); | 1005 | PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); |
| 994 | } | 1006 | } |
| 995 | 1007 | ||
| 996 | static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn) | 1008 | static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) |
| 997 | { | 1009 | { |
| 998 | PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); | 1010 | PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); |
| 999 | } | 1011 | } |
| 1000 | static inline void paravirt_release_pte(unsigned pfn) | 1012 | static inline void paravirt_release_pte(unsigned long pfn) |
| 1001 | { | 1013 | { |
| 1002 | PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); | 1014 | PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); |
| 1003 | } | 1015 | } |
| 1004 | 1016 | ||
| 1005 | static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn) | 1017 | static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) |
| 1006 | { | 1018 | { |
| 1007 | PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); | 1019 | PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); |
| 1008 | } | 1020 | } |
| 1009 | 1021 | ||
| 1010 | static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn, | 1022 | static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn, |
| 1011 | unsigned start, unsigned count) | 1023 | unsigned long start, unsigned long count) |
| 1012 | { | 1024 | { |
| 1013 | PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); | 1025 | PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); |
| 1014 | } | 1026 | } |
| 1015 | static inline void paravirt_release_pmd(unsigned pfn) | 1027 | static inline void paravirt_release_pmd(unsigned long pfn) |
| 1016 | { | 1028 | { |
| 1017 | PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); | 1029 | PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); |
| 1018 | } | 1030 | } |
| 1019 | 1031 | ||
| 1020 | static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn) | 1032 | static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) |
| 1021 | { | 1033 | { |
| 1022 | PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); | 1034 | PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); |
| 1023 | } | 1035 | } |
| 1024 | static inline void paravirt_release_pud(unsigned pfn) | 1036 | static inline void paravirt_release_pud(unsigned long pfn) |
| 1025 | { | 1037 | { |
| 1026 | PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); | 1038 | PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); |
| 1027 | } | 1039 | } |
| @@ -1634,4 +1646,4 @@ static inline unsigned long __raw_local_irq_save(void) | |||
| 1634 | 1646 | ||
| 1635 | #endif /* __ASSEMBLY__ */ | 1647 | #endif /* __ASSEMBLY__ */ |
| 1636 | #endif /* CONFIG_PARAVIRT */ | 1648 | #endif /* CONFIG_PARAVIRT */ |
| 1637 | #endif /* __ASM_PARAVIRT_H */ | 1649 | #endif /* ASM_X86__PARAVIRT_H */ |
