diff options
author | Wanpeng Li <wanpengli@tencent.com> | 2018-03-12 04:53:03 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-03-16 22:03:52 +0100 |
commit | caa057a2cad647fb368a12c8e6c410ac4c28e063 (patch) | |
tree | 704b511957703f1666b9735a516ec21c3e0865ae /arch/x86/kvm/cpuid.c | |
parent | 4d5422cea3b61f158d58924cbb43feada456ba5c (diff) | |
download | linux-caa057a2cad647fb368a12c8e6c410ac4c28e063.tar.bz2 |
KVM: X86: Provide a capability to disable HLT intercepts
If host CPUs are dedicated to a VM, we can avoid VM exits on HLT.
This patch adds the per-VM capability to disable them.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Jan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.c')
-rw-r--r-- | arch/x86/kvm/cpuid.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index e2d3050a4ac8..82055b90a8b3 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -135,6 +135,11 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) return -EINVAL; } + best = kvm_find_cpuid_entry(vcpu, KVM_CPUID_FEATURES, 0); + if (kvm_hlt_in_guest(vcpu->kvm) && best && + (best->eax & (1 << KVM_FEATURE_PV_UNHALT))) + best->eax &= ~(1 << KVM_FEATURE_PV_UNHALT); + /* Update physical-address width */ vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu); kvm_mmu_reset_context(vcpu); |