yeahuh / 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

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