]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
kvm: i8254: Fix conversion of in-kernel to userspace state
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 6 Jun 2012 14:28:42 +0000 (16:28 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 25 Jun 2012 13:53:13 +0000 (08:53 -0500)
commit7672b714b28e3d49f73c605873404bf6f644c2b2
tree85346f2b98a724858345a4ab51f43471775f25ae
parentca09717e8e0664801522781962a3c727d04eef33
kvm: i8254: Fix conversion of in-kernel to userspace state

Due to a offset between the clock used to generate the in-kernel
count_load_time (CLOCK_MONOTONIC) and the clock used for processing this
in userspace (vm_clock), reading back the output of PIT channel 2 via
port 0x61 was broken. One use cases that suffered from it was the CPU
frequency calibration of SeaBIOS, which also affected IDE/AHCI timeouts.

This fixes it by calibrating the offset between both clocks on
kvm_pit_get and adjusting the kernel value before saving it in the
userspace state. As the calibration only works while the vm_clock is
running, we cache the in-kernel state across stopped phases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
(cherry picked from commit 0cdd3d14447da1a04e778c219c77db8b96f9cf33)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/kvm/i8254.c