KVM/Hyper-V: Add new KVM capability KVM_CAP_HYPERV_DIRECT_TLBFLUSH
Hyper-V direct tlb flush function should be enabled for guest that only uses Hyper-V hypercall. User space hypervisor(e.g, Qemu) can disable KVM identification in CPUID and just exposes Hyper-V identification to make sure the precondition. Add new KVM capability KVM_CAP_ HYPERV_DIRECT_TLBFLUSH for user space to enable Hyper-V direct tlb function and this function is default to be disabled in KVM. Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:

committed by
Paolo Bonzini

parent
7a83247e01
commit
344c6c8047
@@ -3282,6 +3282,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
|
||||
r = kvm_x86_ops->get_nested_state ?
|
||||
kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
|
||||
break;
|
||||
case KVM_CAP_HYPERV_DIRECT_TLBFLUSH:
|
||||
r = kvm_x86_ops->enable_direct_tlbflush ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -4055,6 +4058,11 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
|
||||
r = -EFAULT;
|
||||
}
|
||||
return r;
|
||||
case KVM_CAP_HYPERV_DIRECT_TLBFLUSH:
|
||||
if (!kvm_x86_ops->enable_direct_tlbflush)
|
||||
return -ENOTTY;
|
||||
|
||||
return kvm_x86_ops->enable_direct_tlbflush(vcpu);
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
Reference in New Issue
Block a user