On Thu, Oct 27, 2011 at 04:55:15PM -0400, John Baboval wrote:
When using seabios with Xen and qemu, I frequently get the following message:
WARNING - Timeout at i8042_flush:69!
I do have a slightly unusual configuration compared to the typical Xen configuration. We are running with no hvmloader. However I don't think that's related to this issue....
The flush routine attempts to read the queue depth's worth of data from the port and then checks to see if the queue is empty. There are two issues with this. First is that qemu and seabios disagree about the queue depth. Qemu's ps2 buffer has 256 entries, and I8042_BUFFER_SIZE is 16 for seabios. The second is that a command may arrive between the start of the flush loop and the completion.
I believe a more robust way to do this would be to first issue a RESET command, and then flush. That resolves the issue that I am seeing.
The ps2 port code is used on real hardware as well as on QEmu/Xen. The goal of the flush is two fold - to remove bytes in the i8042 buffer from a previous session and to be sure the i8042 is actually present and working. So, we can't issue a reset prior to flushing the i8042.
As for the queue length - this seems like a virtual machine quirk with timing. The goal of the code is to clear the i8042 buffer which shouldn't be more than a few bytes. On a real machine, the keyboard wouldn't have enough time to fill the i8042 before the flush would remove any characters.
It's possible to increase the timeout, but the increased boot time can be annoying for users on real hardware without a ps2 port. Another option may be to change the code so that it reads and discards continuosly for 1ms - that way it can clear however many bytes are present, but still move on quickly if the port isn't responding.
-Kevin