|
|
619821 |
From 30482e796857e7d29877d93cc017aca5c844e4e1 Mon Sep 17 00:00:00 2001
|
|
|
b28c64 |
From: Fam Zheng <famz@redhat.com>
|
|
|
619821 |
Date: Thu, 18 May 2017 09:21:14 +0200
|
|
|
b28c64 |
Subject: [PATCH 01/18] char/serial: cosmetic fixes.
|
|
|
b28c64 |
MIME-Version: 1.0
|
|
|
b28c64 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b28c64 |
Content-Transfer-Encoding: 8bit
|
|
|
b28c64 |
|
|
|
b28c64 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
619821 |
Message-id: <20170518092131.16571-2-famz@redhat.com>
|
|
|
619821 |
Patchwork-id: 75293
|
|
|
619821 |
O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 01/18] char/serial: cosmetic fixes.
|
|
|
619821 |
Bugzilla: 1451470
|
|
|
b28c64 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
619821 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
b28c64 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
b28c64 |
|
|
|
b28c64 |
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
|
b28c64 |
|
|
|
b28c64 |
Some cosmetic fixes to char/serial fixing some checkpatch errors.
|
|
|
b28c64 |
|
|
|
b28c64 |
Cc: qemu-trivial@nongnu.org
|
|
|
b28c64 |
|
|
|
b28c64 |
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
|
b28c64 |
Reviewed-by: Andreas Färber <afaerber@suse.de>
|
|
|
b28c64 |
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
|
b28c64 |
(cherry picked from commit 7f4f0a227fe0b24c35d0898f9ae7d5909fb51137)
|
|
|
b28c64 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
b28c64 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
b28c64 |
---
|
|
|
b28c64 |
hw/char/serial.c | 30 +++++++++++++++++++-----------
|
|
|
b28c64 |
1 file changed, 19 insertions(+), 11 deletions(-)
|
|
|
b28c64 |
|
|
|
b28c64 |
diff --git a/hw/char/serial.c b/hw/char/serial.c
|
|
|
b28c64 |
index 2383c31..7866b0f 100644
|
|
|
b28c64 |
--- a/hw/char/serial.c
|
|
|
b28c64 |
+++ b/hw/char/serial.c
|
|
|
b28c64 |
@@ -264,8 +264,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
|
|
b28c64 |
if (s->tsr_retry <= 0) {
|
|
|
b28c64 |
if (s->fcr & UART_FCR_FE) {
|
|
|
b28c64 |
s->tsr = fifo_get(s,XMIT_FIFO);
|
|
|
b28c64 |
- if (!s->xmit_fifo.count)
|
|
|
b28c64 |
+ if (!s->xmit_fifo.count) {
|
|
|
b28c64 |
s->lsr |= UART_LSR_THRE;
|
|
|
b28c64 |
+ }
|
|
|
b28c64 |
} else if ((s->lsr & UART_LSR_THRE)) {
|
|
|
b28c64 |
return FALSE;
|
|
|
b28c64 |
} else {
|
|
|
b28c64 |
@@ -462,10 +463,11 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
|
|
|
b28c64 |
} else {
|
|
|
b28c64 |
if(s->fcr & UART_FCR_FE) {
|
|
|
b28c64 |
ret = fifo_get(s,RECV_FIFO);
|
|
|
b28c64 |
- if (s->recv_fifo.count == 0)
|
|
|
b28c64 |
+ if (s->recv_fifo.count == 0) {
|
|
|
b28c64 |
s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);
|
|
|
b28c64 |
- else
|
|
|
b28c64 |
+ } else {
|
|
|
b28c64 |
qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);
|
|
|
b28c64 |
+ }
|
|
|
b28c64 |
s->timeout_ipending = 0;
|
|
|
b28c64 |
} else {
|
|
|
b28c64 |
ret = s->rbr;
|
|
|
b28c64 |
@@ -535,15 +537,21 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
|
|
|
b28c64 |
static int serial_can_receive(SerialState *s)
|
|
|
b28c64 |
{
|
|
|
b28c64 |
if(s->fcr & UART_FCR_FE) {
|
|
|
b28c64 |
- if(s->recv_fifo.count < UART_FIFO_LENGTH)
|
|
|
b28c64 |
- /* Advertise (fifo.itl - fifo.count) bytes when count < ITL, and 1 if above. If UART_FIFO_LENGTH - fifo.count is
|
|
|
b28c64 |
- advertised the effect will be to almost always fill the fifo completely before the guest has a chance to respond,
|
|
|
b28c64 |
- effectively overriding the ITL that the guest has set. */
|
|
|
b28c64 |
- return (s->recv_fifo.count <= s->recv_fifo.itl) ? s->recv_fifo.itl - s->recv_fifo.count : 1;
|
|
|
b28c64 |
- else
|
|
|
b28c64 |
- return 0;
|
|
|
b28c64 |
+ if (s->recv_fifo.count < UART_FIFO_LENGTH) {
|
|
|
b28c64 |
+ /*
|
|
|
b28c64 |
+ * Advertise (fifo.itl - fifo.count) bytes when count < ITL, and 1
|
|
|
b28c64 |
+ * if above. If UART_FIFO_LENGTH - fifo.count is advertised the
|
|
|
b28c64 |
+ * effect will be to almost always fill the fifo completely before
|
|
|
b28c64 |
+ * the guest has a chance to respond, effectively overriding the ITL
|
|
|
b28c64 |
+ * that the guest has set.
|
|
|
b28c64 |
+ */
|
|
|
b28c64 |
+ return (s->recv_fifo.count <= s->recv_fifo.itl) ?
|
|
|
b28c64 |
+ s->recv_fifo.itl - s->recv_fifo.count : 1;
|
|
|
b28c64 |
+ } else {
|
|
|
b28c64 |
+ return 0;
|
|
|
b28c64 |
+ }
|
|
|
b28c64 |
} else {
|
|
|
b28c64 |
- return !(s->lsr & UART_LSR_DR);
|
|
|
b28c64 |
+ return !(s->lsr & UART_LSR_DR);
|
|
|
b28c64 |
}
|
|
|
b28c64 |
}
|
|
|
b28c64 |
|
|
|
b28c64 |
--
|
|
|
b28c64 |
1.8.3.1
|
|
|
b28c64 |
|