aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-26 06:57:04 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 11:01:20 -0500
commit774ead3ad9bcbc05ef6aaebb9bdf8b4c3126923b (patch)
tree0395ee65292f99bd43ab2cd07beb554d99cb096f
parentb93463aa59d67b21b4921e30bd5c5dcc7c35ffbd (diff)
KVM: Disable vapic support on Intel machines with FlexPriority
FlexPriority accelerates the tpr without any patching. Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--arch/x86/kvm/svm.c6
-rw-r--r--arch/x86/kvm/vmx.c3
-rw-r--r--arch/x86/kvm/x86.c4
-rw-r--r--include/asm-x86/kvm_host.h1
4 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 3d4b71a94440..33f77b044c52 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1653,6 +1653,11 @@ static void svm_check_processor_compat(void *rtn)
1653 *(int *)rtn = 0; 1653 *(int *)rtn = 0;
1654} 1654}
1655 1655
1656static bool svm_cpu_has_accelerated_tpr(void)
1657{
1658 return false;
1659}
1660
1656static struct kvm_x86_ops svm_x86_ops = { 1661static struct kvm_x86_ops svm_x86_ops = {
1657 .cpu_has_kvm_support = has_svm, 1662 .cpu_has_kvm_support = has_svm,
1658 .disabled_by_bios = is_disabled, 1663 .disabled_by_bios = is_disabled,
@@ -1661,6 +1666,7 @@ static struct kvm_x86_ops svm_x86_ops = {
1661 .check_processor_compatibility = svm_check_processor_compat, 1666 .check_processor_compatibility = svm_check_processor_compat,
1662 .hardware_enable = svm_hardware_enable, 1667 .hardware_enable = svm_hardware_enable,
1663 .hardware_disable = svm_hardware_disable, 1668 .hardware_disable = svm_hardware_disable,
1669 .cpu_has_accelerated_tpr = svm_cpu_has_accelerated_tpr,
1664 1670
1665 .vcpu_create = svm_create_vcpu, 1671 .vcpu_create = svm_create_vcpu,
1666 .vcpu_free = svm_free_vcpu, 1672 .vcpu_free = svm_free_vcpu,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index fc494aff5d8b..d1167fc303d6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -192,7 +192,7 @@ static inline int cpu_has_secondary_exec_ctrls(void)
192 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS); 192 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS);
193} 193}
194 194
195static inline int cpu_has_vmx_virtualize_apic_accesses(void) 195static inline bool cpu_has_vmx_virtualize_apic_accesses(void)
196{ 196{
197 return (vmcs_config.cpu_based_2nd_exec_ctrl & 197 return (vmcs_config.cpu_based_2nd_exec_ctrl &
198 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); 198 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES);
@@ -2565,6 +2565,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
2565 .check_processor_compatibility = vmx_check_processor_compat, 2565 .check_processor_compatibility = vmx_check_processor_compat,
2566 .hardware_enable = hardware_enable, 2566 .hardware_enable = hardware_enable,
2567 .hardware_disable = hardware_disable, 2567 .hardware_disable = hardware_disable,
2568 .cpu_has_accelerated_tpr = cpu_has_vmx_virtualize_apic_accesses,
2568 2569
2569 .vcpu_create = vmx_create_vcpu, 2570 .vcpu_create = vmx_create_vcpu,
2570 .vcpu_free = vmx_free_vcpu, 2571 .vcpu_free = vmx_free_vcpu,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e7eac27adb7f..1f48ec871035 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -684,9 +684,11 @@ int kvm_dev_ioctl_check_extension(long ext)
684 case KVM_CAP_USER_MEMORY: 684 case KVM_CAP_USER_MEMORY:
685 case KVM_CAP_SET_TSS_ADDR: 685 case KVM_CAP_SET_TSS_ADDR:
686 case KVM_CAP_EXT_CPUID: 686 case KVM_CAP_EXT_CPUID:
687 case KVM_CAP_VAPIC:
688 r = 1; 687 r = 1;
689 break; 688 break;
689 case KVM_CAP_VAPIC:
690 r = !kvm_x86_ops->cpu_has_accelerated_tpr();
691 break;
690 default: 692 default:
691 r = 0; 693 r = 0;
692 break; 694 break;
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 6e649af08d19..44b89259f6c4 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -329,6 +329,7 @@ struct kvm_x86_ops {
329 void (*check_processor_compatibility)(void *rtn); 329 void (*check_processor_compatibility)(void *rtn);
330 int (*hardware_setup)(void); /* __init */ 330 int (*hardware_setup)(void); /* __init */
331 void (*hardware_unsetup)(void); /* __exit */ 331 void (*hardware_unsetup)(void); /* __exit */
332 bool (*cpu_has_accelerated_tpr)(void);
332 333
333 /* Create, but do not attach this VCPU */ 334 /* Create, but do not attach this VCPU */
334 struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id); 335 struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id);