On 21 March 2017 at 16:32, Jiahuan Zhang <jiahuanzhan...@gmail.com> wrote: > I found the serial device is always trying to receive all the data when > ReadFile() is running, then start reading. Even if the fifo is full, the > _can_receive function still keeps polling if the data is larger than 16 > bytes.
pl011_can_receive() is: static int pl011_can_receive(void *opaque) { PL011State *s = (PL011State *)opaque; int r; if (s->lcr & 0x10) { r = s->read_count < 16; } else { r = s->read_count < 1; } trace_pl011_can_receive(s->lcr, s->read_count, r); return r; } so if the FIFO fills up then it should start to return 'false', as it is supposed to. I'm not sure from your description what exactly is happening, but you should probably check, for instance: * whether pl011_can_receive is returning false but data is still being fed to it * whether pl011_can_receive is returning true even with 16 bytes in the fifo (hard to see how, given the code) * whether the fifo actually has fewer bytes in it because the guest is reading them * etc thanks -- PMM