Changeset 85819 in vbox for trunk/src/VBox/Devices/VirtIO
- Timestamp:
- Aug 18, 2020 12:58:30 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/VirtioCore.cpp
r85415 r85819 287 287 DECLINLINE(uint16_t) virtioCoreVirtqAvailBufCount_inline(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, PVIRTQUEUE pVirtq) 288 288 { 289 uint16_t uIdx 290 uint16_t u Shadow = pVirtq->uAvailIdxShadow;291 292 uint16_t uDelta; 293 if (uIdx < uShadow)294 u Delta = (uIdx + VIRTQ_MAX_ENTRIES) - uShadow;295 else 296 u Delta = uIdx - uShadow;289 uint16_t uIdxActual = virtioReadAvailRingIdx(pDevIns, pVirtio, pVirtq); 290 uint16_t uIdxShadow = pVirtq->uAvailIdxShadow; 291 uint16_t uIdxDelta; 292 293 if (uIdxActual < uIdxShadow) 294 uIdxDelta = (uIdxActual + VIRTQ_MAX_ENTRIES) - uIdxShadow; 295 else 296 uIdxDelta = uIdxActual - uIdxShadow; 297 297 298 298 LogFunc(("%s has %u %s (idx=%u shadow=%u)\n", 299 pVirtq->szName, u Delta, uDelta == 1 ? "entry" : "entries",300 uIdx , uShadow));301 302 return u Delta;299 pVirtq->szName, uIdxDelta, uIdxDelta == 1 ? "entry" : "entries", 300 uIdxActual, uIdxShadow)); 301 302 return uIdxDelta; 303 303 } 304 304 /** … … 763 763 pVirtqBuf->uHeadIdx = uHeadIdx; 764 764 pVirtqBuf->uVirtq = uVirtq; 765 *ppVirtqBuf = pVirtqBuf;765 *ppVirtqBuf = pVirtqBuf; 766 766 767 767 /* … … 1486 1486 RT_NOREF(pPciDev); 1487 1487 1488 Log7Func((" pDevIns=%p pPciDev=%p uAddress=%#x%s cb=%u pu32Value=%p\n",1489 pDevIns, pPciDev, uAddress, uAddress < 0x10 ? " " : "", cb, pu32Value));1490 1488 if (uAddress == pVirtio->uPciCfgDataOff) 1491 1489 { … … 1498 1496 uint32_t uLength = pPciCap->uLength; 1499 1497 1498 Log7Func((" pDevIns=%p pPciDev=%p uAddress=%#x%s cb=%u uLength=%d, bar=%d\n", 1499 pDevIns, pPciDev, uAddress, uAddress < 0x10 ? " " : "", cb, uLength, pPciCap->uBar)); 1500 1500 1501 if ( (uLength != 1 && uLength != 2 && uLength != 4) 1501 1502 || cb != uLength 1502 1503 || pPciCap->uBar != VIRTIO_REGION_PCI_CAP) 1503 1504 { 1504 ASSERT_GUEST_MSG_FAILED(("Guest read virtio_pci_cfg_cap.pci_cfg_data using mismatching config. Ignoring\n")); 1505 ASSERT_GUEST_MSG_FAILED(("Guest read virtio_pci_cfg_cap.pci_cfg_data using mismatching config. " 1506 "Ignoring\n")); 1505 1507 *pu32Value = UINT32_MAX; 1506 1508 return VINF_SUCCESS; … … 1508 1510 1509 1511 VBOXSTRICTRC rcStrict = virtioMmioRead(pDevIns, pVirtio, pPciCap->uOffset, pu32Value, cb); 1510 Log7Func((" virtio: Guest read virtio_pci_cfg_cap.pci_cfg_data, bar=%d, offset=%d, length=%d, result=%d-> %Rrc\n",1512 Log7Func((" Guest read virtio_pci_cfg_cap.pci_cfg_data, bar=%d, offset=%d, length=%d, result=0x%x -> %Rrc\n", 1511 1513 pPciCap->uBar, pPciCap->uOffset, uLength, *pu32Value, VBOXSTRICTRC_VAL(rcStrict))); 1512 1514 return rcStrict; 1513 1515 } 1516 Log7Func((" pDevIns=%p pPciDev=%p uAddress=%#x%s cb=%u pu32Value=%p\n", 1517 pDevIns, pPciDev, uAddress, uAddress < 0x10 ? " " : "", cb, pu32Value)); 1514 1518 return VINF_PDM_PCI_DO_DEFAULT; 1515 1519 } … … 1860 1864 pCfg->uCapLen = sizeof(VIRTIO_PCI_CFG_CAP_T); 1861 1865 pCfg->uCapNext = (pVirtio->fMsiSupport || pVirtioCC->pbDevSpecificCfg) ? CFG_ADDR_2_IDX(pCfg) + pCfg->uCapLen : 0; 1862 pCfg->uBar = 0;1866 pCfg->uBar = VIRTIO_REGION_PCI_CAP; 1863 1867 pCfg->uOffset = 0; 1864 pCfg->uLength = 0;1868 pCfg->uLength = 4; 1865 1869 cbRegion += pCfg->uLength; 1866 1870 SET_PCI_CAP_LOC(pPciDev, pCfg, pVirtio->LocPciCfgCap, 1);
Note:
See TracChangeset
for help on using the changeset viewer.