diff options
author | Sheng Yang <sheng.yang@intel.com> | 2008-09-10 06:53:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-10 08:00:56 -0400 |
commit | e38e05a85828dac23540cd007df5f20985388afc (patch) | |
tree | 63bd7a87dc991772af73cf3e406166e79e8fcb63 /arch | |
parent | 315a6558f30a264c88274fa70626615d1c7851c7 (diff) |
x86: extended "flags" to show virtualization HW feature in /proc/cpuinfo
The hardware virtualization technology evolves very fast. But currently
it's hard to tell if your CPU support a certain kind of HW technology
without digging into the source code.
The patch add a new catagory in "flags" under /proc/cpuinfo. Now "flags"
can indicate the (important) HW virtulization features the CPU supported
as well.
Current implementation just cover Intel VMX side.
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/intel.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 5f76bf139fda..99468dbd08da 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -196,6 +196,44 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c) | |||
196 | return 1; | 196 | return 1; |
197 | } | 197 | } |
198 | 198 | ||
199 | static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) | ||
200 | { | ||
201 | /* Intel VMX MSR indicated features */ | ||
202 | #define X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW 0x00200000 | ||
203 | #define X86_VMX_FEATURE_PROC_CTLS_VNMI 0x00400000 | ||
204 | #define X86_VMX_FEATURE_PROC_CTLS_2ND_CTLS 0x80000000 | ||
205 | #define X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC 0x00000001 | ||
206 | #define X86_VMX_FEATURE_PROC_CTLS2_EPT 0x00000002 | ||
207 | #define X86_VMX_FEATURE_PROC_CTLS2_VPID 0x00000020 | ||
208 | |||
209 | u32 vmx_msr_low, vmx_msr_high, msr_ctl, msr_ctl2; | ||
210 | |||
211 | clear_cpu_cap(c, X86_FEATURE_TPR_SHADOW); | ||
212 | clear_cpu_cap(c, X86_FEATURE_VNMI); | ||
213 | clear_cpu_cap(c, X86_FEATURE_FLEXPRIORITY); | ||
214 | clear_cpu_cap(c, X86_FEATURE_EPT); | ||
215 | clear_cpu_cap(c, X86_FEATURE_VPID); | ||
216 | |||
217 | rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, vmx_msr_low, vmx_msr_high); | ||
218 | msr_ctl = vmx_msr_high | vmx_msr_low; | ||
219 | if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW) | ||
220 | set_cpu_cap(c, X86_FEATURE_TPR_SHADOW); | ||
221 | if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_VNMI) | ||
222 | set_cpu_cap(c, X86_FEATURE_VNMI); | ||
223 | if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_2ND_CTLS) { | ||
224 | rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, | ||
225 | vmx_msr_low, vmx_msr_high); | ||
226 | msr_ctl2 = vmx_msr_high | vmx_msr_low; | ||
227 | if ((msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC) && | ||
228 | (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW)) | ||
229 | set_cpu_cap(c, X86_FEATURE_FLEXPRIORITY); | ||
230 | if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT) | ||
231 | set_cpu_cap(c, X86_FEATURE_EPT); | ||
232 | if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VPID) | ||
233 | set_cpu_cap(c, X86_FEATURE_VPID); | ||
234 | } | ||
235 | } | ||
236 | |||
199 | static void __cpuinit init_intel(struct cpuinfo_x86 *c) | 237 | static void __cpuinit init_intel(struct cpuinfo_x86 *c) |
200 | { | 238 | { |
201 | unsigned int l2 = 0; | 239 | unsigned int l2 = 0; |
@@ -289,6 +327,9 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
289 | 327 | ||
290 | /* Work around errata */ | 328 | /* Work around errata */ |
291 | srat_detect_node(); | 329 | srat_detect_node(); |
330 | |||
331 | if (cpu_has(c, X86_FEATURE_VMX)) | ||
332 | detect_vmx_virtcap(c); | ||
292 | } | 333 | } |
293 | 334 | ||
294 | #ifdef CONFIG_X86_32 | 335 | #ifdef CONFIG_X86_32 |