[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/10] uhci: use bottom half
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 02/10] uhci: use bottom half |
Date: |
Fri, 25 May 2012 11:44:13 +0200 |
Schedule bottom half on completion of async packets instead of calling
uhci_process_frame directly. This way we run uhci_process_frame only
once in case multiple packets finish in a row. Also check whenever
there is bandwidth left before scheduling uhci_process_frame.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-uhci.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 48ad35c..91bcc7e 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -131,6 +131,7 @@ struct UHCIState {
uint8_t status2; /* bit 0 and 1 are used to generate UHCI_STS_USBINT */
int64_t expire_time;
QEMUTimer *frame_timer;
+ QEMUBH *bh;
uint32_t frame_bytes;
UHCIPort ports[NB_PORTS];
@@ -370,6 +371,7 @@ static void uhci_reset(void *opaque)
}
uhci_async_cancel_all(s);
+ qemu_bh_cancel(s->bh);
uhci_update_irq(s);
}
@@ -906,7 +908,9 @@ static void uhci_async_complete(USBPort *port, USBPacket
*packet)
uhci_async_free(async);
} else {
async->done = 1;
- uhci_process_frame(s);
+ if (s->frame_bytes < 1280) {
+ qemu_bh_schedule(s->bh);
+ }
}
}
@@ -1113,6 +1117,12 @@ out:
s->pending_int_mask |= int_mask;
}
+static void uhci_bh(void *opaque)
+{
+ UHCIState *s = opaque;
+ uhci_process_frame(s);
+}
+
static void uhci_frame_timer(void *opaque)
{
UHCIState *s = opaque;
@@ -1120,6 +1130,7 @@ static void uhci_frame_timer(void *opaque)
/* prepare the timer for the next frame */
s->expire_time += (get_ticks_per_sec() / FRAME_TIMER_FREQ);
s->frame_bytes = 0;
+ qemu_bh_cancel(s->bh);
if (!(s->cmd & UHCI_CMD_RS)) {
/* Full stop */
@@ -1206,6 +1217,7 @@ static int usb_uhci_common_initfn(PCIDevice *dev)
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
}
}
+ s->bh = qemu_bh_new(uhci_bh, s);
s->frame_timer = qemu_new_timer_ns(vm_clock, uhci_frame_timer, s);
s->num_ports_vmstate = NB_PORTS;
QTAILQ_INIT(&s->queues);
--
1.7.1
- [Qemu-devel] [PATCH 00/10] usb: uhci & usb-storage updates, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 03/10] uhci: make bandwidth tunable, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 04/10] uhci: fix trace format strings, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 09/10] usb-storage: add scsi_off, remove scsi_buf, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 05/10] uhci: zap uhci_pre_save, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 02/10] uhci: use bottom half,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 10/10] usb-storage: migration support, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 08/10] usb-storage: add usb_msd_packet_complete(), Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 01/10] uhci: fix bandwidth management, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 07/10] usb-storage: remove MSDState->residue, Gerd Hoffmann, 2012/05/25
- [Qemu-devel] [PATCH 06/10] scsi: prepare migration code for usb-storage support, Gerd Hoffmann, 2012/05/25