VirtualBox

Ticket #11207: vbox-ohci_cancellations.diff

File vbox-ohci_cancellations.diff, 2.0 KB (added by Derek, 12 years ago)

Attempt to provide a way for virtual box's ohci driver to cancel host URBs in response to guest cancellations

  • src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp

     
    19161916    PUSBPROXYDEV pProxyDev = usbProxyFromVusbDev(pUrb->pDev);
    19171917#endif
    19181918    PUSBPROXYURBLNX pUrbLnx = (PUSBPROXYURBLNX)pUrb->Dev.pvPrivate;
     1919    /* I don't know why this happens, but it does! */
     1920    if (!pUrbLnx)
     1921        return;
     1922
    19191923    if (pUrbLnx->pSplitHead)
    19201924    {
    19211925        /* split */
  • src/VBox/Devices/USB/DevOHCI.cpp

     
    35213521    pOhci->uFrameRate         = u32FrameRate;
    35223522}
    35233523
     3524/*
     3525 * Test every URB in flight to ensure it hasn't been cancelled
     3526 *
     3527 * When the guest OS cancels a USB request we must ensure that it is removed from the USB
     3528 * proxy subsystem immediately.  If this isn't done, the guest OS may submit a new request
     3529 * while the USB proxy system doesn't realize the old one is canceled.  The old URB will receive
     3530 * the data for the new request, be subsequently discarded, and the guest USB device driver will
     3531 * timeout and fail.
     3532 */
     3533static int ohciPerformCancellations(POHCI pOhci)
     3534{
     3535    unsigned i, cLeft = pOhci->cInFlight;
     3536    PVUSBURB pUrb;
     3537    for (i = 0; cLeft && i < RT_ELEMENTS(pOhci->aInFlight); i++)
     3538        if (pOhci->aInFlight[i].GCPhysTD) {
     3539            pUrb = pOhci->aInFlight[i].pUrb;
     3540            if (ohciHasUrbBeenCanceled(pOhci, pUrb, NULL))
     3541                pOhci->RootHub.pIRhConn->pfnCancelUrbsEp(pOhci->RootHub.pIRhConn, pUrb);
     3542            cLeft--;
     3543        }
     3544}
    35243545
    35253546/**
    35263547 * Generate a Start-Of-Frame event, and set a timer for End-Of-Frame.
     
    35803601        return;
    35813602    }
    35823603
     3604    ohciPerformCancellations(pOhci);
     3605
    35833606    /*
    35843607     * Periodic EPs.
    35853608     */

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy