[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/25] hcd-ohci: Fix inconsistency when resetting ohci root hubs
From: |
Gerd Hoffmann |
Subject: |
[PULL 13/25] hcd-ohci: Fix inconsistency when resetting ohci root hubs |
Date: |
Mon, 26 Sep 2022 11:54:57 +0200 |
From: Qiang Liu <cyruscyliu@gmail.com>
I found an assertion failure in usb_cancel_packet() and posted my analysis in
https://gitlab.com/qemu-project/qemu/-/issues/1180. I think this issue is
because the inconsistency when resetting ohci root hubs.
There are two ways to reset ohci root hubs: 1) through HcRhPortStatus, 2)
through HcControl. However, when the packet's status is USB_PACKET_ASYNC,
resetting through HcRhPortStatus will complete the packet and thus resetting
through HcControl will fail. That is because IMO resetting through
HcRhPortStatus should first detach the port and then invoked usb_device_reset()
just like through HcControl. Therefore, I change usb_device_reset() to
usb_port_reset() where usb_detach() and usb_device_reset() are invoked
consequently.
Fixes: d28f4e2d8631 ("usb: kill USB_MSG_RESET")
Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1180
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
Message-Id: <20220830033022.1164961-1-cyruscyliu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ohci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 72bdde92617c..28d703481515 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1436,7 +1436,7 @@ static void ohci_port_set_status(OHCIState *ohci, int
portnum, uint32_t val)
if (ohci_port_set_if_connected(ohci, portnum, val & OHCI_PORT_PRS)) {
trace_usb_ohci_port_reset(portnum);
- usb_device_reset(port->port.dev);
+ usb_port_reset(&port->port);
port->ctrl &= ~OHCI_PORT_PRS;
/* ??? Should this also set OHCI_PORT_PESC. */
port->ctrl |= OHCI_PORT_PES | OHCI_PORT_PRSC;
--
2.37.3
- [PULL 01/25] ui/console: Get tab completion working again in the SDL monitor vc, (continued)
- [PULL 01/25] ui/console: Get tab completion working again in the SDL monitor vc, Gerd Hoffmann, 2022/09/26
- [PULL 03/25] Revert "main-loop: Disable block backend global state assertion on Cocoa", Gerd Hoffmann, 2022/09/26
- [PULL 06/25] ui/clipboard: fix serial priority, Gerd Hoffmann, 2022/09/26
- [PULL 04/25] meson: Allow to enable gtk and sdl while cocoa is enabled, Gerd Hoffmann, 2022/09/26
- [PULL 02/25] ui/cocoa: Run qemu_init in the main thread, Gerd Hoffmann, 2022/09/26
- [PULL 05/25] ui: add some vdagent related traces, Gerd Hoffmann, 2022/09/26
- [PULL 07/25] ui/vdagent: always reset the clipboard serial on caps, Gerd Hoffmann, 2022/09/26
- [PULL 08/25] ui/clipboard: reset the serial state on reset, Gerd Hoffmann, 2022/09/26
- [PULL 11/25] hw/usb/hcd-xhci: Check whether DMA accesses fail, Gerd Hoffmann, 2022/09/26
- [PULL 10/25] ui/console: fix three double frees in png_save(), Gerd Hoffmann, 2022/09/26
- [PULL 13/25] hcd-ohci: Fix inconsistency when resetting ohci root hubs,
Gerd Hoffmann <=
- [PULL 12/25] hcd-ohci: Drop ohci_service_iso_td() if ed->head & OHCI_DPTR_MASK is zero, Gerd Hoffmann, 2022/09/26
- [PULL 15/25] usb/msd: add usb_msd_fatal_error() and fix guest-triggerable assert, Gerd Hoffmann, 2022/09/26
- [PULL 09/25] ui/vdagent: fix serial reset of guest agent, Gerd Hoffmann, 2022/09/26
- [PULL 16/25] hcd-xhci: drop operation with secondary stream arrays enabled, Gerd Hoffmann, 2022/09/26
- [PULL 19/25] usbnet: Detect short packets as sent by the xHCI controller, Gerd Hoffmann, 2022/09/26
- [PULL 14/25] usb/msd: move usb_msd_packet_complete(), Gerd Hoffmann, 2022/09/26
- [PULL 17/25] usbnet: Add missing usb_wakeup() call in usbnet_receive(), Gerd Hoffmann, 2022/09/26
- [PULL 18/25] usbnet: Accept mandatory USB_CDC_SET_ETHERNET_PACKET_FILTER request, Gerd Hoffmann, 2022/09/26