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

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