diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-05-15 10:43:18 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-05-15 10:43:18 +0100 |
commit | f1bd686887205e44fe33fa9b5130d79e90bfcb91 (patch) | |
tree | 59738c2059242d88c8c2cd0b740eee95b70bee64 /xen/include/asm-x86/msr.h | |
parent | 71adf3c9eb195fd0c9105781df8a1290f4d87154 (diff) | |
download | xen-f1bd686887205e44fe33fa9b5130d79e90bfcb91.tar.gz xen-f1bd686887205e44fe33fa9b5130d79e90bfcb91.tar.bz2 xen-f1bd686887205e44fe33fa9b5130d79e90bfcb91.zip |
x86: fix EFER handling
Introduce a per-CPU shadow of what is currently in EFER, as context
switch code must re-write this MSR so that all guests run with
appropriate EFER.SCE and EFER.NX settings. Remove EFER from the set of
MSRs that VMX deals with in a generic fashion.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/asm-x86/msr.h')
-rw-r--r-- | xen/include/asm-x86/msr.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h index bd7f27b6c5..d1ea050b68 100644 --- a/xen/include/asm-x86/msr.h +++ b/xen/include/asm-x86/msr.h @@ -3,6 +3,9 @@ #ifndef __ASSEMBLY__ +#include <xen/smp.h> +#include <xen/percpu.h> + #define rdmsr(msr,val1,val2) \ __asm__ __volatile__("rdmsr" \ : "=a" (val1), "=d" (val2) \ @@ -142,6 +145,25 @@ static inline void wrmsrl(unsigned int msr, __u64 val) #define EFER_NX (1<<_EFER_NX) #define EFER_SVME (1<<_EFER_SVME) +#ifndef __ASSEMBLY__ + +DECLARE_PER_CPU(__u64, efer); + +static inline __u64 read_efer(void) +{ + if (!this_cpu(efer)) + rdmsrl(MSR_EFER, this_cpu(efer)); + return this_cpu(efer); +} + +static inline void write_efer(__u64 val) +{ + this_cpu(efer) = val; + wrmsrl(MSR_EFER, val); +} + +#endif + /* Intel MSRs. Some also available on other CPUs */ #define MSR_IA32_PLATFORM_ID 0x17 |