qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ehci: clear suspend bit on detach
@ 2015-10-21  7:44 Gerd Hoffmann
  2015-10-21  7:47 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2015-10-21  7:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hans de Goede, Gerd Hoffmann

When a device is detached, clear the suspend bit (PORTSC_SUSPEND)
in the port status register.

The specs are not *that* clear what is supposed to happen in case
a suspended device is unplugged.  But the enable bit (PORTSC_PED)
is cleared, and the specs mention setting suspend with enable being
unset is undefined behavior.  So clearing them both looks reasonable,
and it actually fixes the reported bug.

https://bugzilla.redhat.com/show_bug.cgi?id=1268879

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-ehci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 64a54c6..4e2161b 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -726,7 +726,7 @@ static void ehci_detach(USBPort *port)
     ehci_queues_rip_device(s, port->dev, 0);
     ehci_queues_rip_device(s, port->dev, 1);
 
-    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED);
+    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED|PORTSC_SUSPEND);
     *portsc |= PORTSC_CSC;
 
     ehci_raise_irq(s, USBSTS_PCD);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] ehci: clear suspend bit on detach
  2015-10-21  7:44 [Qemu-devel] [PATCH] ehci: clear suspend bit on detach Gerd Hoffmann
@ 2015-10-21  7:47 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2015-10-21  7:47 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

Hi,

On 21-10-15 09:44, Gerd Hoffmann wrote:
> When a device is detached, clear the suspend bit (PORTSC_SUSPEND)
> in the port status register.
>
> The specs are not *that* clear what is supposed to happen in case
> a suspended device is unplugged.  But the enable bit (PORTSC_PED)
> is cleared, and the specs mention setting suspend with enable being
> unset is undefined behavior.  So clearing them both looks reasonable,
> and it actually fixes the reported bug.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1268879
>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Thanks for fixing this. Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>   hw/usb/hcd-ehci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
> index 64a54c6..4e2161b 100644
> --- a/hw/usb/hcd-ehci.c
> +++ b/hw/usb/hcd-ehci.c
> @@ -726,7 +726,7 @@ static void ehci_detach(USBPort *port)
>       ehci_queues_rip_device(s, port->dev, 0);
>       ehci_queues_rip_device(s, port->dev, 1);
>
> -    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED);
> +    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED|PORTSC_SUSPEND);
>       *portsc |= PORTSC_CSC;
>
>       ehci_raise_irq(s, USBSTS_PCD);
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-21  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21  7:44 [Qemu-devel] [PATCH] ehci: clear suspend bit on detach Gerd Hoffmann
2015-10-21  7:47 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).