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