diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-03-25 04:44:50 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-11 07:57:05 -0400 |
commit | 857e40999e35906baa367a79137019912cfb5434 (patch) | |
tree | eacae3e4ccffd38b3e6a55b9bc6afdc7ae2c5e9a /arch/x86/kvm/vmx.c | |
parent | 4051b18801f5b47bb0369feefdc80e57819d0ddf (diff) |
KVM: X86: Delegate tsc-offset calculation to architecture code
With TSC scaling in SVM the tsc-offset needs to be
calculated differently. This patch propagates this
calculation into the architecture specific modules so that
this complexity can be handled there.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e19c7a5473d5..aabe3334d064 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1184,6 +1184,11 @@ static void vmx_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment) | |||
1184 | vmcs_write64(TSC_OFFSET, offset + adjustment); | 1184 | vmcs_write64(TSC_OFFSET, offset + adjustment); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | static u64 vmx_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc) | ||
1188 | { | ||
1189 | return target_tsc - native_read_tsc(); | ||
1190 | } | ||
1191 | |||
1187 | /* | 1192 | /* |
1188 | * Reads an msr value (of 'msr_index') into 'pdata'. | 1193 | * Reads an msr value (of 'msr_index') into 'pdata'. |
1189 | * Returns 0 on success, non-0 otherwise. | 1194 | * Returns 0 on success, non-0 otherwise. |
@@ -4510,6 +4515,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
4510 | .set_tsc_khz = vmx_set_tsc_khz, | 4515 | .set_tsc_khz = vmx_set_tsc_khz, |
4511 | .write_tsc_offset = vmx_write_tsc_offset, | 4516 | .write_tsc_offset = vmx_write_tsc_offset, |
4512 | .adjust_tsc_offset = vmx_adjust_tsc_offset, | 4517 | .adjust_tsc_offset = vmx_adjust_tsc_offset, |
4518 | .compute_tsc_offset = vmx_compute_tsc_offset, | ||
4513 | 4519 | ||
4514 | .set_tdp_cr3 = vmx_set_cr3, | 4520 | .set_tdp_cr3 = vmx_set_cr3, |
4515 | 4521 | ||