qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OHCI/usb pass through


From: Gerd Hoffmann
Subject: Re: OHCI/usb pass through
Date: Fri, 1 Oct 2021 06:39:43 +0200

  Hi,

> [...]
>     /* Active packets.  */
>     uint32_t old_ctl;
>     USBPacket usb_packet;
>     uint8_t usb_buf[8192];
>     uint32_t async_td;
>     bool async_complete;
> 
>     void (*ohci_die)(struct OHCIState *ohci);
> } OHCIState;
> 
> Then everything in hcd-ohci seems to reuse ohci->usb_packet and I wonder if
> it can happen that it's overwritten while an async packet is still using it.

Plausible theory.  That also nicely explains why you need traffic on two
endpoints at the same time to trigger it.

> In any case to both fix the device model and to avoid this possible problem
> described above it seems we would need to ditch the packet and async_td
> fields from OHCIState and move them to the endpoint to allow one active
> packet per endpoint.

Either that, or maintain a linked list of packets.

> We can get the endpoint from a packet and from ohci so
> I wonder if we can get the active packet from ep->queue (and how to do that)

I think ohci never looks beyond the active td so there should never be
more than one packet on the list.

HTH,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]