Record the host tscd value.

Signed-off-by: Zhimin Feng <fengzhi...@bytedance.com>
---
 arch/x86/kvm/vmx/vmx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index a12da3cef86d..98eca70d4251 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -251,8 +251,11 @@ static void vmx_host_timer_passth_init(void *junk)
 {
        struct timer_passth_info *local_timer_info;
        int cpu = smp_processor_id();
+       u64 tscd;
 
        local_timer_info = &per_cpu(passth_info, cpu);
+       rdmsrl(MSR_IA32_TSC_DEADLINE, tscd);
+       local_timer_info->host_tscd = tscd;
        local_timer_info->curr_dev = per_cpu(tick_cpu_device, cpu).evtdev;
        local_timer_info->orig_set_next_event =
                local_timer_info->curr_dev->set_next_event;
@@ -266,6 +269,7 @@ static void vmx_host_timer_restore(void *junk)
        local_timer_info = &per_cpu(passth_info, smp_processor_id());
        local_timer_info->curr_dev->set_next_event =
                local_timer_info->orig_set_next_event;
+       local_timer_info->host_tscd = 0;
 }
 
 #define L1D_CACHE_ORDER 4
-- 
2.11.0

Reply via email to