qemu/target/mips/kvm.c
/*
 * Handle the VM clock being started or stopped
 */
Handle the VM clock being started or stopped
Handle the VM clock being started or stopped
static void kvm_mips_update_state(void *opaque, int running, RunState state)
{
    CPUState *cs = opaque;
    int ret;
    uint64_t count_resume;
    if (!running) {
        if (!cs->vcpu_dirty) {
            ret = kvm_mips_save_count(cs);
            if (ret < 0) {
                warn_report("Failed saving count");
            }
        }
    } else {
        count_resume = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
        ret = kvm_mips_put_one_ureg64(cs, KVM_REG_MIPS_COUNT_RESUME,
                                      &count_resume);
        if (ret < 0) {
            warn_report("Failed setting COUNT_RESUME");
            return;
        }
        if (!cs->vcpu_dirty) {
            ret = kvm_mips_restore_count(cs);
            if (ret < 0) {
                warn_report("Failed restoring count");
            }
        }
    }
}
static void kvm_mips_update_state ( void * opaque , int running , RunState state ) { CPUState * cs = opaque ; int ret ; uint64_t count_resume ; if ( ! running ) { if ( ! cs -> vcpu_dirty ) { ret = kvm_mips_save_count ( cs ) ; if ( ret < 0 ) { warn_report ( " " ) ; } } } else { count_resume = qemu_clock_get_ns ( QEMU_CLOCK_REALTIME ) ; ret = kvm_mips_put_one_ureg64 ( cs , KVM_REG_MIPS_COUNT_RESUME , & count_resume ) ; if ( ret < 0 ) { warn_report ( " " ) ; return ; } if ( ! cs -> vcpu_dirty ) { ret = kvm_mips_restore_count ( cs ) ; if ( ret < 0 ) { warn_report ( " " ) ; } } } }
Handle the VM clock being started or stopped
Handle the VM clock being started or stopped
/*
     * If state is already dirty (synced to QEMU) then the KVM timer state is
     * already saved and can be restored when it is synced back to KVM.
     */ /* Set clock restore time to now */