diff options
Diffstat (limited to 'arch/x86/kernel/kvm.c')
| -rw-r--r-- | arch/x86/kernel/kvm.c | 51 | 
1 files changed, 38 insertions, 13 deletions
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 4ab377c9fffe..e820568ed4d5 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -311,7 +311,7 @@ static void kvm_guest_cpu_init(void)  	if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF) && kvmapf) {  		u64 pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason)); -#ifdef CONFIG_PREEMPT +#ifdef CONFIG_PREEMPTION  		pa |= KVM_ASYNC_PF_SEND_ALWAYS;  #endif  		pa |= KVM_ASYNC_PF_ENABLED; @@ -502,16 +502,6 @@ static void kvm_send_ipi_mask_allbutself(const struct cpumask *mask, int vector)  	__send_ipi_mask(local_mask, vector);  } -static void kvm_send_ipi_allbutself(int vector) -{ -	kvm_send_ipi_mask_allbutself(cpu_online_mask, vector); -} - -static void kvm_send_ipi_all(int vector) -{ -	__send_ipi_mask(cpu_online_mask, vector); -} -  /*   * Set the IPI entry points   */ @@ -519,8 +509,6 @@ static void kvm_setup_pv_ipi(void)  {  	apic->send_IPI_mask = kvm_send_ipi_mask;  	apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself; -	apic->send_IPI_allbutself = kvm_send_ipi_allbutself; -	apic->send_IPI_all = kvm_send_ipi_all;  	pr_info("KVM setup pv IPIs\n");  } @@ -705,6 +693,7 @@ unsigned int kvm_arch_para_hints(void)  {  	return cpuid_edx(kvm_cpuid_base() | KVM_CPUID_FEATURES);  } +EXPORT_SYMBOL_GPL(kvm_arch_para_hints);  static uint32_t __init kvm_detect(void)  { @@ -867,3 +856,39 @@ void __init kvm_spinlock_init(void)  }  #endif	/* CONFIG_PARAVIRT_SPINLOCKS */ + +#ifdef CONFIG_ARCH_CPUIDLE_HALTPOLL + +static void kvm_disable_host_haltpoll(void *i) +{ +	wrmsrl(MSR_KVM_POLL_CONTROL, 0); +} + +static void kvm_enable_host_haltpoll(void *i) +{ +	wrmsrl(MSR_KVM_POLL_CONTROL, 1); +} + +void arch_haltpoll_enable(unsigned int cpu) +{ +	if (!kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) { +		pr_err_once("kvm: host does not support poll control\n"); +		pr_err_once("kvm: host upgrade recommended\n"); +		return; +	} + +	/* Enable guest halt poll disables host halt poll */ +	smp_call_function_single(cpu, kvm_disable_host_haltpoll, NULL, 1); +} +EXPORT_SYMBOL_GPL(arch_haltpoll_enable); + +void arch_haltpoll_disable(unsigned int cpu) +{ +	if (!kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) +		return; + +	/* Enable guest halt poll disables host halt poll */ +	smp_call_function_single(cpu, kvm_enable_host_haltpoll, NULL, 1); +} +EXPORT_SYMBOL_GPL(arch_haltpoll_disable); +#endif  |