[SeaBIOS] Intermittent USB keyboard freeze

Kevin O'Connor kevin at koconnor.net
Mon Feb 3 21:52:11 CET 2014


On Mon, Feb 03, 2014 at 01:59:38PM -0500, Kevin O'Connor wrote:
> Which indicates two USB HID devices are found when there is only one
> actual device.  So, it seems like when SeaBIOS is trying to initialize
> the USB hub, it is somehow talking to the USB keyboard again.
> 
> Does QEMU keep some kind of cache of UHCI transfer descriptors that
> may be getting out of sync?

I looked through the QEMU hcd-uhci.c code, and I think QEMU is buggy
here.  QEMU keeps a mapping of queues that are indexed by the usb
device address and endpoint (see uhci_queue_new() ).  When the usb
device has address 0, it creates an entry in this mapping and the
entry remains even after the device is given a new address.  Later,
when the next device also has address 0, QEMU attempts to use that
mapping even though the 0 address now corresponds with a different
device.

Before the move of the seabios sleep call, the seabios allocators just
happened to give a different address for the queue head, and this was
enough to tip QEMU off and it invalidated the mapping.  Now, though,
the seabios allocators just happen to give the same address for the
queue head, and QEMU is happily sending the commands to the wrong
device.

It seems to me that QEMU should invalidate its mappings on a
set_address command, and it shouldn't have to worry about invalidating
on a qh_addr change.  But, I'm not really sure how to fix this.

-Kevin



More information about the SeaBIOS mailing list