VirtualBox

Changeset 82004 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 19, 2019 4:55:37 PM (5 years ago)
Author:
vboxsync
Message:

Storage/DevVirtioSCSI.cpp: Finish last of Knut's to do items except R0/RC handling. Still working on save/load execå.

Location:
trunk/src/VBox/Devices
Files:
3 edited

Legend:

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

    r81973 r82004  
    952952                         cbReqSgBuf, pReq->pDescChain->cbPhysReturn),
    953953                       VERR_BUFFER_OVERFLOW);
    954 
    955954
    956955        virtioCoreR3QueuePut(pDevIns, &pThis->Virtio, pReq->qIdx, pReqSegBuf, pReq->pDescChain, true /* fFence TBD */);
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp

    r81975 r82004  
    270270{
    271271    AssertPtr(pGcSgBuf);
    272     Assert(   (cSegs > 0 && VALID_PTR(paSegs))
    273            || (!cSegs && !paSegs));
     272    Assert(   (cSegs > 0 && VALID_PTR(paSegs)) || (!cSegs && !paSegs));
    274273    Assert(cSegs < (~(unsigned)0 >> 1));
    275274
     
    293292    size_t cbData;
    294293    RTGCPHYS pGcBuf;
     294
    295295    /* Check that the S/G buffer has memory left. */
    296296    if (RT_LIKELY(pGcSgBuf->idxSeg < pGcSgBuf->cSegs && pGcSgBuf->cbSegLeft))
     
    302302    }
    303303
    304     AssertMsg(  pGcSgBuf->cbSegLeft <= 128 * _1M
    305             && (RTGCPHYS)pGcSgBuf->pGcSegCur >= (RTGCPHYS)pGcSgBuf->paSegs[pGcSgBuf->idxSeg].pGcSeg
    306             && (RTGCPHYS)pGcSgBuf->pGcSegCur + pGcSgBuf->cbSegLeft <=
     304    AssertMsg(    pGcSgBuf->cbSegLeft <= 128 * _1M
     305              && (RTGCPHYS)pGcSgBuf->pGcSegCur >= (RTGCPHYS)pGcSgBuf->paSegs[pGcSgBuf->idxSeg].pGcSeg
     306              && (RTGCPHYS)pGcSgBuf->pGcSegCur + pGcSgBuf->cbSegLeft <=
    307307                   (RTGCPHYS)pGcSgBuf->paSegs[pGcSgBuf->idxSeg].pGcSeg + pGcSgBuf->paSegs[pGcSgBuf->idxSeg].cbSeg,
    308               ("pGcSgBuf->idxSeg=%d pGcSgBuf->cSegs=%d pGcSgBuf->pGcSegCur=%p pGcSgBuf->cbSegLeft=%zd "
    309                "pGcSgBuf->paSegs[%d].pGcSeg=%p pGcSgBuf->paSegs[%d].cbSeg=%zd\n",
    310                pGcSgBuf->idxSeg, pGcSgBuf->cSegs, pGcSgBuf->pGcSegCur, pGcSgBuf->cbSegLeft,
    311                pGcSgBuf->idxSeg, pGcSgBuf->paSegs[pGcSgBuf->idxSeg].pGcSeg, pGcSgBuf->idxSeg,
    312                pGcSgBuf->paSegs[pGcSgBuf->idxSeg].cbSeg));
     308                 ("pGcSgBuf->idxSeg=%d pGcSgBuf->cSegs=%d pGcSgBuf->pGcSegCur=%p pGcSgBuf->cbSegLeft=%zd "
     309                  "pGcSgBuf->paSegs[%d].pGcSeg=%p pGcSgBuf->paSegs[%d].cbSeg=%zd\n",
     310                  pGcSgBuf->idxSeg, pGcSgBuf->cSegs, pGcSgBuf->pGcSegCur, pGcSgBuf->cbSegLeft,
     311                  pGcSgBuf->idxSeg, pGcSgBuf->paSegs[pGcSgBuf->idxSeg].pGcSeg, pGcSgBuf->idxSeg,
     312                  pGcSgBuf->paSegs[pGcSgBuf->idxSeg].cbSeg));
    313313
    314314    cbData = RT_MIN(*pcbData, pGcSgBuf->cbSegLeft);
     
    881881static void virtioNotifyGuestDriver(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, bool fForce)
    882882{
     883
    883884    Assert(idxQueue < RT_ELEMENTS(pVirtio->virtqState));
    884885    PVIRTQSTATE pVirtq = &pVirtio->virtqState[idxQueue];
     
    13081309 * @callback_method_impl{FNIOMMMIONEWREAD,
    13091310 * Memory mapped I/O Handler for PCI Capabilities read operations.}
     1311 *
     1312 * This MMIO handler specifically supports the VIRTIO_PCI_CAP_PCI_CFG capability defined
     1313 * in the VirtIO 1.0 specification, section 4.1.4.7, and as such is limited to cb == 1, cb == 2, or cb==4 type reads.
     1314 *
    13101315 */
    13111316static DECLCALLBACK(VBOXSTRICTRC) virtioMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb)
     
    13131318    PVIRTIOCORE   pVirtio   = PDMINS_2_DATA(pDevIns, PVIRTIOCORE);
    13141319    PVIRTIOCORECC pVirtioCC = PDMINS_2_DATA_CC(pDevIns, PVIRTIOCORECC);
     1320    AssertReturn(cb == 1 || cb == 2 || cb == 4, VERR_INVALID_PARAMETER);
    13151321    Assert(pVirtio == (PVIRTIOCORE)pvUser); RT_NOREF(pvUser);
    1316 
    1317     /** @todo r=bird: This code does not handle reads spanning more than one
    1318      * capability structure/area.   How does that match the spec?   For instance
    1319      * if the guest uses a 64-bit MOV instruction on this MMIO region, you'll
    1320      * see cb=8 here.  Same if it uses 16 or 32 byte reads.  Intel allows all
    1321      * this, so question is how it's supposed to be handled.  At a minimum there
    1322      * must be an explanation of that here.
    1323      */
    13241322
    13251323    uint32_t offIntra;
     
    13811379 * @callback_method_impl{FNIOMMMIONEWREAD,
    13821380 * Memory mapped I/O Handler for PCI Capabilities write operations.}
     1381 *
     1382 * This MMIO handler specifically supports the VIRTIO_PCI_CAP_PCI_CFG capability defined
     1383 * in the VirtIO 1.0 specification, section 4.1.4.7, and as such is limited to cb == 1, cb == 2, or cb==4 type writes.
    13831384 */
    13841385static DECLCALLBACK(VBOXSTRICTRC) virtioMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb)
     
    13861387    PVIRTIOCORE   pVirtio   = PDMINS_2_DATA(pDevIns, PVIRTIOCORE);
    13871388    PVIRTIOCORECC pVirtioCC = PDMINS_2_DATA_CC(pDevIns, PVIRTIOCORECC);
     1389
     1390    AssertReturn(cb == 1 || cb == 2 || cb == 4, VERR_INVALID_PARAMETER);
     1391
    13881392    Assert(pVirtio == (PVIRTIOCORE)pvUser); RT_NOREF(pvUser);
    1389 
    1390     /** @todo r=bird: This code does not handle writes spanning more than one
    1391      * capability structure/area.   How does that match the spec?   For instance
    1392      * if the guest uses a 64-bit MOV instruction on this MMIO region, you'll
    1393      * see cb=8 here.  Same if it uses 16 or 32 byte reads.  Intel allows all
    1394      * this, so question is how it's supposed to be handled.  At a minimum there
    1395      * must be an explanation of that here.
    1396      */
    13971393
    13981394    uint32_t offIntra;
     
    16361632{
    16371633
    1638     LogFunc(("State changing to %s: ***FUNCTIONALITY TBD***\n",
     1634    LogFunc(("State changing to %s\n",
    16391635        virtioCoreGetStateChangeText(enmState)));
    16401636
     
    16491645            break;
    16501646        case kvirtIoVmStateChangedResume:
     1647            virtioNotifyGuestDriver(pVirtio->pDevIns, pVirtio, 0 /* idxQueue */, true /* fForce */);
    16511648            break;
    16521649        default:
     
    16561653    RT_NOREF(pDevIns, pVirtio);
    16571654}
    1658 
    1659 
    1660 /**
    1661  * This sends notification ('kicks') guest driver to check queues for any new
    1662  * elements in the used queue to process.
    1663  *
    1664  * It should be called after resuming in case anything was added to the queues
    1665  * during suspend/quiescing and a notification was missed, to prevent the guest
    1666  * from stalling after suspend.
    1667  */
    1668 void virtioCoreR3PropagateResumeNotification(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio)
    1669 {
    1670     virtioNotifyGuestDriver(pDevIns, pVirtio, 0 /* idxQueue */, true /* fForce */);
    1671 }
    1672 
    16731655
    16741656/**
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.h

    r81973 r82004  
    450450}
    451451
    452 
    453452DECLINLINE(size_t) virtioCoreSgBufCalcTotalLength(PCVIRTIOSGBUF pGcSgBuf)
    454453{
     
    470469RTGCPHYS virtioCoreSgBufGetNextSegment(PVIRTIOSGBUF pGcSgBuf, size_t *pcbSeg);
    471470RTGCPHYS virtioCoreSgBufAdvance(PVIRTIOSGBUF pGcSgBuf, size_t cbAdvance);
    472 
    473471void     virtioCoreSgBufInit(PVIRTIOSGBUF pSgBuf, PVIRTIOSGSEG paSegs, size_t cSegs);
    474472size_t   virtioCoreSgBufCalcTotalLength(PCVIRTIOSGBUF pGcSgBuf);
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