kvm: x86: vmx: NULL out hwapic_isr_update() in case of !enable_apicv
authorTiejun Chen <tiejun.chen@intel.com>
Mon, 22 Dec 2014 09:32:57 +0000 (10:32 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 8 Jan 2015 21:45:17 +0000 (22:45 +0100)
commitb4eef9b36db461ca44832226fbca614db58c0c33
tree96f368602bfa48db933c14ea1f611ce9fa02cd78
parent5ff22e7ebf2e75e6300ad968a6e529b5e70877f1
kvm: x86: vmx: NULL out hwapic_isr_update() in case of !enable_apicv

In most cases calling hwapic_isr_update(), we always check if
kvm_apic_vid_enabled() == 1, but actually,
kvm_apic_vid_enabled()
    -> kvm_x86_ops->vm_has_apicv()
        -> vmx_vm_has_apicv() or '0' in svm case
            -> return enable_apicv && irqchip_in_kernel(kvm)

So its a little cost to recall vmx_vm_has_apicv() inside
hwapic_isr_update(), here just NULL out hwapic_isr_update() in
case of !enable_apicv inside hardware_setup() then make all
related stuffs follow this. Note we don't check this under that
condition of irqchip_in_kernel() since we should make sure
definitely any caller don't work  without in-kernel irqchip.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/vmx.c