qemu-kvm/kvm-hw-char-pl011-Use-correct-masks-for-IBRD-and-FBRD.patch
Miroslav Rezanina 307deeb5ff * Mon Jan 06 2025 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-8
- kvm-linux-headers-Update-to-Linux-v6.12-rc5.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa10-subfunctions.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa11-subfunctions.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa12-changes.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-msa13-subfunctions.patch [RHEL-50212]
- kvm-s390x-cpumodel-Add-ptff-Query-Time-Stamp-Event-QTSE-.patch [RHEL-50212]
- kvm-linux-headers-Update-to-Linux-6.13-rc1.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Concurrent-functions-facility-sup.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Vector-Enhancements-facility-3.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Miscellaneous-Instruction-Extensi.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Vector-Packed-Decimal-Enhancement.patch [RHEL-50212]
- kvm-s390x-cpumodel-add-Ineffective-nonconstrained-transa.patch [RHEL-50212]
- kvm-s390x-cpumodel-Add-Sequential-Instruction-Fetching-f.patch [RHEL-50212]
- kvm-s390x-cpumodel-correct-PLO-feature-wording.patch [RHEL-50212]
- kvm-s390x-cpumodel-Add-PLO-extension-facility.patch [RHEL-50212]
- kvm-s390x-cpumodel-gen17-model.patch [RHEL-50212]
- kvm-qga-skip-bind-mounts-in-fs-list.patch [RHEL-71940]
- kvm-vhost-fail-device-start-if-iotlb-update-fails.patch [RHEL-27832]
- kvm-hw-char-pl011-Use-correct-masks-for-IBRD-and-FBRD.patch [RHEL-67107]
- Resolves: RHEL-50212
  ([IBM 9.6 FEAT] KVM: CPU model for new IBM Z HW - qemu part)
- Resolves: RHEL-71940
  (qemu-ga cannot freeze filesystems with sentinelone)
- Resolves: RHEL-27832
  (The post-copy migration of RT-VM leads to race while accessing vhost-user device and hung/stalled target VM)
- Resolves: RHEL-67107
  ([aarch64] [rhel-9.6] Backport some important post 9.1 qemu fixes)
2025-01-06 02:19:14 -05:00

70 lines
2.6 KiB
Diff

From 6aa786b145f484ed6e2e8a1a5089ad6e150306a8 Mon Sep 17 00:00:00 2001
From: Sana Sharm <sansshar@redhat.com>
Date: Fri, 3 Jan 2025 13:27:20 -0500
Subject: [PATCH 19/19] hw/char/pl011: Use correct masks for IBRD and FBRD
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: sansshar <None>
RH-MergeRequest: 310: hw/char/pl011: Use correct masks for IBRD and FBRD
RH-Jira: RHEL-67107
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Commit: [1/1] 4c7174da1dff8de3d7e2d88d84973eb69d6fc28a (sansshar/qemu-kvm-centos)
Brew build id: 5098441
In commit b88cfee90268cad we defined masks for the IBRD and FBRD
integer and fractional baud rate divider registers, to prevent the
guest from writing invalid values which could cause division-by-zero.
Unfortunately we got the mask values the wrong way around: the FBRD
register is six bits and the IBRD register is 16 bits, not
vice-versa.
You would only run into this bug if you programmed the UART to a baud
rate of less than 9600, because for 9600 baud and above the IBRD
value will fit into 6 bits, as per the table in
https://developer.arm.com/documentation/ddi0183/g/programmers-model/register-descriptions/fractional-baud-rate-register--uartfbrd
The only visible effects would be that the value read back from
the register by the guest would be truncated, and we would
print an incorrect baud rate in the debug logs.
Cc: qemu-stable@nongnu.org
Fixes: b88cfee90268 ("hw/char/pl011: Avoid division-by-zero in pl011_get_baudrate()")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2610
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Message-id: 20241007144732.2491331-1-peter.maydell@linaro.org
(cherry picked from commit cd247eae16ab1b9ce97fd34c000c1b883feeda45)
Signed-off-by: Sana Sharma <sansshar@redhat.com>
Changes to be committed:
modified: hw/char/pl011.c
---
hw/char/pl011.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index f8078aa216..949e9d0e0d 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -88,10 +88,10 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr)
#define CR_LBE (1 << 7)
/* Integer Baud Rate Divider, UARTIBRD */
-#define IBRD_MASK 0x3f
+#define IBRD_MASK 0xffff
/* Fractional Baud Rate Divider, UARTFBRD */
-#define FBRD_MASK 0xffff
+#define FBRD_MASK 0x3f
static const unsigned char pl011_id_arm[8] =
{ 0x11, 0x10, 0x14, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
--
2.39.3