public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* KVM: PIT: support mode 4
@ 2008-04-30 16:23 Marcelo Tosatti
  2008-04-30 17:07 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2008-04-30 16:23 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel


The in-kernel PIT emulation ignores pending timers if operating under
mode 4, which for example DragonFlyBSD uses (and Plan9 too, apparently).

Mode 4 seems to be similar to one-shot mode, other than the fact that it
starts counting after the next CLK pulse once programmed, while mode 1
starts counting immediately, so add a FIXME to enhance precision.

Fixes https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1952988&group_id=180599

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Sheng Yang <sheng.yang@intel.com>

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 908520c..1646102 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -288,6 +288,8 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val)
 	 * mode 1 is one shot, mode 2 is period, otherwise del timer */
 	switch (ps->channels[0].mode) {
 	case 1:
+        /* FIXME: enhance mode 4 precision */
+	case 4:
 		create_pit_timer(&ps->pit_timer, val, 0);
 		break;
 	case 2:

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

* Re: KVM: PIT: support mode 4
  2008-04-30 16:23 KVM: PIT: support mode 4 Marcelo Tosatti
@ 2008-04-30 17:07 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-04-30 17:07 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel

Marcelo Tosatti wrote:
> The in-kernel PIT emulation ignores pending timers if operating under
> mode 4, which for example DragonFlyBSD uses (and Plan9 too, apparently).
>
> Mode 4 seems to be similar to one-shot mode, other than the fact that it
> starts counting after the next CLK pulse once programmed, while mode 1
> starts counting immediately, so add a FIXME to enhance precision.
>
> Fixes https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1952988&group_id=180599
>   

Applied, thanks.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

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

end of thread, other threads:[~2008-04-30 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30 16:23 KVM: PIT: support mode 4 Marcelo Tosatti
2008-04-30 17:07 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox