diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-09-05 03:19:50 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-05 03:19:50 -0400 |
commit | 446d27338d3b422dd3dfe496d0f362230994d059 (patch) | |
tree | 3452a8c7c487675020b2a2137635bc7dfede57fe /include/asm-x86 | |
parent | accf0fa697eeb5ff4c2360edc4da5b10abac0b7b (diff) | |
parent | 0a488a53d7ca46ac638c30079072c57e50cfcc7b (diff) |
Merge branch 'x86/cpu' into x86/core
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/msr.h | 23 | ||||
-rw-r--r-- | include/asm-x86/paravirt.h | 12 | ||||
-rw-r--r-- | include/asm-x86/processor.h | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h index eee83f783f6d..530af1f6389e 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 ff9a7e4bc3f6..cba612c89e06 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 | ||
@@ -720,6 +721,10 @@ static inline u64 paravirt_read_msr(unsigned msr, int *err) | |||
720 | { | 721 | { |
721 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); | 722 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); |
722 | } | 723 | } |
724 | static inline u64 paravirt_read_msr_amd(unsigned msr, int *err) | ||
725 | { | ||
726 | return PVOP_CALL2(u64, pv_cpu_ops.read_msr_amd, msr, err); | ||
727 | } | ||
723 | static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) | 728 | static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) |
724 | { | 729 | { |
725 | return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); | 730 | return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); |
@@ -765,6 +770,13 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p) | |||
765 | *p = paravirt_read_msr(msr, &err); | 770 | *p = paravirt_read_msr(msr, &err); |
766 | return err; | 771 | return err; |
767 | } | 772 | } |
773 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) | ||
774 | { | ||
775 | int err; | ||
776 | |||
777 | *p = paravirt_read_msr_amd(msr, &err); | ||
778 | return err; | ||
779 | } | ||
768 | 780 | ||
769 | static inline u64 paravirt_read_tsc(void) | 781 | static inline u64 paravirt_read_tsc(void) |
770 | { | 782 | { |
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index df03c98e38d4..ae5bd1abe766 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
@@ -77,9 +77,9 @@ struct cpuinfo_x86 { | |||
77 | __u8 x86_phys_bits; | 77 | __u8 x86_phys_bits; |
78 | /* CPUID returned core id bits: */ | 78 | /* CPUID returned core id bits: */ |
79 | __u8 x86_coreid_bits; | 79 | __u8 x86_coreid_bits; |
80 | #endif | ||
80 | /* Max extended CPUID function supported: */ | 81 | /* Max extended CPUID function supported: */ |
81 | __u32 extended_cpuid_level; | 82 | __u32 extended_cpuid_level; |
82 | #endif | ||
83 | /* Maximum supported CPUID level, -1=no CPUID: */ | 83 | /* Maximum supported CPUID level, -1=no CPUID: */ |
84 | int cpuid_level; | 84 | int cpuid_level; |
85 | __u32 x86_capability[NCAPINTS]; | 85 | __u32 x86_capability[NCAPINTS]; |