# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196960597 0
# Node ID 485e163385c4f261e71e99467c377d6b6732b4f3
# Parent 3c61b65b87c7e774401c1a0015d931b20fdedfef
hvm: Fix 2 type mismatches in vlapic.h and hpet.c for 32-bit build Xen
For 32-bit build of Xen:
1) the first mismatch (in hpet_read(), length is 4) makes guest think
the HPET DM is buggy (we return 0 for HPET_CFG.COUNTER_CLK_PERIOD to
guest), so guest wouldn't use HPET at all.
2) the second one: if tmict is 62500000 and timer_divisor is 16
(Fedoar7's installer uses the values at some time), 10 * 62500000 * 16
= 0x2540BE400 -- it's too big to be held in uint32_t.
Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
xen-unstable changeset: 16486:c00f31f27de6eb69b4d79f7aa330b1e4aba6f45f
xen-unstable date: Wed Nov 28 13:13:51 2007 +0000
---
xen/arch/x86/hvm/hpet.c | 2 +-
xen/arch/x86/hvm/vlapic.c | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff -r 3c61b65b87c7 -r 485e163385c4 xen/arch/x86/hvm/hpet.c
--- a/xen/arch/x86/hvm/hpet.c Thu Dec 06 17:02:47 2007 +0000
+++ b/xen/arch/x86/hvm/hpet.c Thu Dec 06 17:03:17 2007 +0000
@@ -145,7 +145,7 @@ static unsigned long hpet_read(
result = val;
if ( length != 8 )
- result = (val >> ((addr & 7) * 8)) & ((1UL << (length * 8)) - 1);
+ result = (val >> ((addr & 7) * 8)) & ((1ULL << (length * 8)) - 1);
spin_unlock(&h->lock);
diff -r 3c61b65b87c7 -r 485e163385c4 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Thu Dec 06 17:02:47 2007 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Thu Dec 06 17:03:17 2007 +0000
@@ -654,7 +654,8 @@ static void vlapic_write(struct vcpu *v,
case APIC_TMICT:
{
- uint64_t period = APIC_BUS_CYCLE_NS * (uint32_t)val *
vlapic->hw.timer_divisor;
+ uint64_t period = (uint64_t)APIC_BUS_CYCLE_NS *
+ (uint32_t)val * vlapic->hw.timer_divisor;
vlapic_set_reg(vlapic, APIC_TMICT, val);
create_periodic_time(current, &vlapic->pt, period, vlapic->pt.irq,
@@ -811,8 +812,10 @@ static void lapic_rearm(struct vlapic *s
unsigned long tmict;
tmict = vlapic_get_reg(s, APIC_TMICT);
- if (tmict > 0) {
- uint64_t period = APIC_BUS_CYCLE_NS * (uint32_t)tmict *
s->hw.timer_divisor;
+ if ( tmict > 0 )
+ {
+ uint64_t period = (uint64_t)APIC_BUS_CYCLE_NS *
+ (uint32_t)tmict * s->hw.timer_divisor;
uint32_t lvtt = vlapic_get_reg(s, APIC_LVTT);
s->pt.irq = lvtt & APIC_VECTOR_MASK;
@@ -820,9 +823,9 @@ static void lapic_rearm(struct vlapic *s
!vlapic_lvtt_period(s), NULL, s);
printk("lapic_load to rearm the actimer:"
- "bus cycle is %uns, "
- "saved tmict count %lu, period %"PRIu64"ns,
irq=%"PRIu8"\n",
- APIC_BUS_CYCLE_NS, tmict, period, s->pt.irq);
+ "bus cycle is %uns, "
+ "saved tmict count %lu, period %"PRIu64"ns, irq=%"PRIu8"\n",
+ APIC_BUS_CYCLE_NS, tmict, period, s->pt.irq);
}
lapic_info(s);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|