VirtualBox

Changeset 2842 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
May 24, 2007 3:33:44 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21479
Message:

Mark drive as ready immediately after a completed PIO read. This
addresses the Linux guest PIO read problem, see #1571.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r2839 r2842  
    36173617    }
    36183618
    3619     ataUnsetStatus(s, ATA_STAT_READY | ATA_STAT_DRQ);
    3620     ataSetStatus(s, ATA_STAT_BUSY);
    3621 
    3622     Log2(("%s: Ctl#%d: message to async I/O thread, continuing PIO transfer\n", __FUNCTION__, ATACONTROLLER_IDX(pCtl)));
    3623     ataAsyncIOPutRequest(pCtl, &ataPIORequest);
     3619    if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE || s->iSourceSink != ATAFN_SS_NULL)
     3620    {
     3621        /* Need to continue the transfer in the async I/O thread. This is
     3622         * the case for write operations or generally for not yet finished
     3623         * transfers (some data might need to be read). */
     3624        ataUnsetStatus(s, ATA_STAT_READY | ATA_STAT_DRQ);
     3625        ataSetStatus(s, ATA_STAT_BUSY);
     3626
     3627        Log2(("%s: Ctl#%d: message to async I/O thread, continuing PIO transfer\n", __FUNCTION__, ATACONTROLLER_IDX(pCtl)));
     3628        ataAsyncIOPutRequest(pCtl, &ataPIORequest);
     3629    }
     3630    else
     3631    {
     3632        /* Everything finished, mark device as ready. */
     3633        ataUnsetStatus(s, ATA_STAT_DRQ);
     3634
     3635        Log2(("%s: Ctl#%d: skipping message to async I/O thread, ending PIO transfer\n", __FUNCTION__, ATACONTROLLER_IDX(pCtl)));
     3636        ataPIOTransferStop(s);
     3637    }
    36243638}
    36253639
     
    41684182                            ataSetIRQ(s);
    41694183
    4170                         pCtl->uAsyncIOState = ATA_AIO_PIO;
     4184                        if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE || s->iSourceSink != ATAFN_SS_NULL)
     4185                        {
     4186                            /* Write operations and not yet finished transfers
     4187                             * must be completed in the async I/O thread. */
     4188                            pCtl->uAsyncIOState = ATA_AIO_PIO;
     4189                        }
     4190                        else
     4191                        {
     4192                            /* Finished read operation can be handled inline
     4193                             * in the end of PIO transfer handling code. Linux
     4194                             * depends on this, as it waits only briefly for
     4195                             * devices to become ready after incoming data
     4196                             * transfer. Cannot find anything in the ATA spec
     4197                             * that backs this assumption, but as all kernels
     4198                             * are affected (though most of the time it does
     4199                             * not cause any harm) this must work. */
     4200                            pCtl->uAsyncIOState = ATA_AIO_NEW;
     4201                        }
    41714202                    }
    41724203                    else
     
    42794310                    ataSetIRQ(s);
    42804311
    4281                     pCtl->uAsyncIOState = ATA_AIO_PIO;
     4312                    if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE || s->iSourceSink != ATAFN_SS_NULL)
     4313                    {
     4314                        /* Write operations and not yet finished transfers
     4315                         * must be completed in the async I/O thread. */
     4316                        pCtl->uAsyncIOState = ATA_AIO_PIO;
     4317                    }
     4318                    else
     4319                    {
     4320                        /* Finished read operation can be handled inline
     4321                         * in the end of PIO transfer handling code. Linux
     4322                         * depends on this, as it waits only briefly for
     4323                         * devices to become ready after incoming data
     4324                         * transfer. Cannot find anything in the ATA spec
     4325                         * that backs this assumption, but as all kernels
     4326                         * are affected (though most of the time it does
     4327                         * not cause any harm) this must work. */
     4328                        pCtl->uAsyncIOState = ATA_AIO_NEW;
     4329                    }
    42824330                }
    42834331                else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette