[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen staging-4.14] xhci: fix valid.max_access_size to access address registers



commit 782e94132aa7a3672fa5138837d91b48d6aee5dd
Author:     Laurent Vivier <lvivier@xxxxxxxxxx>
AuthorDate: Tue Jul 21 10:33:22 2020 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Thu Aug 27 00:03:16 2020 -0500

    xhci: fix valid.max_access_size to access address registers
    
    QEMU XHCI advertises AC64 (64-bit addressing) but doesn't allow
    64-bit mode access in "runtime" and "operational" MemoryRegionOps.
    
    Set the max_access_size based on sizeof(dma_addr_t) as AC64 is set.
    
    XHCI specs:
    "If the xHC supports 64-bit addressing (AC64 = â??1â??), then software
    should write 64-bit registers using only Qword accesses.  If a
    system is incapable of issuing Qword accesses, then writes to the
    64-bit address fields shall be performed using 2 Dword accesses;
    low Dword-first, high-Dword second.  If the xHC supports 32-bit
    addressing (AC64 = â??0â??), then the high Dword of registers containing
    64-bit address fields are unused and software should write addresses
    using only Dword accesses"
    
    The problem has been detected with SLOF, as linux kernel always accesses
    registers using 32-bit access even if AC64 is set and revealed by
    5d971f9e6725 ("memory: Revert "memory: accept mismatching sizes in 
memory_region_access_valid"")
    
    Suggested-by: Alexey Kardashevskiy <aik@xxxxxxxxxxx>
    Signed-off-by: Laurent Vivier <lvivier@xxxxxxxxxx>
    Message-id: 20200721083322.90651-1-lvivier@xxxxxxxxxx
    Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
    (cherry picked from commit 8e67fda2dd6202ccec093fda561107ba14830a17)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 hw/usb/hcd-xhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index b330e36fe6..67a18fe2b6 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3184,7 +3184,7 @@ static const MemoryRegionOps xhci_oper_ops = {
     .read = xhci_oper_read,
     .write = xhci_oper_write,
     .valid.min_access_size = 4,
-    .valid.max_access_size = 4,
+    .valid.max_access_size = sizeof(dma_addr_t),
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
@@ -3200,7 +3200,7 @@ static const MemoryRegionOps xhci_runtime_ops = {
     .read = xhci_runtime_read,
     .write = xhci_runtime_write,
     .valid.min_access_size = 4,
-    .valid.max_access_size = 4,
+    .valid.max_access_size = sizeof(dma_addr_t),
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.14



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.