VirtualBox

Changeset 91703 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Oct 13, 2021 2:24:30 AM (3 years ago)
Author:
vboxsync
Message:

DevVirtioNet_1_0.cpp: Convert VirtIO to be 'transitional' device, that handles both legacy (0.9) guests and modern (1.0+) guests. Various other small improvements and reduction/improved formatting of logging. See BugRef:8561, Comment #137

File:
1 edited

Legend:

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

    r90791 r91703  
    358358{
    359359    R3PTRTYPE(PPDMTHREAD)           pThread;                    /**< pointer to worker thread's handle                 */
    360     uint16_t                        auRedoDescs[VIRTQ_MAX_ENTRIES];/**< List of previously suspended reqs to re-submit    */
     360    uint16_t                        auRedoDescs[VIRTQ_SIZE];/**< List of previously suspended reqs to re-submit    */
    361361    uint16_t                        cRedoDescs;                 /**< Number of redo desc chain head desc idxes in list */
    362362} VIRTIOSCSIWORKERR3;
     
    457457    uint32_t                        fHasT10pi;
    458458
    459     /** True if VIRTIO_SCSI_F_T10_PI was negotiated */
     459    /** True if VIRTIO_SCSI_F_HOTPLUG was negotiated */
    460460    uint32_t                        fHasHotplug;
    461461
    462     /** True if VIRTIO_SCSI_F_T10_PI was negotiated */
     462    /** True if VIRTIO_SCSI_F_INOUT was negotiated */
    463463    uint32_t                        fHasInOutBufs;
    464464
    465     /** True if VIRTIO_SCSI_F_T10_PI was negotiated */
     465    /** True if VIRTIO_SCSI_F_CHANGE was negotiated */
    466466    uint32_t                        fHasLunChange;
    467467
     
    559559    uint16_t                       uVirtqNbr;                   /**< Index of queue this request arrived on            */
    560560    PVIRTQBUF                      pVirtqBuf;                   /**< Prepared desc chain pulled from virtq avail ring  */
    561     size_t                         cbDataIn;                    /**< size of dataout buffer                            */
     561    size_t                         cbDataIn;                    /**< size of datain buffer                             */
    562562    size_t                         cbDataOut;                   /**< size of dataout buffer                            */
    563563    uint16_t                       uDataInOff;                  /**< Fixed size of respHdr + sense (precede datain)    */
    564     uint16_t                       uDataOutOff;                 /**< Fixed size of respHdr + sense (precede datain)    */
     564    uint16_t                       uDataOutOff;                 /**< Fixed size of reqhdr + cdb (precede dataout)      */
    565565    uint32_t                       cbSenseAlloc;                /**< Size of sense buffer                              */
    566566    size_t                         cbSenseLen;                  /**< Receives \# bytes written into sense buffer       */
     
    828828    RTSGSEG aReqSegs[2];
    829829
    830     /* Segment #1: Request header*/
     830    /* Segment #1: Response header*/
    831831    aReqSegs[0].pvSeg = pRespHdr;
    832832    aReqSegs[0].cbSeg = sizeof(*pRespHdr);
     
    11641164     */
    11651165    size_t const cbReqHdr = sizeof(REQ_CMD_HDR_T) + cbCdb;
    1166     AssertReturn(pVirtqBuf->cbPhysSend >= cbReqHdr, VERR_INVALID_PARAMETER);
     1166    AssertReturn(pVirtqBuf && pVirtqBuf->cbPhysSend >= cbReqHdr, VERR_INVALID_PARAMETER);
    11671167
    11681168    AssertCompile(VIRTIOSCSI_CDB_SIZE_MAX < 4096);
     
    17141714        /*
    17151715         * BIOS may change these values. When the OS comes up, and KVM driver accessed
    1716          * through the Windows, assumes they are the default size. So as per the VirtIO 1.0 spec,
     1716         * through Windows, it assumes they are the default size. So as per the VirtIO 1.0 spec,
    17171717         * 5.6.4, these device configuration values must be set to default upon device reset.
    17181718         */
     
    19581958        rc = pHlp->pfnSSMGetU16(pSSM, &cReqsRedo);
    19591959        AssertRCReturn(rc, rc);
    1960         AssertReturn(cReqsRedo < VIRTQ_MAX_ENTRIES,
     1960        AssertReturn(cReqsRedo < VIRTQ_SIZE,
    19611961                     pHlp->pfnSSMSetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
    19621962                                              N_("Bad count of I/O transactions to re-do in saved state (%#x, max %#x - 1)"),
    1963                                               cReqsRedo, VIRTQ_MAX_ENTRIES));
     1963                                              cReqsRedo, VIRTQ_SIZE));
    19641964
    19651965        for (uint16_t uVirtqNbr = VIRTQ_REQ_BASE; uVirtqNbr < VIRTIOSCSI_VIRTQ_CNT; uVirtqNbr++)
     
    19821982            rc = pHlp->pfnSSMGetU16(pSSM, &idxHead);
    19831983            AssertRCReturn(rc, rc);
    1984             AssertReturn(idxHead < VIRTQ_MAX_ENTRIES,
     1984            AssertReturn(idxHead < VIRTQ_SIZE,
    19851985                         pHlp->pfnSSMSetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
    19861986                                                  N_("Bad queue element index for re-do in saved state (%#x, max %#x)"),
    1987                                                   idxHead, VIRTQ_MAX_ENTRIES - 1));
     1987                                                  idxHead, VIRTQ_SIZE - 1));
    19881988
    19891989            PVIRTIOSCSIWORKERR3 pWorkerR3 = &pThisCC->aWorkers[uVirtqNbr];
    19901990            pWorkerR3->auRedoDescs[pWorkerR3->cRedoDescs++] = idxHead;
    1991             pWorkerR3->cRedoDescs %= VIRTQ_MAX_ENTRIES;
     1991            pWorkerR3->cRedoDescs %= VIRTQ_SIZE;
    19921992        }
    19931993    }
Note: See TracChangeset for help on using the changeset viewer.

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