On 19 April 2017 at 10:25, Jiahuan Zhang <jiahuanzhan...@gmail.com> wrote: > On 19 April 2017 at 11:15, Peter Maydell <peter.mayd...@linaro.org> wrote: >> What is happening is that the guest kernel's serial driver >> has a loop that (simplified) looks like this: >> >> do { >> if (pl011_read(REG_FR) & FR_TXFF) >> break; /* fifo full, try again later */ >> pl011_write(buffer[x], REG_DR); /* send one byte */ >> x++; >> } while (x != len); >> >> This is a lot of guest CPU instructions (and two callouts >> to QEMU's device emulation) for every single byte. >> > Hi, no, I am not using any kernel driver and I only test the guest to host > data transfer.
OK, then the equivalent loop is this one: > /* > * write_to_uart(): write data to serial port > */ > void write_to_uart(char* out, uint32_t writeSize){ > int i; > for(i=0; i<writeSize; i++){ > *UART1 =(unsigned char)(*(out+i)); > } > } except that your code is broken because it's not checking that the FIFO is ready to receive the character so it will drop data sometimes. The point is the same -- you're feeding the data to the UART byte-at-a-time. thanks -- PMM