i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID
commit6760bd20027188092a0618c96f4da17a073c19d3
authorVitaly Kuznetsov <vkuznets@redhat.com>
Fri, 17 May 2019 14:19:17 +0000 (17 16:19 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Jun 2019 00:29:38 +0000 (21 02:29 +0200)
tree6dba68d0b0ad427bce2b1de6bf1f373103cbfffc
parent2d384d7c836142a1ce851442bd6fb8e03a72663a
i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID

KVM now supports reporting supported Hyper-V features through CPUID
(KVM_GET_SUPPORTED_HV_CPUID ioctl). Going forward, this is going to be
the only way to announce new functionality and this has already happened
with Direct Mode stimers.

While we could just support KVM_GET_SUPPORTED_HV_CPUID for new features,
it seems to be beneficial to use it for all Hyper-V enlightenments when
possible. This way we can implement 'hv-all' pass-through mode giving the
guest all supported Hyper-V features even when QEMU knows nothing about
them.

Implementation-wise we create a new kvm_hyperv_properties structure
defining Hyper-V features, get_supported_hv_cpuid()/
get_supported_hv_cpuid_legacy() returning the supported CPUID set and
a bit over-engineered hv_cpuid_check_and_set() which we will also be
used to set cpu->hyperv_* properties for 'hv-all' mode.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20190517141924.19024-3-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/kvm.c