qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] guest os time tick issue


From: Michael Qiu
Subject: [Qemu-devel] guest os time tick issue
Date: Sat, 3 Apr 2010 16:21:11 +0800

I'm using qemu to boot a mips kernel.
But it seems always hung like this:
"Calibrating delay loop..."
Actually, it is caused by following code in

int c0_compare_int_usable(void)
{
    unsigned int delta;
    unsigned int cnt;

    /*
     * IP7 already pending?  Try to clear it by acking the timer.
     */
    if (c0_compare_int_pending()) {
        write_c0_compare(read_c0_count());
        compare_change_hazard();
        if (c0_compare_int_pending())
            return 0;
    }

    for (delta = 0x10; delta <= 0x400000; delta <<= 1) {
        cnt = read_c0_count();
        cnt += delta;
        write_c0_compare(cnt);
        compare_change_hazard();
        if ((int)(read_c0_count() - cnt) < 0)
            break; // In qemu, it seems always 1024. Is this a configurable value in qemu?
        /* increase delta if the timer was already expired */
    }

    while ((int)(read_c0_count() - cnt) <= 0)
        ;    /* Wait for expiry  */

    compare_change_hazard();
    if (!c0_compare_int_pending())
        return 0;  // If i comment out this, everything will be fine.

    write_c0_compare(read_c0_count());
    compare_change_hazard();
    if (c0_compare_int_pending())
        return 0;

    /*
     * Feels like a real count / compare timer.
     */
    return 1;
}


Seems the  hight line will check the timer interrupt, as in real world, there should be a pending timer interrupt pending untill next write to compare.

I just guest the qemu will do like this:

while(1)
{
  execute some guest code // is the number of instuctions fixed? If the guest code access some memory io memory, simulated hw will be executed.
  update background io // just like chardev, sdl relative...
  update count value in guest cpu // Is the value fixed?
}

Please correct me, thanks in advance

reply via email to

[Prev in Thread] Current Thread [Next in Thread]