56 lines
2.0 KiB
Diff
56 lines
2.0 KiB
Diff
|
# HG changeset patch
|
||
|
# User David Vrabel <david.vrabel@citrix.com>
|
||
|
# Date 1334159385 -3600
|
||
|
# Node ID a95fc7decc831a01ed43c307c52287b32e7f4832
|
||
|
# Parent d196634484a9f86136704f973293925445961079
|
||
|
x86: fix delta calculation in TSC deadline timer emulation
|
||
|
|
||
|
In the virtual LAPIC, correct the delta calculation when emulating the
|
||
|
TSC deadline timer.
|
||
|
|
||
|
Without this fix, XenServer (which is based on Xen 4.1) does not work
|
||
|
when running as an HVM guest. dom0 fails to boot because its timer
|
||
|
interrupts are very delayed (by several minutes in some cases).
|
||
|
|
||
|
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
|
||
|
Acked-by: Jan Beulich <jbeulich@suse.com>
|
||
|
Committed-by: Keir Fraser <keir@xen.org>
|
||
|
|
||
|
--- a/xen/arch/x86/hvm/vlapic.c
|
||
|
+++ b/xen/arch/x86/hvm/vlapic.c
|
||
|
@@ -889,7 +889,6 @@ uint64_t vlapic_tdt_msr_get(struct vlap
|
||
|
void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
|
||
|
{
|
||
|
uint64_t guest_tsc;
|
||
|
- uint64_t guest_time;
|
||
|
struct vcpu *v = vlapic_vcpu(vlapic);
|
||
|
|
||
|
/* may need to exclude some other conditions like vlapic->hw.disabled */
|
||
|
@@ -901,12 +900,10 @@ void vlapic_tdt_msr_set(struct vlapic *v
|
||
|
|
||
|
/* new_value = 0, >0 && <= now, > now */
|
||
|
guest_tsc = hvm_get_guest_tsc(v);
|
||
|
- guest_time = hvm_get_guest_time(v);
|
||
|
if ( value > guest_tsc )
|
||
|
{
|
||
|
- uint64_t delta = value - v->arch.hvm_vcpu.cache_tsc_offset;
|
||
|
- delta = gtsc_to_gtime(v->domain, delta);
|
||
|
- delta = max_t(s64, delta - guest_time, 0);
|
||
|
+ uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
|
||
|
+ delta = max_t(s64, delta, 0);
|
||
|
|
||
|
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
|
||
|
|
||
|
@@ -940,9 +937,8 @@ void vlapic_tdt_msr_set(struct vlapic *v
|
||
|
|
||
|
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
|
||
|
"tdt_msr[0x%016"PRIx64"],"
|
||
|
- " gtsc[0x%016"PRIx64"],"
|
||
|
- " gtime[0x%016"PRIx64"]",
|
||
|
- vlapic->hw.tdt_msr, guest_tsc, guest_time);
|
||
|
+ " gtsc[0x%016"PRIx64"]",
|
||
|
+ vlapic->hw.tdt_msr, guest_tsc);
|
||
|
}
|
||
|
|
||
|
static int __vlapic_accept_pic_intr(struct vcpu *v)
|