H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_MSR_H |
| 2 | #define _ASM_X86_MSR_H |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 3 | |
| 4 | #include <asm/msr-index.h> |
| 5 | |
Glauber de Oliveira Costa | 8f12dea | 2008-01-30 13:31:06 +0100 | [diff] [blame] | 6 | #ifdef __KERNEL__ |
| 7 | #ifndef __ASSEMBLY__ |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 8 | |
Jaswinder Singh Rajput | 8fa62ad | 2009-06-17 14:11:10 +0530 | [diff] [blame] | 9 | #include <linux/types.h> |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 10 | #include <asm/asm.h> |
| 11 | #include <asm/errno.h> |
Borislav Petkov | 6bc1096 | 2009-05-22 12:12:01 +0200 | [diff] [blame] | 12 | #include <asm/cpumask.h> |
| 13 | |
| 14 | struct msr { |
| 15 | union { |
| 16 | struct { |
| 17 | u32 l; |
| 18 | u32 h; |
| 19 | }; |
| 20 | u64 q; |
| 21 | }; |
| 22 | }; |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 23 | |
Andrew Morton | 1e160cc | 2008-01-30 13:31:17 +0100 | [diff] [blame] | 24 | static inline unsigned long long native_read_tscp(unsigned int *aux) |
Glauber de Oliveira Costa | 8f12dea | 2008-01-30 13:31:06 +0100 | [diff] [blame] | 25 | { |
| 26 | unsigned long low, high; |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 27 | asm volatile(".byte 0x0f,0x01,0xf9" |
| 28 | : "=a" (low), "=d" (high), "=c" (*aux)); |
Max Asbock | 41aefdc | 2008-06-25 14:45:28 -0700 | [diff] [blame] | 29 | return low | ((u64)high << 32); |
Glauber de Oliveira Costa | 8f12dea | 2008-01-30 13:31:06 +0100 | [diff] [blame] | 30 | } |
| 31 | |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 32 | /* |
Jike Song | d4f1b10 | 2008-10-17 13:25:07 +0800 | [diff] [blame] | 33 | * both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A" |
| 34 | * constraint has different meanings. For i386, "A" means exactly |
| 35 | * edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead, |
| 36 | * it means rax *or* rdx. |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 37 | */ |
| 38 | #ifdef CONFIG_X86_64 |
| 39 | #define DECLARE_ARGS(val, low, high) unsigned low, high |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 40 | #define EAX_EDX_VAL(val, low, high) ((low) | ((u64)(high) << 32)) |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 41 | #define EAX_EDX_ARGS(val, low, high) "a" (low), "d" (high) |
| 42 | #define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) |
| 43 | #else |
| 44 | #define DECLARE_ARGS(val, low, high) unsigned long long val |
| 45 | #define EAX_EDX_VAL(val, low, high) (val) |
| 46 | #define EAX_EDX_ARGS(val, low, high) "A" (val) |
| 47 | #define EAX_EDX_RET(val, low, high) "=A" (val) |
Glauber de Oliveira Costa | 8f12dea | 2008-01-30 13:31:06 +0100 | [diff] [blame] | 48 | #endif |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 49 | |
| 50 | static inline unsigned long long native_read_msr(unsigned int msr) |
| 51 | { |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 52 | DECLARE_ARGS(val, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 53 | |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 54 | asm volatile("rdmsr" : EAX_EDX_RET(val, low, high) : "c" (msr)); |
| 55 | return EAX_EDX_VAL(val, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | static inline unsigned long long native_read_msr_safe(unsigned int msr, |
| 59 | int *err) |
| 60 | { |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 61 | DECLARE_ARGS(val, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 62 | |
H. Peter Anvin | 08970fc | 2008-08-25 22:39:15 -0700 | [diff] [blame] | 63 | asm volatile("2: rdmsr ; xor %[err],%[err]\n" |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 64 | "1:\n\t" |
| 65 | ".section .fixup,\"ax\"\n\t" |
H. Peter Anvin | 08970fc | 2008-08-25 22:39:15 -0700 | [diff] [blame] | 66 | "3: mov %[fault],%[err] ; jmp 1b\n\t" |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 67 | ".previous\n\t" |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 68 | _ASM_EXTABLE(2b, 3b) |
H. Peter Anvin | 08970fc | 2008-08-25 22:39:15 -0700 | [diff] [blame] | 69 | : [err] "=r" (*err), EAX_EDX_RET(val, low, high) |
H. Peter Anvin | 0cc0213 | 2009-08-31 14:23:29 -0700 | [diff] [blame^] | 70 | : "c" (msr), [fault] "i" (-EIO)); |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 71 | return EAX_EDX_VAL(val, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 72 | } |
| 73 | |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 74 | static inline void native_write_msr(unsigned int msr, |
| 75 | unsigned low, unsigned high) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 76 | { |
Jeremy Fitzhardinge | af2b1c6 | 2008-06-25 00:18:59 -0400 | [diff] [blame] | 77 | asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory"); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 78 | } |
| 79 | |
Frederic Weisbecker | 0ca59dd | 2008-12-24 23:30:02 +0100 | [diff] [blame] | 80 | /* Can be uninlined because referenced by paravirt */ |
| 81 | notrace static inline int native_write_msr_safe(unsigned int msr, |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 82 | unsigned low, unsigned high) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 83 | { |
| 84 | int err; |
H. Peter Anvin | 08970fc | 2008-08-25 22:39:15 -0700 | [diff] [blame] | 85 | asm volatile("2: wrmsr ; xor %[err],%[err]\n" |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 86 | "1:\n\t" |
| 87 | ".section .fixup,\"ax\"\n\t" |
H. Peter Anvin | 08970fc | 2008-08-25 22:39:15 -0700 | [diff] [blame] | 88 | "3: mov %[fault],%[err] ; jmp 1b\n\t" |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 89 | ".previous\n\t" |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 90 | _ASM_EXTABLE(2b, 3b) |
H. Peter Anvin | 08970fc | 2008-08-25 22:39:15 -0700 | [diff] [blame] | 91 | : [err] "=a" (err) |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 92 | : "c" (msr), "0" (low), "d" (high), |
H. Peter Anvin | 0cc0213 | 2009-08-31 14:23:29 -0700 | [diff] [blame^] | 93 | [fault] "i" (-EIO) |
Jeremy Fitzhardinge | af2b1c6 | 2008-06-25 00:18:59 -0400 | [diff] [blame] | 94 | : "memory"); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 95 | return err; |
| 96 | } |
| 97 | |
Ingo Molnar | cdc7957 | 2008-01-30 13:32:39 +0100 | [diff] [blame] | 98 | extern unsigned long long native_read_tsc(void); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 99 | |
Borislav Petkov | 132ec92 | 2009-08-31 09:50:09 +0200 | [diff] [blame] | 100 | extern int native_rdmsr_safe_regs(u32 *regs); |
| 101 | extern int native_wrmsr_safe_regs(u32 *regs); |
| 102 | |
Ingo Molnar | 92767af | 2008-01-30 13:32:40 +0100 | [diff] [blame] | 103 | static __always_inline unsigned long long __native_read_tsc(void) |
| 104 | { |
| 105 | DECLARE_ARGS(val, low, high); |
| 106 | |
Ingo Molnar | 92767af | 2008-01-30 13:32:40 +0100 | [diff] [blame] | 107 | asm volatile("rdtsc" : EAX_EDX_RET(val, low, high)); |
Ingo Molnar | 92767af | 2008-01-30 13:32:40 +0100 | [diff] [blame] | 108 | |
| 109 | return EAX_EDX_VAL(val, low, high); |
| 110 | } |
| 111 | |
Glauber de Oliveira Costa | b8d1fae | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 112 | static inline unsigned long long native_read_pmc(int counter) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 113 | { |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 114 | DECLARE_ARGS(val, low, high); |
| 115 | |
| 116 | asm volatile("rdpmc" : EAX_EDX_RET(val, low, high) : "c" (counter)); |
| 117 | return EAX_EDX_VAL(val, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | #ifdef CONFIG_PARAVIRT |
| 121 | #include <asm/paravirt.h> |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 122 | #else |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 123 | #include <linux/errno.h> |
| 124 | /* |
| 125 | * Access to machine-specific registers (available on 586 and better only) |
| 126 | * Note: the rd* operations modify the parameters directly (without using |
| 127 | * pointer indirection), this allows gcc to optimize better |
| 128 | */ |
| 129 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 130 | #define rdmsr(msr, val1, val2) \ |
| 131 | do { \ |
| 132 | u64 __val = native_read_msr((msr)); \ |
| 133 | (val1) = (u32)__val; \ |
| 134 | (val2) = (u32)(__val >> 32); \ |
| 135 | } while (0) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 136 | |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 137 | static inline void wrmsr(unsigned msr, unsigned low, unsigned high) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 138 | { |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 139 | native_write_msr(msr, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 140 | } |
| 141 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 142 | #define rdmsrl(msr, val) \ |
| 143 | ((val) = native_read_msr((msr))) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 144 | |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 145 | #define wrmsrl(msr, val) \ |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 146 | native_write_msr((msr), (u32)((u64)(val)), (u32)((u64)(val) >> 32)) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 147 | |
| 148 | /* wrmsr with exception handling */ |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 149 | static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 150 | { |
Glauber de Oliveira Costa | c9dcda5 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 151 | return native_write_msr_safe(msr, low, high); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | /* rdmsr with exception handling */ |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 155 | #define rdmsr_safe(msr, p1, p2) \ |
| 156 | ({ \ |
| 157 | int __err; \ |
| 158 | u64 __val = native_read_msr_safe((msr), &__err); \ |
| 159 | (*p1) = (u32)__val; \ |
| 160 | (*p2) = (u32)(__val >> 32); \ |
| 161 | __err; \ |
| 162 | }) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 163 | |
Andi Kleen | 1de87bd | 2008-03-22 10:59:28 +0100 | [diff] [blame] | 164 | static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) |
| 165 | { |
| 166 | int err; |
| 167 | |
| 168 | *p = native_read_msr_safe(msr, &err); |
| 169 | return err; |
| 170 | } |
Borislav Petkov | 177fed1 | 2009-08-31 09:50:10 +0200 | [diff] [blame] | 171 | |
Yinghai Lu | b05f78f | 2008-08-22 01:32:50 -0700 | [diff] [blame] | 172 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) |
| 173 | { |
Borislav Petkov | 177fed1 | 2009-08-31 09:50:10 +0200 | [diff] [blame] | 174 | u32 gprs[8] = { 0 }; |
Yinghai Lu | b05f78f | 2008-08-22 01:32:50 -0700 | [diff] [blame] | 175 | int err; |
| 176 | |
Borislav Petkov | 177fed1 | 2009-08-31 09:50:10 +0200 | [diff] [blame] | 177 | gprs[1] = msr; |
| 178 | gprs[7] = 0x9c5a203a; |
| 179 | |
| 180 | err = native_rdmsr_safe_regs(gprs); |
| 181 | |
| 182 | *p = gprs[0] | ((u64)gprs[2] << 32); |
| 183 | |
Yinghai Lu | b05f78f | 2008-08-22 01:32:50 -0700 | [diff] [blame] | 184 | return err; |
| 185 | } |
Andi Kleen | 1de87bd | 2008-03-22 10:59:28 +0100 | [diff] [blame] | 186 | |
Borislav Petkov | 177fed1 | 2009-08-31 09:50:10 +0200 | [diff] [blame] | 187 | static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val) |
| 188 | { |
| 189 | u32 gprs[8] = { 0 }; |
| 190 | |
| 191 | gprs[0] = (u32)val; |
| 192 | gprs[1] = msr; |
| 193 | gprs[2] = val >> 32; |
| 194 | gprs[7] = 0x9c5a203a; |
| 195 | |
| 196 | return native_wrmsr_safe_regs(gprs); |
| 197 | } |
| 198 | |
Borislav Petkov | 132ec92 | 2009-08-31 09:50:09 +0200 | [diff] [blame] | 199 | static inline int rdmsr_safe_regs(u32 *regs) |
| 200 | { |
| 201 | return native_rdmsr_safe_regs(regs); |
| 202 | } |
| 203 | |
| 204 | static inline int wrmsr_safe_regs(u32 *regs) |
| 205 | { |
| 206 | return native_wrmsr_safe_regs(regs); |
| 207 | } |
| 208 | |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 209 | #define rdtscl(low) \ |
Ken Chen | 205516c | 2008-12-16 00:32:21 -0800 | [diff] [blame] | 210 | ((low) = (u32)__native_read_tsc()) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 211 | |
| 212 | #define rdtscll(val) \ |
Ken Chen | 205516c | 2008-12-16 00:32:21 -0800 | [diff] [blame] | 213 | ((val) = __native_read_tsc()) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 214 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 215 | #define rdpmc(counter, low, high) \ |
| 216 | do { \ |
| 217 | u64 _l = native_read_pmc((counter)); \ |
| 218 | (low) = (u32)_l; \ |
| 219 | (high) = (u32)(_l >> 32); \ |
| 220 | } while (0) |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 221 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 222 | #define rdtscp(low, high, aux) \ |
| 223 | do { \ |
| 224 | unsigned long long _val = native_read_tscp(&(aux)); \ |
| 225 | (low) = (u32)_val; \ |
| 226 | (high) = (u32)(_val >> 32); \ |
| 227 | } while (0) |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 228 | |
| 229 | #define rdtscpll(val, aux) (val) = native_read_tscp(&(aux)) |
| 230 | |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 231 | #endif /* !CONFIG_PARAVIRT */ |
| 232 | |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 233 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 234 | #define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \ |
| 235 | (u32)((val) >> 32)) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 236 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 237 | #define write_tsc(val1, val2) wrmsr(0x10, (val1), (val2)) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 238 | |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 239 | #define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 240 | |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 241 | #ifdef CONFIG_SMP |
H. Peter Anvin | c6f3193 | 2008-08-25 17:27:21 -0700 | [diff] [blame] | 242 | int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); |
| 243 | int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); |
Borislav Petkov | b034c19 | 2009-05-22 13:52:19 +0200 | [diff] [blame] | 244 | void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs); |
| 245 | void wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs); |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 246 | int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); |
| 247 | int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); |
| 248 | #else /* CONFIG_SMP */ |
H. Peter Anvin | c6f3193 | 2008-08-25 17:27:21 -0700 | [diff] [blame] | 249 | static inline int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 250 | { |
| 251 | rdmsr(msr_no, *l, *h); |
H. Peter Anvin | c6f3193 | 2008-08-25 17:27:21 -0700 | [diff] [blame] | 252 | return 0; |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 253 | } |
H. Peter Anvin | c6f3193 | 2008-08-25 17:27:21 -0700 | [diff] [blame] | 254 | static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 255 | { |
| 256 | wrmsr(msr_no, l, h); |
H. Peter Anvin | c6f3193 | 2008-08-25 17:27:21 -0700 | [diff] [blame] | 257 | return 0; |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 258 | } |
Borislav Petkov | b034c19 | 2009-05-22 13:52:19 +0200 | [diff] [blame] | 259 | static inline void rdmsr_on_cpus(const cpumask_t *m, u32 msr_no, |
| 260 | struct msr *msrs) |
| 261 | { |
| 262 | rdmsr_on_cpu(0, msr_no, &(msrs[0].l), &(msrs[0].h)); |
| 263 | } |
| 264 | static inline void wrmsr_on_cpus(const cpumask_t *m, u32 msr_no, |
| 265 | struct msr *msrs) |
| 266 | { |
| 267 | wrmsr_on_cpu(0, msr_no, msrs[0].l, msrs[0].h); |
| 268 | } |
Joe Perches | abb0ade | 2008-03-23 01:02:51 -0700 | [diff] [blame] | 269 | static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, |
| 270 | u32 *l, u32 *h) |
Thomas Gleixner | be7baf8 | 2007-10-23 22:37:24 +0200 | [diff] [blame] | 271 | { |
| 272 | return rdmsr_safe(msr_no, l, h); |
| 273 | } |
| 274 | static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) |
| 275 | { |
| 276 | return wrmsr_safe(msr_no, l, h); |
| 277 | } |
| 278 | #endif /* CONFIG_SMP */ |
Glauber de Oliveira Costa | 751de83 | 2008-01-30 13:31:03 +0100 | [diff] [blame] | 279 | #endif /* __ASSEMBLY__ */ |
Glauber de Oliveira Costa | c210d24 | 2008-01-30 13:31:07 +0100 | [diff] [blame] | 280 | #endif /* __KERNEL__ */ |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 281 | #endif /* _ASM_X86_MSR_H */ |