WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] vlapic.c - TDCR

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] vlapic.c - TDCR
From: Ben Thomas <bthomas@xxxxxxxxxxxxxxx>
Date: Thu, 09 Nov 2006 12:04:03 -0500
Delivery-date: Thu, 09 Nov 2006 09:04:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501)
Clean up two small APIC TDCR issues.  First, only save the bits that
can be set, so that a subsequent read can't see MBZ bits as set.
Next, be sure to initialize the timer_divide_count, which is derived
from the TDCR.  This avoids a potential divide-by-zero elsewhere in the
code.  Technically, the timer_divide_count initialization should be done
from the value of the TDCR, but it's in the init routine and the
registers were all just zeroed by the caller of the init routine.


Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx)
--
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
bthomas@xxxxxxxxxxxxxxx                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851
# Clean up two small APIC TDCR issues.  First, only save the bits that
# can be set, so that on a subsequent read can't see MBZ bits as set.
# Next, be sure to initialize the timer_divide_count, which is derived
# from the TDCR.  This avoids a potential divide-by-zero elsewhere in the
# code.  Technically, the timer_divide_count initialization should be done
# from the value of the TDCR, but it's in the init routine and the
# registers were all just zeroed.
#
# Signed-off-by: Ben Thomas (ben@xxxxxxxxxxxxxxx)

Index: xen-unstable.hg/xen/arch/x86/hvm/vlapic.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/x86/hvm/vlapic.c      2006-11-08 
17:06:11.000000000 -0500
+++ xen-unstable.hg/xen/arch/x86/hvm/vlapic.c   2006-11-08 17:07:55.000000000 
-0500
@@ -779,11 +779,11 @@
     {
         unsigned int tmp1, tmp2;
 
-        tmp1 = val & 0xf;
+        tmp1 = val & 0xb;              /* Only bits 0,1,3 are settable */
         tmp2 = ((tmp1 & 0x3) | ((tmp1 & 0x8) >> 1)) + 1;
         vlapic->timer_divide_count = 0x1 << (tmp2 & 0x7);
 
-        vlapic_set_reg(vlapic, APIC_TDCR, val);
+        vlapic_set_reg(vlapic, APIC_TDCR, tmp1);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "timer divide count is 0x%x",
                     vlapic->timer_divide_count);
@@ -966,6 +966,7 @@
     vlapic->apic_base_msr = MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
 
     vlapic->flush_tpr_threshold = 0;
+    vlapic->timer_divide_count = 2;    /* TDCR of 0, means divide by 2 */
 
     vlapic->base_address = vlapic->apic_base_msr &
                            MSR_IA32_APICBASE_BASE;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] vlapic.c - TDCR, Ben Thomas <=