Skip to content

Commit 782e941

Browse files
viviermdroth
authored andcommitted
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 5d971f9 ("memory: Revert "memory: accept mismatching sizes in memory_region_access_valid"") Suggested-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Laurent Vivier <[email protected]> Message-id: [email protected] Signed-off-by: Gerd Hoffmann <[email protected]> (cherry picked from commit 8e67fda) Signed-off-by: Michael Roth <[email protected]>
1 parent 182be02 commit 782e941

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hw/usb/hcd-xhci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3184,7 +3184,7 @@ static const MemoryRegionOps xhci_oper_ops = {
31843184
.read = xhci_oper_read,
31853185
.write = xhci_oper_write,
31863186
.valid.min_access_size = 4,
3187-
.valid.max_access_size = 4,
3187+
.valid.max_access_size = sizeof(dma_addr_t),
31883188
.endianness = DEVICE_LITTLE_ENDIAN,
31893189
};
31903190

@@ -3200,7 +3200,7 @@ static const MemoryRegionOps xhci_runtime_ops = {
32003200
.read = xhci_runtime_read,
32013201
.write = xhci_runtime_write,
32023202
.valid.min_access_size = 4,
3203-
.valid.max_access_size = 4,
3203+
.valid.max_access_size = sizeof(dma_addr_t),
32043204
.endianness = DEVICE_LITTLE_ENDIAN,
32053205
};
32063206

0 commit comments

Comments
 (0)