hw/usb/hcd-xhci-pci: Use event ring 0 if mapping unsupported
authorPhil Dennis-Jordan <phil@philjordan.eu>
Fri, 27 Dec 2024 12:13:33 +0000 (13:13 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Mon, 13 Jan 2025 16:21:46 +0000 (17:21 +0100)
The XHCI specification, section 4.17.1 specifies that "If the
Number of Interrupters (MaxIntrs) field is greater than 1, then
Interrupter Mapping shall be supported." and "If Interrupter
Mapping is not supported, the Interrupter Target field shall be
ignored by the xHC and all Events targeted at Interrupter 0."

QEMU's XHCI device has so far not specially addressed this case,
so we add a check to xhci_event() to redirect to event ring and
interrupt 0 if mapping is disabled.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241227121336.25838-4-phil@philjordan.eu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/usb/hcd-xhci.c

index 7dc0994c89c2c8b92b94fa410306d415a32177d9..00d5bc377927a93d5c313c0f775c3d91f302aa96 100644 (file)
@@ -644,6 +644,10 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
     dma_addr_t erdp;
     unsigned int dp_idx;
 
+    if (xhci->numintrs == 1) {
+        v = 0;
+    }
+
     if (v >= xhci->numintrs) {
         DPRINTF("intr nr out of range (%d >= %d)\n", v, xhci->numintrs);
         return;