aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/vpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'xen/arch/x86/hvm/vpt.c')
-rw-r--r--xen/arch/x86/hvm/vpt.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 7056769ea3..52fb086876 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -56,7 +56,19 @@ u64 hvm_get_guest_time(struct vcpu *v)
void hvm_set_guest_time(struct vcpu *v, u64 guest_time)
{
- v->arch.hvm_vcpu.stime_offset += guest_time - hvm_get_guest_time(v);
+ u64 offset = guest_time - hvm_get_guest_time(v);
+
+ if ( offset )
+ {
+ v->arch.hvm_vcpu.stime_offset += offset;
+ /*
+ * If hvm_vcpu.stime_offset is updated make sure to
+ * also update vcpu time, since this value is used to
+ * calculate the TSC.
+ */
+ if ( v == current )
+ update_vcpu_system_time(v);
+ }
}
static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)