diff mbox series

[v2,2/2] x86/kvm/hyper-v: recommend using eVMCS only when it is enabled

Message ID 20190125111934.28782-3-vkuznets@redhat.com (mailing list archive)
State New, archived
Headers show
Series tweak HYPERV_CPUID_ENLIGHTMENT_INFO | expand

Commit Message

Vitaly Kuznetsov Jan. 25, 2019, 11:19 a.m. UTC
We shouldn't probably be suggesting using Enlightened VMCS when it's not
enabled (not supported from guest's point of view). Hyper-V on KVM seems
to be fine either way but let's be consistent.

Reviewed-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/kvm/hyperv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Vitaly Kuznetsov Jan. 25, 2019, 11:43 a.m. UTC | #1
Vitaly Kuznetsov <vkuznets@redhat.com> writes:

> We shouldn't probably be suggesting using Enlightened VMCS when it's not
> enabled (not supported from guest's point of view). Hyper-V on KVM seems
> to be fine either way but let's be consistent.
>

Fixes: 2bc39970e932 ("x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID")

is missing here. Hope it can be added upon commit.

> Reviewed-by: Liran Alon <liran.alon@oracle.com>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  arch/x86/kvm/hyperv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
> index 4840f5b3c88f..4730fcaa70cf 100644
> --- a/arch/x86/kvm/hyperv.c
> +++ b/arch/x86/kvm/hyperv.c
> @@ -1850,7 +1850,8 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,
>  			ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED;
>  			ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED;
>  			ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED;
> -			ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED;
> +			if (evmcs_ver)
> +				ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED;
>  
>  			/*
>  			 * Default number of spinlock retry attempts, matches
Paolo Bonzini Jan. 25, 2019, 6:11 p.m. UTC | #2
On 25/01/19 12:43, Vitaly Kuznetsov wrote:
> Fixes: 2bc39970e932 ("x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID")

Added, thanks.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 4840f5b3c88f..4730fcaa70cf 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -1850,7 +1850,8 @@  int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,
 			ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED;
 			ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED;
 			ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED;
-			ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED;
+			if (evmcs_ver)
+				ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED;
 
 			/*
 			 * Default number of spinlock retry attempts, matches