aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386
diff options
context:
space:
mode:
authorRudolf Marek <r.marek@assembler.cz>2007-05-08 11:22:01 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-08 11:22:01 -0400
commit4e9baad8f5cb2040e802eff484fad7e721b21c0b (patch)
tree35bd0bdbc9185b0a21d56b32fbd78390a06b1b41 /include/asm-i386
parent9ca8e40c8414d25e880b587cbd4d130750c49588 (diff)
i386: Add safe variants of rdmsr_on_cpu and wrmsr_on_cpu
Add safe (exception handled) variants of rdmsr_on_cpu and wrmsr_on_cpu. You should use these when the target MSR may not actually exist, as doing so could trigger an exception which the regular functions do not handle. The safe variants are slower, though. The upcoming coretemp hardware monitoring driver will need this. Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Cc: Alexey Dobriyan <adobriyan@openvz.org> Cc: Dave Jones <davej@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include/asm-i386')
-rw-r--r--include/asm-i386/msr.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index 9559894c7658..26861df52cc4 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -77,7 +77,7 @@ static inline unsigned long long native_read_pmc(void)
77#ifdef CONFIG_PARAVIRT 77#ifdef CONFIG_PARAVIRT
78#include <asm/paravirt.h> 78#include <asm/paravirt.h>
79#else 79#else
80 80#include <linux/errno.h>
81/* 81/*
82 * Access to machine-specific registers (available on 586 and better only) 82 * Access to machine-specific registers (available on 586 and better only)
83 * Note: the rd* operations modify the parameters directly (without using 83 * Note: the rd* operations modify the parameters directly (without using
@@ -148,6 +148,8 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
148#ifdef CONFIG_SMP 148#ifdef CONFIG_SMP
149void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 149void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
150void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 150void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
151int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
152int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
151#else /* CONFIG_SMP */ 153#else /* CONFIG_SMP */
152static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) 154static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
153{ 155{
@@ -157,6 +159,14 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
157{ 159{
158 wrmsr(msr_no, l, h); 160 wrmsr(msr_no, l, h);
159} 161}
162static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
163{
164 return rdmsr_safe(msr_no, l, h);
165}
166static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
167{
168 return wrmsr_safe(msr_no, l, h);
169}
160#endif /* CONFIG_SMP */ 170#endif /* CONFIG_SMP */
161#endif 171#endif
162#endif 172#endif