|
|
9ae3a8 |
From 8497b21c6dabe117b27d76f3bdbd86d80b0dd1d7 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 18 May 2017 09:21:30 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 17/18] serial: separate serial_xmit and serial_watch_cb
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20170518092131.16571-18-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 75309
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 17/18] serial: separate serial_xmit and serial_watch_cb
|
|
|
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: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
serial_xmit starts transmission of whatever is in the transmitter
|
|
|
9ae3a8 |
register, THR or FIFO; serial_watch_cb is a wrapper around it and is
|
|
|
9ae3a8 |
only used as a qemu_chr_fe_add_watch callback.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Tested-by: Bret Ketchum <bcketchum@gmail.com>
|
|
|
9ae3a8 |
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit b0585e7e07982daa578c3bfef7f6843c89f110a8)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
hw/char/serial.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Contextual conflict because the surrounding migration code around the
|
|
|
9ae3a8 |
touched functions is different.
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/char/serial.c | 18 +++++++++++-------
|
|
|
9ae3a8 |
1 file changed, 11 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/char/serial.c b/hw/char/serial.c
|
|
|
9ae3a8 |
index fdda802..69fefb2 100644
|
|
|
9ae3a8 |
--- a/hw/char/serial.c
|
|
|
9ae3a8 |
+++ b/hw/char/serial.c
|
|
|
9ae3a8 |
@@ -104,6 +104,7 @@ do {} while (0)
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void serial_receive1(void *opaque, const uint8_t *buf, int size);
|
|
|
9ae3a8 |
+static void serial_xmit(SerialState *s);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static inline void recv_fifo_put(SerialState *s, uint8_t chr)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -219,10 +220,16 @@ static void serial_update_msl(SerialState *s)
|
|
|
9ae3a8 |
qemu_mod_timer(s->modem_status_poll, qemu_get_clock_ns(vm_clock) + get_ticks_per_sec() / 100);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
|
|
9ae3a8 |
+static gboolean serial_watch_cb(GIOChannel *chan, GIOCondition cond,
|
|
|
9ae3a8 |
+ void *opaque)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
SerialState *s = opaque;
|
|
|
9ae3a8 |
+ serial_xmit(s);
|
|
|
9ae3a8 |
+ return FALSE;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static void serial_xmit(SerialState *s)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
do {
|
|
|
9ae3a8 |
assert(!(s->lsr & UART_LSR_TEMT));
|
|
|
9ae3a8 |
if (s->tsr_retry == 0) {
|
|
|
9ae3a8 |
@@ -250,9 +257,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
|
|
9ae3a8 |
} else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
|
|
|
9ae3a8 |
if (s->tsr_retry < MAX_XMIT_RETRY &&
|
|
|
9ae3a8 |
qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP,
|
|
|
9ae3a8 |
- serial_xmit, s) > 0) {
|
|
|
9ae3a8 |
+ serial_watch_cb, s) > 0) {
|
|
|
9ae3a8 |
s->tsr_retry++;
|
|
|
9ae3a8 |
- return FALSE;
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
s->tsr_retry = 0;
|
|
|
9ae3a8 |
@@ -263,11 +270,8 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
s->last_xmit_ts = qemu_get_clock_ns(vm_clock);
|
|
|
9ae3a8 |
s->lsr |= UART_LSR_TEMT;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- return FALSE;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
|
|
|
9ae3a8 |
unsigned size)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -295,7 +299,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
|
|
|
9ae3a8 |
s->lsr &= ~UART_LSR_TEMT;
|
|
|
9ae3a8 |
serial_update_irq(s);
|
|
|
9ae3a8 |
if (s->tsr_retry == 0) {
|
|
|
9ae3a8 |
- serial_xmit(NULL, G_IO_OUT, s);
|
|
|
9ae3a8 |
+ serial_xmit(s);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|