• J
    kvm: i8254: Fix conversion of in-kernel to userspace state · 0cdd3d14
    Jan Kiszka 提交于
    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: NJan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: NAvi Kivity <avi@redhat.com>
    0cdd3d14
i8254.c 8.6 KB