All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] guest os time tick issue
@ 2010-04-03  8:21 Michael Qiu
  0 siblings, 0 replies; only message in thread
From: Michael Qiu @ 2010-04-03  8:21 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2325 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-03  8:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-03  8:21 [Qemu-devel] guest os time tick issue Michael Qiu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.