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

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