diff options
Diffstat (limited to 'arch/x86/kvm/hyperv.c')
| -rw-r--r-- | arch/x86/kvm/hyperv.c | 16 | 
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index fff790a3f4ee..23ff65504d7e 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -23,6 +23,7 @@  #include "ioapic.h"  #include "hyperv.h" +#include <linux/cpu.h>  #include <linux/kvm_host.h>  #include <linux/highmem.h>  #include <linux/sched/cputime.h> @@ -645,7 +646,9 @@ static int stimer_notify_direct(struct kvm_vcpu_hv_stimer *stimer)  		.vector = stimer->config.apic_vector  	}; -	return !kvm_apic_set_irq(vcpu, &irq, NULL); +	if (lapic_in_kernel(vcpu)) +		return !kvm_apic_set_irq(vcpu, &irq, NULL); +	return 0;  }  static void stimer_expiration(struct kvm_vcpu_hv_stimer *stimer) @@ -1852,7 +1855,13 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,  			ent->edx |= HV_FEATURE_FREQUENCY_MSRS_AVAILABLE;  			ent->edx |= HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE; -			ent->edx |= HV_STIMER_DIRECT_MODE_AVAILABLE; + +			/* +			 * Direct Synthetic timers only make sense with in-kernel +			 * LAPIC +			 */ +			if (lapic_in_kernel(vcpu)) +				ent->edx |= HV_STIMER_DIRECT_MODE_AVAILABLE;  			break; @@ -1864,7 +1873,8 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,  			ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED;  			if (evmcs_ver)  				ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; - +			if (!cpu_smt_possible()) +				ent->eax |= HV_X64_NO_NONARCH_CORESHARING;  			/*  			 * Default number of spinlock retry attempts, matches  			 * HyperV 2016.  |