Paolo Bonzini ea26e4ec08 KVM: x86: drop TSC offsetting kvm_x86_ops to fix KVM_GET/SET_CLOCK
Since commit a545ab6a0085 ("kvm: x86: add tsc_offset field to struct
kvm_vcpu_arch", 2016-09-07) the offset between host and L1 TSC is
cached and need not be fished out of the VMCS or VMCB.  This means
that we can implement adjust_tsc_offset_guest and read_l1_tsc
entirely in generic code.  The simplification is particularly
significant for VMX code, where vmx->nested.vmcs01_tsc_offset
was duplicating what is now in vcpu->arch.tsc_offset.  Therefore
the vmcs01_tsc_offset can be dropped completely.

More importantly, this fixes KVM_GET_CLOCK/KVM_SET_CLOCK
which, after commit 108b249c453d ("KVM: x86: introduce get_kvmclock_ns",
2016-09-01) called read_l1_tsc while the VMCS was not loaded.
It thus returned bogus values on Intel CPUs.

Fixes: 108b249c453dd7132599ab6dc7e435a7036c193f
Reported-by: Roman Kagan <rkagan@virtuozzo.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-02 20:03:07 +01:00
..
2016-07-25 13:41:01 +02:00
2016-07-27 11:35:37 -07:00
2014-12-11 11:35:02 +01:00
2015-05-28 15:31:53 +02:00
2012-03-28 18:11:12 +01:00
2016-01-20 11:39:14 +01:00
2014-03-04 21:47:51 +01:00
2015-10-21 11:17:32 +02:00
2015-04-24 15:36:55 +02:00
2015-09-08 14:35:59 -07:00
2012-06-25 13:48:30 +02:00
2016-08-18 18:41:27 +02:00
2016-01-12 12:17:28 +01:00
2015-07-31 13:31:10 +02:00
2016-09-09 13:02:27 +02:00
2014-02-27 08:07:39 -08:00
2015-12-19 11:53:40 +01:00
2016-09-22 12:14:29 -04:00
2014-09-01 10:15:31 +02:00
2016-09-05 11:47:31 +02:00
2016-09-20 09:26:15 +02:00
2015-05-19 15:47:30 +02:00
2016-01-30 11:22:17 +01:00
2016-09-05 11:47:31 +02:00
2016-06-16 00:04:31 +02:00
2015-07-31 13:31:10 +02:00
2016-06-16 00:04:31 +02:00
2016-07-23 11:04:23 -07:00
2015-05-19 15:47:30 +02:00