qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Hight Processor time of Socket communciation


From: Peter Maydell
Subject: Re: [Qemu-devel] Hight Processor time of Socket communciation
Date: Wed, 19 Apr 2017 10:55:29 +0100

On 19 April 2017 at 10:25, Jiahuan Zhang <address@hidden> wrote:
> On 19 April 2017 at 11:15, Peter Maydell <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]