Changeset 82004 in vbox for trunk/src/VBox
- Timestamp:
- Nov 19, 2019 4:55:37 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp
r81973 r82004 952 952 cbReqSgBuf, pReq->pDescChain->cbPhysReturn), 953 953 VERR_BUFFER_OVERFLOW); 954 955 954 956 955 virtioCoreR3QueuePut(pDevIns, &pThis->Virtio, pReq->qIdx, pReqSegBuf, pReq->pDescChain, true /* fFence TBD */); -
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
r81975 r82004 270 270 { 271 271 AssertPtr(pGcSgBuf); 272 Assert( (cSegs > 0 && VALID_PTR(paSegs)) 273 || (!cSegs && !paSegs)); 272 Assert( (cSegs > 0 && VALID_PTR(paSegs)) || (!cSegs && !paSegs)); 274 273 Assert(cSegs < (~(unsigned)0 >> 1)); 275 274 … … 293 292 size_t cbData; 294 293 RTGCPHYS pGcBuf; 294 295 295 /* Check that the S/G buffer has memory left. */ 296 296 if (RT_LIKELY(pGcSgBuf->idxSeg < pGcSgBuf->cSegs && pGcSgBuf->cbSegLeft)) … … 302 302 } 303 303 304 AssertMsg( pGcSgBuf->cbSegLeft <= 128 * _1M305 && (RTGCPHYS)pGcSgBuf->pGcSegCur >= (RTGCPHYS)pGcSgBuf->paSegs[pGcSgBuf->idxSeg].pGcSeg306 && (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 <= 307 307 (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)); 313 313 314 314 cbData = RT_MIN(*pcbData, pGcSgBuf->cbSegLeft); … … 881 881 static void virtioNotifyGuestDriver(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, bool fForce) 882 882 { 883 883 884 Assert(idxQueue < RT_ELEMENTS(pVirtio->virtqState)); 884 885 PVIRTQSTATE pVirtq = &pVirtio->virtqState[idxQueue]; … … 1308 1309 * @callback_method_impl{FNIOMMMIONEWREAD, 1309 1310 * 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 * 1310 1315 */ 1311 1316 static DECLCALLBACK(VBOXSTRICTRC) virtioMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb) … … 1313 1318 PVIRTIOCORE pVirtio = PDMINS_2_DATA(pDevIns, PVIRTIOCORE); 1314 1319 PVIRTIOCORECC pVirtioCC = PDMINS_2_DATA_CC(pDevIns, PVIRTIOCORECC); 1320 AssertReturn(cb == 1 || cb == 2 || cb == 4, VERR_INVALID_PARAMETER); 1315 1321 Assert(pVirtio == (PVIRTIOCORE)pvUser); RT_NOREF(pvUser); 1316 1317 /** @todo r=bird: This code does not handle reads spanning more than one1318 * capability structure/area. How does that match the spec? For instance1319 * if the guest uses a 64-bit MOV instruction on this MMIO region, you'll1320 * see cb=8 here. Same if it uses 16 or 32 byte reads. Intel allows all1321 * this, so question is how it's supposed to be handled. At a minimum there1322 * must be an explanation of that here.1323 */1324 1322 1325 1323 uint32_t offIntra; … … 1381 1379 * @callback_method_impl{FNIOMMMIONEWREAD, 1382 1380 * 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. 1383 1384 */ 1384 1385 static DECLCALLBACK(VBOXSTRICTRC) virtioMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb) … … 1386 1387 PVIRTIOCORE pVirtio = PDMINS_2_DATA(pDevIns, PVIRTIOCORE); 1387 1388 PVIRTIOCORECC pVirtioCC = PDMINS_2_DATA_CC(pDevIns, PVIRTIOCORECC); 1389 1390 AssertReturn(cb == 1 || cb == 2 || cb == 4, VERR_INVALID_PARAMETER); 1391 1388 1392 Assert(pVirtio == (PVIRTIOCORE)pvUser); RT_NOREF(pvUser); 1389 1390 /** @todo r=bird: This code does not handle writes spanning more than one1391 * capability structure/area. How does that match the spec? For instance1392 * if the guest uses a 64-bit MOV instruction on this MMIO region, you'll1393 * see cb=8 here. Same if it uses 16 or 32 byte reads. Intel allows all1394 * this, so question is how it's supposed to be handled. At a minimum there1395 * must be an explanation of that here.1396 */1397 1393 1398 1394 uint32_t offIntra; … … 1636 1632 { 1637 1633 1638 LogFunc(("State changing to %s : ***FUNCTIONALITY TBD***\n",1634 LogFunc(("State changing to %s\n", 1639 1635 virtioCoreGetStateChangeText(enmState))); 1640 1636 … … 1649 1645 break; 1650 1646 case kvirtIoVmStateChangedResume: 1647 virtioNotifyGuestDriver(pVirtio->pDevIns, pVirtio, 0 /* idxQueue */, true /* fForce */); 1651 1648 break; 1652 1649 default: … … 1656 1653 RT_NOREF(pDevIns, pVirtio); 1657 1654 } 1658 1659 1660 /**1661 * This sends notification ('kicks') guest driver to check queues for any new1662 * elements in the used queue to process.1663 *1664 * It should be called after resuming in case anything was added to the queues1665 * during suspend/quiescing and a notification was missed, to prevent the guest1666 * from stalling after suspend.1667 */1668 void virtioCoreR3PropagateResumeNotification(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio)1669 {1670 virtioNotifyGuestDriver(pDevIns, pVirtio, 0 /* idxQueue */, true /* fForce */);1671 }1672 1673 1655 1674 1656 /** -
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.h
r81973 r82004 450 450 } 451 451 452 453 452 DECLINLINE(size_t) virtioCoreSgBufCalcTotalLength(PCVIRTIOSGBUF pGcSgBuf) 454 453 { … … 470 469 RTGCPHYS virtioCoreSgBufGetNextSegment(PVIRTIOSGBUF pGcSgBuf, size_t *pcbSeg); 471 470 RTGCPHYS virtioCoreSgBufAdvance(PVIRTIOSGBUF pGcSgBuf, size_t cbAdvance); 472 473 471 void virtioCoreSgBufInit(PVIRTIOSGBUF pSgBuf, PVIRTIOSGSEG paSegs, size_t cSegs); 474 472 size_t virtioCoreSgBufCalcTotalLength(PCVIRTIOSGBUF pGcSgBuf);
Note:
See TracChangeset
for help on using the changeset viewer.