Blame SOURCES/kvm-xhci-fix-valid.max_access_size-to-access-address-reg.patch

6e7d01
From f38f51d422e82d1241b678960dd6a033ffa398da Mon Sep 17 00:00:00 2001
6e7d01
From: Jon Maloy <jmaloy@redhat.com>
6e7d01
Date: Wed, 21 Apr 2021 22:30:05 -0400
6e7d01
Subject: [PATCH 6/7] xhci: fix valid.max_access_size to access address
6e7d01
 registers
6e7d01
MIME-Version: 1.0
6e7d01
Content-Type: text/plain; charset=UTF-8
6e7d01
Content-Transfer-Encoding: 8bit
6e7d01
6e7d01
RH-Author: Jon Maloy <jmaloy@redhat.com>
6e7d01
Message-id: <20210421223006.19650-6-jmaloy@redhat.com>
6e7d01
Patchwork-id: 101483
6e7d01
O-Subject: [RHEL-8.5.0 qemu-kvm PATCH v2 5/6] xhci: fix valid.max_access_size to access address registers
6e7d01
Bugzilla: 1842478
6e7d01
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
6e7d01
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6e7d01
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
6e7d01
6e7d01
From: Laurent Vivier <lvivier@redhat.com>
6e7d01
6e7d01
QEMU XHCI advertises AC64 (64-bit addressing) but doesn't allow
6e7d01
64-bit mode access in "runtime" and "operational" MemoryRegionOps.
6e7d01
6e7d01
Set the max_access_size based on sizeof(dma_addr_t) as AC64 is set.
6e7d01
6e7d01
XHCI specs:
6e7d01
"If the xHC supports 64-bit addressing (AC64 = ‘1’), then software
6e7d01
should write 64-bit registers using only Qword accesses.  If a
6e7d01
system is incapable of issuing Qword accesses, then writes to the
6e7d01
64-bit address fields shall be performed using 2 Dword accesses;
6e7d01
low Dword-first, high-Dword second.  If the xHC supports 32-bit
6e7d01
addressing (AC64 = ‘0’), then the high Dword of registers containing
6e7d01
64-bit address fields are unused and software should write addresses
6e7d01
using only Dword accesses"
6e7d01
6e7d01
The problem has been detected with SLOF, as linux kernel always accesses
6e7d01
registers using 32-bit access even if AC64 is set and revealed by
6e7d01
5d971f9e6725 ("memory: Revert "memory: accept mismatching sizes in memory_region_access_valid"")
6e7d01
6e7d01
Suggested-by: Alexey Kardashevskiy <aik@au1.ibm.com>
6e7d01
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
6e7d01
Message-id: 20200721083322.90651-1-lvivier@redhat.com
6e7d01
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6e7d01
6e7d01
(cherry picked from commit 8e67fda2dd6202ccec093fda561107ba14830a17)
6e7d01
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
6e7d01
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
6e7d01
---
6e7d01
 hw/usb/hcd-xhci.c | 4 ++--
6e7d01
 1 file changed, 2 insertions(+), 2 deletions(-)
6e7d01
6e7d01
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
6e7d01
index 646c78cde9..ab449bb003 100644
6e7d01
--- a/hw/usb/hcd-xhci.c
6e7d01
+++ b/hw/usb/hcd-xhci.c
6e7d01
@@ -3183,7 +3183,7 @@ static const MemoryRegionOps xhci_oper_ops = {
6e7d01
     .read = xhci_oper_read,
6e7d01
     .write = xhci_oper_write,
6e7d01
     .valid.min_access_size = 4,
6e7d01
-    .valid.max_access_size = 4,
6e7d01
+    .valid.max_access_size = sizeof(dma_addr_t),
6e7d01
     .endianness = DEVICE_LITTLE_ENDIAN,
6e7d01
 };
6e7d01
 
6e7d01
@@ -3199,7 +3199,7 @@ static const MemoryRegionOps xhci_runtime_ops = {
6e7d01
     .read = xhci_runtime_read,
6e7d01
     .write = xhci_runtime_write,
6e7d01
     .valid.min_access_size = 4,
6e7d01
-    .valid.max_access_size = 4,
6e7d01
+    .valid.max_access_size = sizeof(dma_addr_t),
6e7d01
     .endianness = DEVICE_LITTLE_ENDIAN,
6e7d01
 };
6e7d01
 
6e7d01
-- 
6e7d01
2.27.0
6e7d01