many thanks for the rapid reply! On 21 March 2017 at 17:39, Peter Maydell <peter.mayd...@linaro.org> wrote:
> 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 > The actual situation is, pl011_can_receive is returning false, the fifo is full, pl011_read does't start. At this moment, only pl011_can_recieve is keeping returning 0. > * 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 > No, because the guest application does't get any data. > * etc > > thanks > -- PMM >