diff options
author | Avi Kivity <avi@redhat.com> | 2010-11-09 09:15:42 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:29:16 -0500 |
commit | 2a6b20b83d1d37db57a9c25d99dc78454ad0747b (patch) | |
tree | c7dc696ec4c0b8e6853bd9705dedb3fed26d7eca | |
parent | c4806acdcec020fe5bbb054ce9dc75aaecaf29dd (diff) |
KVM: SVM: Replace svm_has() by standard Linux cpuid accessors
Instead of querying cpuid directly, use the Linux accessors (boot_cpu_has,
etc.). This allows the things like the clearcpuid kernel command line to
work (when it's fixed wrt scattered cpuid bits).
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r-- | arch/x86/kvm/svm.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index cf47a2fc24e9..7c7f03b5f39a 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -271,11 +271,6 @@ static u32 svm_msrpm_offset(u32 msr) | |||
271 | 271 | ||
272 | #define MAX_INST_SIZE 15 | 272 | #define MAX_INST_SIZE 15 |
273 | 273 | ||
274 | static inline u32 svm_has(u32 feat) | ||
275 | { | ||
276 | return svm_features & feat; | ||
277 | } | ||
278 | |||
279 | static inline void clgi(void) | 274 | static inline void clgi(void) |
280 | { | 275 | { |
281 | asm volatile (__ex(SVM_CLGI)); | 276 | asm volatile (__ex(SVM_CLGI)); |
@@ -381,7 +376,7 @@ static void svm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr, | |||
381 | nested_svm_check_exception(svm, nr, has_error_code, error_code)) | 376 | nested_svm_check_exception(svm, nr, has_error_code, error_code)) |
382 | return; | 377 | return; |
383 | 378 | ||
384 | if (nr == BP_VECTOR && !svm_has(SVM_FEATURE_NRIP)) { | 379 | if (nr == BP_VECTOR && !static_cpu_has(X86_FEATURE_NRIPS)) { |
385 | unsigned long rip, old_rip = kvm_rip_read(&svm->vcpu); | 380 | unsigned long rip, old_rip = kvm_rip_read(&svm->vcpu); |
386 | 381 | ||
387 | /* | 382 | /* |
@@ -677,7 +672,7 @@ static __init int svm_hardware_setup(void) | |||
677 | 672 | ||
678 | svm_features = cpuid_edx(SVM_CPUID_FUNC); | 673 | svm_features = cpuid_edx(SVM_CPUID_FUNC); |
679 | 674 | ||
680 | if (!svm_has(SVM_FEATURE_NPT)) | 675 | if (!boot_cpu_has(X86_FEATURE_NPT)) |
681 | npt_enabled = false; | 676 | npt_enabled = false; |
682 | 677 | ||
683 | if (npt_enabled && !npt) { | 678 | if (npt_enabled && !npt) { |
@@ -876,7 +871,7 @@ static void init_vmcb(struct vcpu_svm *svm) | |||
876 | svm->nested.vmcb = 0; | 871 | svm->nested.vmcb = 0; |
877 | svm->vcpu.arch.hflags = 0; | 872 | svm->vcpu.arch.hflags = 0; |
878 | 873 | ||
879 | if (svm_has(SVM_FEATURE_PAUSE_FILTER)) { | 874 | if (boot_cpu_has(X86_FEATURE_PAUSEFILTER)) { |
880 | control->pause_filter_count = 3000; | 875 | control->pause_filter_count = 3000; |
881 | control->intercept |= (1ULL << INTERCEPT_PAUSE); | 876 | control->intercept |= (1ULL << INTERCEPT_PAUSE); |
882 | } | 877 | } |
@@ -2743,7 +2738,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data) | |||
2743 | svm->vmcb->save.sysenter_esp = data; | 2738 | svm->vmcb->save.sysenter_esp = data; |
2744 | break; | 2739 | break; |
2745 | case MSR_IA32_DEBUGCTLMSR: | 2740 | case MSR_IA32_DEBUGCTLMSR: |
2746 | if (!svm_has(SVM_FEATURE_LBRV)) { | 2741 | if (!boot_cpu_has(X86_FEATURE_LBRV)) { |
2747 | pr_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTL 0x%llx, nop\n", | 2742 | pr_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTL 0x%llx, nop\n", |
2748 | __func__, data); | 2743 | __func__, data); |
2749 | break; | 2744 | break; |
@@ -3533,7 +3528,7 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) | |||
3533 | additional features */ | 3528 | additional features */ |
3534 | 3529 | ||
3535 | /* Support next_rip if host supports it */ | 3530 | /* Support next_rip if host supports it */ |
3536 | if (svm_has(SVM_FEATURE_NRIP)) | 3531 | if (boot_cpu_has(X86_FEATURE_NRIPS)) |
3537 | entry->edx |= SVM_FEATURE_NRIP; | 3532 | entry->edx |= SVM_FEATURE_NRIP; |
3538 | 3533 | ||
3539 | /* Support NPT for the guest if enabled */ | 3534 | /* Support NPT for the guest if enabled */ |