diff options
Diffstat (limited to 'include/asm-x86/paravirt.h')
-rw-r--r-- | include/asm-x86/paravirt.h | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index d6236eb46466..3d419398499b 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -231,7 +231,8 @@ struct pv_mmu_ops { | |||
231 | void (*set_pte_at)(struct mm_struct *mm, unsigned long addr, | 231 | void (*set_pte_at)(struct mm_struct *mm, unsigned long addr, |
232 | pte_t *ptep, pte_t pteval); | 232 | pte_t *ptep, pte_t pteval); |
233 | void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); | 233 | void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval); |
234 | void (*pte_update)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); | 234 | void (*pte_update)(struct mm_struct *mm, unsigned long addr, |
235 | pte_t *ptep); | ||
235 | void (*pte_update_defer)(struct mm_struct *mm, | 236 | void (*pte_update_defer)(struct mm_struct *mm, |
236 | unsigned long addr, pte_t *ptep); | 237 | unsigned long addr, pte_t *ptep); |
237 | 238 | ||
@@ -246,7 +247,8 @@ struct pv_mmu_ops { | |||
246 | void (*set_pte_atomic)(pte_t *ptep, pte_t pteval); | 247 | void (*set_pte_atomic)(pte_t *ptep, pte_t pteval); |
247 | void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, | 248 | void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, |
248 | pte_t *ptep, pte_t pte); | 249 | pte_t *ptep, pte_t pte); |
249 | void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); | 250 | void (*pte_clear)(struct mm_struct *mm, unsigned long addr, |
251 | pte_t *ptep); | ||
250 | void (*pmd_clear)(pmd_t *pmdp); | 252 | void (*pmd_clear)(pmd_t *pmdp); |
251 | 253 | ||
252 | #endif /* CONFIG_X86_PAE */ | 254 | #endif /* CONFIG_X86_PAE */ |
@@ -274,8 +276,7 @@ struct pv_mmu_ops { | |||
274 | /* This contains all the paravirt structures: we get a convenient | 276 | /* This contains all the paravirt structures: we get a convenient |
275 | * number for each function using the offset which we use to indicate | 277 | * number for each function using the offset which we use to indicate |
276 | * what to patch. */ | 278 | * what to patch. */ |
277 | struct paravirt_patch_template | 279 | struct paravirt_patch_template { |
278 | { | ||
279 | struct pv_init_ops pv_init_ops; | 280 | struct pv_init_ops pv_init_ops; |
280 | struct pv_time_ops pv_time_ops; | 281 | struct pv_time_ops pv_time_ops; |
281 | struct pv_cpu_ops pv_cpu_ops; | 282 | struct pv_cpu_ops pv_cpu_ops; |
@@ -660,43 +661,56 @@ static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) | |||
660 | } | 661 | } |
661 | 662 | ||
662 | /* These should all do BUG_ON(_err), but our headers are too tangled. */ | 663 | /* These should all do BUG_ON(_err), but our headers are too tangled. */ |
663 | #define rdmsr(msr,val1,val2) do { \ | 664 | #define rdmsr(msr, val1, val2) \ |
665 | do { \ | ||
664 | int _err; \ | 666 | int _err; \ |
665 | u64 _l = paravirt_read_msr(msr, &_err); \ | 667 | u64 _l = paravirt_read_msr(msr, &_err); \ |
666 | val1 = (u32)_l; \ | 668 | val1 = (u32)_l; \ |
667 | val2 = _l >> 32; \ | 669 | val2 = _l >> 32; \ |
668 | } while(0) | 670 | } while (0) |
669 | 671 | ||
670 | #define wrmsr(msr,val1,val2) do { \ | 672 | #define wrmsr(msr, val1, val2) \ |
673 | do { \ | ||
671 | paravirt_write_msr(msr, val1, val2); \ | 674 | paravirt_write_msr(msr, val1, val2); \ |
672 | } while(0) | 675 | } while (0) |
673 | 676 | ||
674 | #define rdmsrl(msr,val) do { \ | 677 | #define rdmsrl(msr, val) \ |
678 | do { \ | ||
675 | int _err; \ | 679 | int _err; \ |
676 | val = paravirt_read_msr(msr, &_err); \ | 680 | val = paravirt_read_msr(msr, &_err); \ |
677 | } while(0) | 681 | } while (0) |
678 | 682 | ||
679 | #define wrmsrl(msr,val) wrmsr(msr, (u32)((u64)(val)), ((u64)(val))>>32) | 683 | #define wrmsrl(msr, val) wrmsr(msr, (u32)((u64)(val)), ((u64)(val))>>32) |
680 | #define wrmsr_safe(msr,a,b) paravirt_write_msr(msr, a, b) | 684 | #define wrmsr_safe(msr, a, b) paravirt_write_msr(msr, a, b) |
681 | 685 | ||
682 | /* rdmsr with exception handling */ | 686 | /* rdmsr with exception handling */ |
683 | #define rdmsr_safe(msr,a,b) ({ \ | 687 | #define rdmsr_safe(msr, a, b) \ |
688 | ({ \ | ||
684 | int _err; \ | 689 | int _err; \ |
685 | u64 _l = paravirt_read_msr(msr, &_err); \ | 690 | u64 _l = paravirt_read_msr(msr, &_err); \ |
686 | (*a) = (u32)_l; \ | 691 | (*a) = (u32)_l; \ |
687 | (*b) = _l >> 32; \ | 692 | (*b) = _l >> 32; \ |
688 | _err; }) | 693 | _err; \ |
694 | }) | ||
695 | |||
696 | static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) | ||
697 | { | ||
698 | int err; | ||
689 | 699 | ||
700 | *p = paravirt_read_msr(msr, &err); | ||
701 | return err; | ||
702 | } | ||
690 | 703 | ||
691 | static inline u64 paravirt_read_tsc(void) | 704 | static inline u64 paravirt_read_tsc(void) |
692 | { | 705 | { |
693 | return PVOP_CALL0(u64, pv_cpu_ops.read_tsc); | 706 | return PVOP_CALL0(u64, pv_cpu_ops.read_tsc); |
694 | } | 707 | } |
695 | 708 | ||
696 | #define rdtscl(low) do { \ | 709 | #define rdtscl(low) \ |
710 | do { \ | ||
697 | u64 _l = paravirt_read_tsc(); \ | 711 | u64 _l = paravirt_read_tsc(); \ |
698 | low = (int)_l; \ | 712 | low = (int)_l; \ |
699 | } while(0) | 713 | } while (0) |
700 | 714 | ||
701 | #define rdtscll(val) (val = paravirt_read_tsc()) | 715 | #define rdtscll(val) (val = paravirt_read_tsc()) |
702 | 716 | ||
@@ -711,11 +725,12 @@ static inline unsigned long long paravirt_read_pmc(int counter) | |||
711 | return PVOP_CALL1(u64, pv_cpu_ops.read_pmc, counter); | 725 | return PVOP_CALL1(u64, pv_cpu_ops.read_pmc, counter); |
712 | } | 726 | } |
713 | 727 | ||
714 | #define rdpmc(counter,low,high) do { \ | 728 | #define rdpmc(counter, low, high) \ |
729 | do { \ | ||
715 | u64 _l = paravirt_read_pmc(counter); \ | 730 | u64 _l = paravirt_read_pmc(counter); \ |
716 | low = (u32)_l; \ | 731 | low = (u32)_l; \ |
717 | high = _l >> 32; \ | 732 | high = _l >> 32; \ |
718 | } while(0) | 733 | } while (0) |
719 | 734 | ||
720 | static inline unsigned long long paravirt_rdtscp(unsigned int *aux) | 735 | static inline unsigned long long paravirt_rdtscp(unsigned int *aux) |
721 | { | 736 | { |
@@ -794,7 +809,8 @@ static inline void set_iopl_mask(unsigned mask) | |||
794 | } | 809 | } |
795 | 810 | ||
796 | /* The paravirtualized I/O functions */ | 811 | /* The paravirtualized I/O functions */ |
797 | static inline void slow_down_io(void) { | 812 | static inline void slow_down_io(void) |
813 | { | ||
798 | pv_cpu_ops.io_delay(); | 814 | pv_cpu_ops.io_delay(); |
799 | #ifdef REALLY_SLOW_IO | 815 | #ifdef REALLY_SLOW_IO |
800 | pv_cpu_ops.io_delay(); | 816 | pv_cpu_ops.io_delay(); |