* [Qemu-devel] usb-musb: calls usb_packet_complete() on packets with no owner
@ 2011-06-13 11:39 Peter Maydell
2011-06-14 7:16 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2011-06-13 11:39 UTC (permalink / raw)
To: QEMU Developers, Gerd Hoffmann
The function usb_packet_complete() in hw/usb.c says:
/* Notify the controller that an async packet is complete. This should only
be called for packets previously deferred by returning USB_RET_ASYNC from
handle_packet. */
and this is checked by means of an assert(p->owner != NULL). However,
hw/usb-musb.c's musb_packet() function does this:
if (s->port.dev)
ret = usb_handle_packet(s->port.dev, &ep->packey[dir].p);
else
ret = USB_RET_NODEV;
if (ret == USB_RET_ASYNC) {
ep->status[dir] = len;
return;
}
ep->status[dir] = ret;
usb_packet_complete(s->port.dev, &ep->packey[dir].p);
which will call usb_packet_complete() on packets which did not
return USB_RET_ASYNC from usb_handle_packet, and so trips this
assert.
Any suggestions about what the right way to fix this is?
(I'm a bit confused about the comment that usb_packet_complete
is to 'notify the controller' -- usb-musb is the controller...)
(I do have a repro case but it's in qemu-linaro because it
uses the omap3 port; I can't seem to persuade my n800 image
to actually use the usb-otg.)
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] usb-musb: calls usb_packet_complete() on packets with no owner
2011-06-13 11:39 [Qemu-devel] usb-musb: calls usb_packet_complete() on packets with no owner Peter Maydell
@ 2011-06-14 7:16 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2011-06-14 7:16 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
Hi,
> usb_packet_complete(s->port.dev,&ep->packey[dir].p);
>
> which will call usb_packet_complete() on packets which did not
> return USB_RET_ASYNC from usb_handle_packet, and so trips this
> assert.
> Any suggestions about what the right way to fix this is?
> (I'm a bit confused about the comment that usb_packet_complete
> is to 'notify the controller' -- usb-musb is the controller...)
The usual work flow is that the usb device (usb-msd.c does this for
example) kicks the I/O, then returns USB_RET_ASYNC, and when the I/O is
completed it calls usb_packet_complete().
In case of the musb controller this will call musb_schedule_cb() which
is hooked into musb_port_ops->complete. So simply calling
musb_schedule_cb() directly for non-async packets should work I think.
cheers,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-14 7:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-13 11:39 [Qemu-devel] usb-musb: calls usb_packet_complete() on packets with no owner Peter Maydell
2011-06-14 7:16 ` Gerd Hoffmann
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).