linux/arch/x86/kvm
Nickolai Zeldovich d4b06c2d4c kvm: fix i8254 counter 0 wraparound
The kvm i8254 emulation for counter 0 (but not for counters 1 and 2)
has at least two bugs in mode 0:

1. The OUT bit, computed by pit_get_out(), is never set high.

2. The counter value, computed by pit_get_count(), wraps back around to
   the initial counter value, rather than wrapping back to 0xFFFF
   (which is the behavior described in the comment in __kpit_elapsed,
   the behavior implemented by qemu, and the behavior observed on AMD
   hardware).

The bug stems from __kpit_elapsed computing the elapsed time mod the
initial counter value (stored as nanoseconds in ps->period).  This is both
unnecessary (none of the callers of kpit_elapsed expect the value to be
at most the initial counter value) and incorrect (it causes pit_get_count
to appear to wrap around to the initial counter value rather than 0xFFFF).
Removing this mod from __kpit_elapsed fixes both of the above bugs.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
2012-12-18 11:12:38 +02:00
..
cpuid.c KVM: x86: Make register state after reset conform to specification 2012-12-05 18:00:07 +02:00
cpuid.h Merge tag 'kvm-3.8-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-12-13 15:31:08 -08:00
emulate.c KVM: x86: fix mov immediate emulation for 64-bit operands 2012-12-13 22:30:56 -02:00
i8254.c kvm: fix i8254 counter 0 wraparound 2012-12-18 11:12:38 +02:00
i8254.h KVM: fold kvm_pit_timer into kvm_kpit_state 2012-08-01 00:21:07 -03:00
i8259.c KVM: inject ExtINT interrupt before APIC interrupts 2012-12-13 23:05:21 -02:00
irq.c KVM: remove unused variable. 2012-12-14 23:07:44 -02:00
irq.h KVM: switch to symbolic name for irq_states size 2012-07-20 16:12:16 -03:00
Kconfig KVM: Depend on HIGH_RES_TIMERS 2012-09-10 11:10:03 +03:00
kvm_cache_regs.h KVM: MMU: Do not unconditionally read PDPTE from guest memory 2011-09-25 19:18:01 +03:00
lapic.c KVM: x86: pass host_tsc to read_l1_tsc 2012-11-27 23:29:11 -02:00
lapic.h KVM: optimize apic interrupt delivery 2012-09-20 15:05:26 +03:00
Makefile KVM: Remove internal timer abstraction 2012-08-01 00:21:06 -03:00
mmu_audit.c KVM: do not release the error pfn 2012-08-06 16:04:57 +03:00
mmu.c KVM: MMU: optimize for set_spte 2012-12-06 09:11:25 +02:00
mmu.h KVM: MMU: Optimize is_last_gpte() 2012-09-20 13:00:09 +03:00
mmutrace.h KVM: MMU: fix kvm_mmu_pagetable_walk tracepoint 2012-07-11 16:51:22 +03:00
paging_tmpl.h KVM: do not treat noslot pfn as a error pfn 2012-10-29 20:31:04 -02:00
pmu.c Merge branch 'queue' into next 2012-07-26 11:54:21 +03:00
svm.c KVM: x86: Make register state after reset conform to specification 2012-12-05 18:00:07 +02:00
trace.h KVM: x86: require matched TSC offsets for master clock 2012-11-27 23:29:15 -02:00
tss.h KVM: x86: hardware task switching support 2008-04-27 12:00:39 +03:00
vmx.c KVM: struct kvm_memory_slot.user_alloc -> bool 2012-12-13 23:24:38 -02:00
x86.c KVM: struct kvm_memory_slot.user_alloc -> bool 2012-12-13 23:24:38 -02:00
x86.h KVM: x86: Add code to track call origin for msr assignment 2012-11-30 18:26:12 -02:00