aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-07-11 11:23:17 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-07-12 15:00:50 +0200
commitafb7a0b85be3a21eccd5ede0a41815b15c300b6b (patch)
treece968395cf708e7f7037091e2d6fce5de091c88c /hw
parent7efc17af9a08839a05771541959696875e06cf99 (diff)
ehci: improve expire time calculation
Move down the expire time calculation down in the frame timer, to the point where the timer is actually reloaded. This way we'll notice any async_stepdown changes (especially resetting to 0 due to usb activity). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/hcd-ehci.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 6040e86a47..b043e7c23e 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2372,7 +2372,7 @@ static void ehci_frame_timer(void *opaque)
if (ehci_periodic_enabled(ehci) || ehci->pstate != EST_INACTIVE) {
need_timer++;
- expire_time = t_now + (get_ticks_per_sec() / FRAME_TIMER_FREQ);
+ ehci->async_stepdown = 0;
if (frames > ehci->maxframes) {
skipped_frames = frames - ehci->maxframes;
@@ -2391,8 +2391,6 @@ static void ehci_frame_timer(void *opaque)
if (ehci->async_stepdown < ehci->maxframes / 2) {
ehci->async_stepdown++;
}
- expire_time = t_now + (get_ticks_per_sec()
- * ehci->async_stepdown / FRAME_TIMER_FREQ);
ehci_update_frindex(ehci, frames);
ehci->last_run_ns += FRAME_TIMER_NS * frames;
}
@@ -2402,7 +2400,7 @@ static void ehci_frame_timer(void *opaque)
*/
if (ehci_async_enabled(ehci) || ehci->astate != EST_INACTIVE) {
need_timer++;
- qemu_bh_schedule(ehci->async_bh);
+ ehci_advance_async_state(ehci);
}
ehci_commit_irq(ehci);
@@ -2412,6 +2410,8 @@ static void ehci_frame_timer(void *opaque)
}
if (need_timer) {
+ expire_time = t_now + (get_ticks_per_sec()
+ * (ehci->async_stepdown+1) / FRAME_TIMER_FREQ);
qemu_mod_timer(ehci->frame_timer, expire_time);
}
}