[Qemu-devel] [PATCH RFC v2 0/2] Fix UART serial implementation

Calvin Lee posted 2 patches 7 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180512000545.966-1-cyrus296@gmail.com
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test s390x passed
hw/char/serial.c         | 74 +++++++++++++++++++++++++++++++---------
include/hw/char/serial.h |  2 ++
2 files changed, 60 insertions(+), 16 deletions(-)
[Qemu-devel] [PATCH RFC v2 0/2] Fix UART serial implementation
Posted by Calvin Lee 7 years, 4 months ago
Hello,

While developing a serial implementation for my OS, I found several bugs
in QEMU's serial device. I confirmed (by testing on my x64 laptop) that
there are several inconsistancies between QEMU and hardware in this
regard. For both patches, I used "http://www.sci.muni.cz/docs/pc/serport.txt"
for reference.

First, QEMU has several errors for setting the UART divisor that are
fixed in my first patch. Second, (and more importantly) QEMU does not
transmit serial bytes at the correct rate, and this is fixed in my
second patch.

I have neither contributed to QEMU nor sent patches to a mailing list
before, so I marked this patch-series as RFC. I would appreciate any
comments you have. Also, I am not very confident in VM migration between
versions, so I would appreciate if someone could help me make sure this
is correct in my patches.

v2:
fix build

Calvin Lee (2):
  PC Chipset: Improve serial divisor calculation
  PC Chipset: Send serial bytes at correct rate

 hw/char/serial.c         | 74 +++++++++++++++++++++++++++++++---------
 include/hw/char/serial.h |  2 ++
 2 files changed, 60 insertions(+), 16 deletions(-)

-- 
2.17.0


Re: [Qemu-devel] [PATCH RFC v2 0/2] Fix UART serial implementation
Posted by Paolo Bonzini 7 years, 2 months ago
On 12/05/2018 02:05, Calvin Lee wrote:
> While developing a serial implementation for my OS, I found several bugs
> in QEMU's serial device. I confirmed (by testing on my x64 laptop) that
> there are several inconsistancies between QEMU and hardware in this
> regard. For both patches, I used "http://www.sci.muni.cz/docs/pc/serport.txt"
> for reference.
> 
> First, QEMU has several errors for setting the UART divisor that are
> fixed in my first patch. Second, (and more importantly) QEMU does not
> transmit serial bytes at the correct rate, and this is fixed in my
> second patch.

Hi Calvin,

I am queuing the first patch.  Regarding the second, it's been debated
quite a few times over the years whether QEMU should respect the
transmit rate or not.  The main advantage of not doing so is that some
OSes use the serial port pretty heavily (e.g. Linux for boot messages,
or Windows for debugging), and throttling the serial port to just e.g.
115200 bps makes them unnecessarily slow.

Paolo