KVM: LAPIC: introduce kvm_get_lapic_target_expiration_tsc()
authorWanpeng Li <wanpeng.li@hotmail.com>
Mon, 24 Oct 2016 10:23:11 +0000 (18:23 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 2 Nov 2016 20:32:17 +0000 (21:32 +0100)
Introdce kvm_get_lapic_target_expiration_tsc() to get APIC Timer target
deadline tsc.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/x86.c

index dce6c0bf2a21a2a07be92cc33c5a2cfa543e83ca..531fc28e5de475fc9086f9d82705c5f54f05edd0 100644 (file)
@@ -1706,6 +1706,15 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu)
  * LAPIC interface
  *----------------------------------------------------------------------
  */
+u64 kvm_get_lapic_target_expiration_tsc(struct kvm_vcpu *vcpu)
+{
+       struct kvm_lapic *apic = vcpu->arch.apic;
+
+       if (!lapic_in_kernel(vcpu))
+               return 0;
+
+       return apic->lapic_timer.tscdeadline;
+}
 
 u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu)
 {
index f60d01c29d5107a49b37713addffed27c30097be..031db2631a1a80142335a3d8bd4a6f6a01a2a248 100644 (file)
@@ -85,6 +85,7 @@ int kvm_apic_get_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s);
 int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s);
 int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu);
 
+u64 kvm_get_lapic_target_expiration_tsc(struct kvm_vcpu *vcpu);
 u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu);
 void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data);
 
index 7e30c720d0c59f573798855b00e5c998c90866a5..83990ad3710e38f94ccbdaf959dd74effa782b6a 100644 (file)
@@ -2794,7 +2794,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
                }
                if (kvm_lapic_hv_timer_in_use(vcpu) &&
                                kvm_x86_ops->set_hv_timer(vcpu,
-                                       kvm_get_lapic_tscdeadline_msr(vcpu)))
+                                       kvm_get_lapic_target_expiration_tsc(vcpu)))
                        kvm_lapic_switch_to_sw_timer(vcpu);
                /*
                 * On a host with synchronized TSC, there is no need to update