Blame SOURCES/0023-RHEL-only-hw-char-pl011-fix-SBSA-reset.patch

1bdc94
From 098bbd9ed847849834ff1f21766d23ea240c5bf0 Mon Sep 17 00:00:00 2001
4a2fec
From: Andrew Jones <drjones@redhat.com>
4a2fec
Date: Mon, 1 Aug 2016 14:27:09 +0200
4a2fec
Subject: RHEL-only: hw/char/pl011: fix SBSA reset
4a2fec
4a2fec
RH-Author: Andrew Jones <drjones@redhat.com>
4a2fec
Message-id: <1470061629-6395-1-git-send-email-drjones@redhat.com>
4a2fec
Patchwork-id: 71697
4a2fec
O-Subject: [AArch64 RHEL-7.3 qemu-kvm-rhev PATCH] RHEL-only: hw/char/pl011: fix SBSA reset
4a2fec
Bugzilla: 1266048
4a2fec
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
4a2fec
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
RH-Acked-by: Wei Huang <wei@redhat.com>
4a2fec
4a2fec
When booting Linux with an SBSA UART, e.g. when booting mach-virt
4a2fec
with ACPI, if the user types on the console during boot, then when
4a2fec
the login prompt appears she won't be able to log in. This is
4a2fec
because during boot the SBSA UART needs to be reset, but the SBSA
4a2fec
specification doesn't provide registers to enable/disable the FIFOs.
4a2fec
This patch observes a couple registers the SBSA UART does write to
4a2fec
in order to attempt to guess when a reset is needed, and then do it.
4a2fec
We risk losing some characters from the FIFO if the guess is wrong,
4a2fec
but the risk of that should be quite low.
4a2fec
4a2fec
Signed-off-by: Andrew Jones <drjones@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
(cherry picked from commit 15ee295534f654d6b6ba9499cdd380aa9c954920)
1bdc94
(cherry picked from commit 49be481336c227fdad2f7edc02fa088f3d88c9a2)
1bdc94
(cherry picked from commit 9fcede24f35378e2c9113440a692d2c96cc94865)
1bdc94
(cherry picked from commit b721e7ff2bdd42b0a786b8630c1ba8b1d3560da3)
1bdc94
(cherry picked from commit 88f3eb70f909b03ed18074aadd12f32f28ad8437)
4a2fec
---
4a2fec
 hw/char/pl011.c | 12 ++++++++++++
4a2fec
 1 file changed, 12 insertions(+)
4a2fec
4a2fec
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
4a2fec
index 2aa277f..23fe047 100644
4a2fec
--- a/hw/char/pl011.c
4a2fec
+++ b/hw/char/pl011.c
4a2fec
@@ -209,6 +209,18 @@ static void pl011_write(void *opaque, hwaddr offset,
4a2fec
         pl011_update(s);
4a2fec
         break;
4a2fec
     case 17: /* UARTICR */
4a2fec
+        /*
4a2fec
+         * RHEL-only, fixes BZ1266048
4a2fec
+         *
4a2fec
+         * Look for the "signature" of a driver init or shutdown in
4a2fec
+         * order to know that we need to reset the SBSA UART. Yes,
4a2fec
+         * this is hacky, but as SBSA drivers aren't required to write
4a2fec
+         * UARTLCR_H or UARTCR, then we don't have much choice...
4a2fec
+         */
4a2fec
+        if (s->int_enabled == 0 && value == 0xffff) {
4a2fec
+            s->read_count = 0;
4a2fec
+            s->read_pos = 0;
4a2fec
+        }
4a2fec
         s->int_level &= ~value;
4a2fec
         pl011_update(s);
4a2fec
         break;
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec