yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-serial-update-LSR-on-enabling-disabling-FIFOs.patch

9ae3a8
From d6acc0368578932ee6a2949054a6f640a5b6fa09 Mon Sep 17 00:00:00 2001
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Thu, 18 May 2017 09:21:26 +0200
9ae3a8
Subject: [PATCH 13/18] serial: update LSR on enabling/disabling FIFOs
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <20170518092131.16571-14-famz@redhat.com>
9ae3a8
Patchwork-id: 75306
9ae3a8
O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 13/18] serial: update LSR on enabling/disabling FIFOs
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
When the transmit FIFO is emptied or enabled, the transmitter
9ae3a8
hold register is empty.  When it is disabled, it is also emptied and
9ae3a8
in addition the previous contents of the transmitter hold register
9ae3a8
are discarded.  In either case, the THRE bit in LSR must be set and
9ae3a8
THRI raised.
9ae3a8
9ae3a8
When the receive FIFO is emptied or enabled, the data ready and break
9ae3a8
bits must be cleared in LSR.  Likewise when the receive FIFO is disabled.
9ae3a8
9ae3a8
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
(cherry picked from commit 023c3a9707d0d9259a1e858cdf7804dd10973fca)
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 upstream uses new timer API timer_del while
9ae3a8
downstream still uses qemu_del_timer.
9ae3a8
---
9ae3a8
 hw/char/serial.c | 3 +++
9ae3a8
 1 file changed, 3 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/char/serial.c b/hw/char/serial.c
9ae3a8
index c2be4bd..e0d29a8 100644
9ae3a8
--- a/hw/char/serial.c
9ae3a8
+++ b/hw/char/serial.c
9ae3a8
@@ -351,12 +351,15 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
9ae3a8
         /* FIFO clear */
9ae3a8
 
9ae3a8
         if (val & UART_FCR_RFR) {
9ae3a8
+            s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);
9ae3a8
             qemu_del_timer(s->fifo_timeout_timer);
9ae3a8
             s->timeout_ipending=0;
9ae3a8
             fifo8_reset(&s->recv_fifo);
9ae3a8
         }
9ae3a8
 
9ae3a8
         if (val & UART_FCR_XFR) {
9ae3a8
+            s->lsr |= UART_LSR_THRE;
9ae3a8
+            s->thr_ipending = 1;
9ae3a8
             fifo8_reset(&s->xmit_fifo);
9ae3a8
         }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8