All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vmx-pit-reset.patch
@ 2005-05-25 18:27 Arun Sharma
  2005-05-25 21:20 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Arun Sharma @ 2005-05-25 18:27 UTC (permalink / raw)
  To: Ian Pratt, Keir Fraser; +Cc: xen-devel

A VMX guest can reprogram the same PIT channel twice. We should not create
two ac_timers to handle this case.

Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>

--- trunk/xen/arch/x86/vmx_intercept.c	(revision 1122)
+++ trunk/xen/arch/x86/vmx_intercept.c	(working copy)
@@ -217,6 +217,14 @@ void vmx_hooks_assist(struct exec_domain
 
     /* load init count*/
     if (p->state == STATE_IORESP_HOOK) { 
+        /* set up actimer, handle re-init */
+        if ( active_ac_timer(&(vpit->pit_timer)) ) {
+            VMX_DBG_LOG(DBG_LEVEL_1, "VMX_PIT: guest reset PIT with channel %lx!\n", (unsigned long) ((p->u.data >> 24) & 0x3) );
+            rem_ac_timer(&(vpit->pit_timer));
+        }
+        else
+            init_ac_timer(&(vpit->pit_timer));
+
         /* init count for this channel */
         vpit->init_val = (p->u.data & 0xFFFF) ; 
         /* frequency(ms) of pit */
@@ -251,12 +259,11 @@ void vmx_hooks_assist(struct exec_domain
 
         vpit->intr_bitmap = intr;
 
-        /* set up the actimer */
-        init_ac_timer(&(vpit->pit_timer));
         vpit->pit_timer.cpu = 0; /*FIXME: change for SMP */
         vpit->pit_timer.data = (unsigned long)vpit;
         vpit->pit_timer.function = pit_timer_fn;
-        pit_timer_fn((unsigned long)vpit); /* timer seed */
+
+        add_ac_timer(&(vpit->pit_timer));
 
         /*restore the state*/
         p->state = STATE_IORESP_READY;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-25 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-25 18:27 [PATCH] vmx-pit-reset.patch Arun Sharma
2005-05-25 21:20 ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.