summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/irq.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-01-08 15:41:16 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-09 18:57:39 +0300
commit1e3161b4147caf2045ac4aae3d71fae6ac1a1d65 (patch)
tree06ab2411f3828f4d1b1fba89c593f987647a2e05 /arch/x86/kvm/irq.c
parentf8543d6a977a1bdb37eb13ad81ef2874526209b0 (diff)
downloadlinux-1e3161b4147caf2045ac4aae3d71fae6ac1a1d65.tar.xz
KVM: x86: consolidate "has lapic" checks into irq.c
Do for kvm_cpu_has_pending_timer and kvm_inject_pending_timer_irqs what the other irq.c routines have been doing. Reviewed-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/irq.c')
-rw-r--r--arch/x86/kvm/irq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 3982b479bb5f..95fcc7b13866 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -33,7 +33,10 @@
*/
int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
{
- return apic_has_pending_timer(vcpu);
+ if (lapic_in_kernel(vcpu))
+ return apic_has_pending_timer(vcpu);
+
+ return 0;
}
EXPORT_SYMBOL(kvm_cpu_has_pending_timer);
@@ -137,8 +140,8 @@ EXPORT_SYMBOL_GPL(kvm_cpu_get_interrupt);
void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
{
- kvm_inject_apic_timer_irqs(vcpu);
- /* TODO: PIT, RTC etc. */
+ if (lapic_in_kernel(vcpu))
+ kvm_inject_apic_timer_irqs(vcpu);
}
EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);