diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-09-04 15:08:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-04 15:08:09 -0400 |
commit | 62b3f981886b9b899eb0fc5fb59375f4512a1bd1 (patch) | |
tree | 08064a8c97ac6fb3f65a6363d2fda6f7417644f5 /include | |
parent | af2e1f276ff08f17192411ea3b71c13a758dfe12 (diff) | |
parent | b05f78f5c713eda2c34e495d92495ee4f1c3b5e1 (diff) |
Merge branch 'x86/debug' into x86/cpu
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/msr.h | 23 | ||||
-rw-r--r-- | include/asm-x86/paravirt.h | 12 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h index 2362cfda1fbc..771bcb2f8d80 100644 --- a/include/asm-x86/msr.h +++ b/include/asm-x86/msr.h | |||
@@ -63,6 +63,22 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr, | |||
63 | return EAX_EDX_VAL(val, low, high); | 63 | return EAX_EDX_VAL(val, low, high); |
64 | } | 64 | } |
65 | 65 | ||
66 | static inline unsigned long long native_read_msr_amd_safe(unsigned int msr, | ||
67 | int *err) | ||
68 | { | ||
69 | DECLARE_ARGS(val, low, high); | ||
70 | |||
71 | asm volatile("2: rdmsr ; xor %0,%0\n" | ||
72 | "1:\n\t" | ||
73 | ".section .fixup,\"ax\"\n\t" | ||
74 | "3: mov %3,%0 ; jmp 1b\n\t" | ||
75 | ".previous\n\t" | ||
76 | _ASM_EXTABLE(2b, 3b) | ||
77 | : "=r" (*err), EAX_EDX_RET(val, low, high) | ||
78 | : "c" (msr), "D" (0x9c5a203a), "i" (-EFAULT)); | ||
79 | return EAX_EDX_VAL(val, low, high); | ||
80 | } | ||
81 | |||
66 | static inline void native_write_msr(unsigned int msr, | 82 | static inline void native_write_msr(unsigned int msr, |
67 | unsigned low, unsigned high) | 83 | unsigned low, unsigned high) |
68 | { | 84 | { |
@@ -158,6 +174,13 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) | |||
158 | *p = native_read_msr_safe(msr, &err); | 174 | *p = native_read_msr_safe(msr, &err); |
159 | return err; | 175 | return err; |
160 | } | 176 | } |
177 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) | ||
178 | { | ||
179 | int err; | ||
180 | |||
181 | *p = native_read_msr_amd_safe(msr, &err); | ||
182 | return err; | ||
183 | } | ||
161 | 184 | ||
162 | #define rdtscl(low) \ | 185 | #define rdtscl(low) \ |
163 | ((low) = (u32)native_read_tsc()) | 186 | ((low) = (u32)native_read_tsc()) |
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index fbbde93f12d6..d5cfc5e3eb5b 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -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 | ||
@@ -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 | { |