cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-serial-check-if-backed-by-a-physical-serial-port-at-.patch

619821
From 3ad8bb6f424f7ff1d4bbf73237fb1590f0ce1810 Mon Sep 17 00:00:00 2001
b28c64
From: Fam Zheng <famz@redhat.com>
619821
Date: Thu, 18 May 2017 09:21:23 +0200
b28c64
Subject: [PATCH 10/18] serial: check if backed by a physical serial port at
b28c64
 realize time
b28c64
b28c64
RH-Author: Fam Zheng <famz@redhat.com>
619821
Message-id: <20170518092131.16571-11-famz@redhat.com>
619821
Patchwork-id: 75299
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH v3 10/18] serial: check if backed by a physical serial port at realize time
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: Paolo Bonzini <pbonzini@redhat.com>
b28c64
b28c64
Right now, s->poll_msl may linger at "0" value for an arbitrarily long
b28c64
time, until serial_update_msl is called for the first time.  This is
b28c64
unnecessary, and will lead to the s->poll_msl field being unnecessarily
b28c64
migrated.
b28c64
b28c64
We can call serial_update_msl immediately at realize time (via
b28c64
serial_reset) and be done with it.  The memory-mapped UART was already
b28c64
doing that, but not the ISA and PCI variants.
b28c64
b28c64
Regarding the delta bits, be consistent with what serial_reset does when
b28c64
the serial port is not backed by a physical serial port, and always clear
b28c64
them at reset time.
b28c64
b28c64
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
b28c64
(cherry picked from commit a30cf8760f4a59797fc060c3c5a13b7749551d0c)
b28c64
Signed-off-by: Fam Zheng <famz@redhat.com>
b28c64
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b28c64
---
b28c64
 hw/char/serial.c | 5 +++--
b28c64
 1 file changed, 3 insertions(+), 2 deletions(-)
b28c64
b28c64
diff --git a/hw/char/serial.c b/hw/char/serial.c
b28c64
index 33e06fb..5ef9b95 100644
b28c64
--- a/hw/char/serial.c
b28c64
+++ b/hw/char/serial.c
b28c64
@@ -650,6 +650,9 @@ static void serial_reset(void *opaque)
b28c64
     s->thr_ipending = 0;
b28c64
     s->last_break_enable = 0;
b28c64
     qemu_irq_lower(s->irq);
b28c64
+
b28c64
+    serial_update_msl(s);
b28c64
+    s->msr &= ~UART_MSR_ANY_DELTA;
b28c64
 }
b28c64
 
b28c64
 void serial_init_core(SerialState *s)
b28c64
@@ -768,7 +771,5 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
b28c64
     memory_region_init_io(&s->io, &serial_mm_ops[end], s,
b28c64
                           "serial", 8 << it_shift);
b28c64
     memory_region_add_subregion(address_space, base, &s->io);
b28c64
-
b28c64
-    serial_update_msl(s);
b28c64
     return s;
b28c64
 }
b28c64
-- 
b28c64
1.8.3.1
b28c64